Search code examples
securityhttpsconnectioncypress

Cypress issue with connection to the site is not secure?


I'm testing the website which have request to optimizely api to do some checking.

It request to url like https://cdn.optimizely.com/datafiles/XXX.json I suppose that this site required secure network.

I tried to open the url in cypress chrome and I get this error This page isn’t workingcdn.optimizely.com didn’t send any data. ERR_EMPTY_RESPONSE

enter image description here

But when I tried with the same network in chrome, I get fine response.

enter image description here

I need to be able to load the url to test my site.

Is there any solution to this matter. Please advice.


Solution

  • Since cypress will not load optimizely neither nor google-analytics or any . My work around solution is by using cy.intercept() function in before/beforeEach

    The code looks something like

    cy.intercept('https://cdn.optimizely.com/datafiles/XXX8.json', {
            "version": "4"
    }
    

    Reference: cypress-example-recipes