salesforcecypresscypress-component-test-runner

When trying to launch below web url using automation script, web page is not fully loaded. Web page is developed using salesforce lighting components


enter image description here

When we turn off Salesforce locker service, page loads fine.

I raised it with Salesforce support, after going back and forth this was the final response from them

  1. As discussed, we could see that the URL is loading in web browser/builder wise and only in third party tool it is not loading (i.e. cypress runner). As mentioned we do not support third-party tool issues, as we are not aware how data is configured in third party tool, request you check on the third-party configuration or security wise.

  2. Also we are unable to disable the Lightning Locker service and it is the extra level security, unfortunately there is no other alternative to Lightning Locker service settings available either in backend.

    Unfortunately, I did not find any documentation on it from salesforce end. Please try to reach out to Cypress team as they will be the right team to help you out.


Solution

  • Just add the headers:

    describe("Sample Test Test", () => {
      it("Login to Salesforece App", () => {
        cy.visit(
          "https://yoursalesforceurl.sandbox.my.site.com/s/",
          {
            headers: {
              "Accept": "application/json, text/plain, */*",
              "User-Agent": "axios/0.18.0"
            },
            timeout: 60000,
          }
        );
      });
    });