5

works on www.github.com

cy.visit() failed trying to load ESOCKETTIMEDOUT

but not on other websites

1
  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Sep 1, 2021 at 17:31

4 Answers 4

2

For me was resolved by adding the following in the Cypress Config:

headers: { "Accept-Encoding": "gzip, deflate" }

That the entire test argument is:

it("", () => {
  cy.visit(url, { headers: { "Accept-Encoding": "gzip, deflate" } });
});

#Ref: https://github.com/cypress-io/cypress/issues/7062#issuecomment-991427658

1

from: https://github.com/cypress-io/cypress/issues/7062

  1. increase timeout

    cy.visit('https://github.com/', { timeout: 30000 })

1

In my case some time was needed until web application boots for the first time. And in that case I got ESOCKETTIMEDOUT. It is a bit different than request can be made and waiting for response. I had to add following timeout

cy.visit('http://my.site.to.test', { responseTimeout: 120000 });

2
  • Thank you very much this worked for me. Do you know why pageLoadTimeout doesnt work but responseTimeout does?
    – WasteD
    May 4 at 12:01
  • I don't know details, but from documentation pageLoadTimeout: Time, in milliseconds, to wait for page transition events or cy.visit(), cy.go(), cy.reload() commands to fire their page load events. Network requests are limited by the underlying operating system, and may still time out if this value is increased. I assume that response timeout just runs out faster then increased pageLoadTimout
    – Kazys
    May 9 at 7:25
0

In my case I was using several services through docker-compose and I needed to wait for my frontend to be up before starting my Cypress tests

Not the answer you're looking for? Browse other questions tagged or ask your own question.