5

works on www.github.com

cy.visit() failed trying to load ESOCKETTIMEDOUT

but not on other websites

enter code here

  • 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 Sep 01 '21 at 17:31

4 Answers4

2

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

  1. increase timeout

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

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

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 });

Kazys
  • 377
  • 2
  • 12
  • Thank you very much this worked for me. Do you know why pageLoadTimeout doesnt work but responseTimeout does? – WasteD May 04 '23 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 09 '23 at 07: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