cy.visit() failed trying to load ESOCKETTIMEDOUT
See original GitHub issueCurrent behavior:
CypressError: cy.visit() failed trying to load:
We attempted to make an http request to this URL but the request failed without a response.
We received this error at the network level:
> Error: ESOCKETTIMEDOUT
Common situations why this would fail:
- you don't have internet access
- you forgot to run / boot your web server
- your web server isn't accessible
- you have weird network configuration settings on your computer
The stack trace for this error is:
Error: ESOCKETTIMEDOUT
at ClientRequest.<anonymous> (/root/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/request/request.js:816:19)
at Object.onceWrapper (events.js:299:28)
at ClientRequest.emit (events.js:210:5)
at TLSSocket.emitRequestTimeout (_http_client.js:690:9)
at Object.onceWrapper (events.js:299:28)
at TLSSocket.emit (events.js:210:5)
at TLSSocket.Socket._onTimeout (net.js:468:8)
at listOnTimeout (internal/timers.js:531:17)
at processTimers (internal/timers.js:475:7)
Because this error occurred during a 'before each' hook we are skipping the remaining tests in the current suite: 'Suite Tests'
image: 'cypress/base'
stages:
- e2e
end-to-end testing:
stage: e2e
script:
- npm install
- npm test
Desired behavior:
Does not start testing on gitlab, but on local machine it does works
Test code to reproduce
Starts the tests in gitlab
Versions
Cypress: 4.2.0 Image: cypress/base
Issue Analytics
- State:
- Created 3 years ago
- Reactions:22
- Comments:81 (7 by maintainers)
Top Results From Across the Web
Cypress, cy.visit() failed trying to load ESOCKETTIMEDOUT
cy.visit('https://github.com/', { timeout: 30000 }). Share. Share a link to this answer ... And in that case I got ESOCKETTIMEDOUT.
Read more >cypress-io/cypress - Gitter
Can some one pls help. I am trying to open link from cypress. cy.visit("https://www.kohls.com/"). but m getting error :- cy.visit() failed trying to...
Read more >Cypress tests fail randomly
visit() failed trying to load: cy.visit () failed because you are attempting to visit a different origin domain Two URLs have the same...
Read more >visit - Cypress Documentation
We recommend setting a baseUrl when using cy.visit() . ... you will need to specify a fully qualified URL or Cypress will attempt...
Read more >mgr/dashboard: fix ESOCKETTIMEDOUT E2E failure
The dashboard e2e failures are happening for different test suites becasue of a common failure: cy.vist()/cy.request() failed to load ESOCKETTIMEDOUT.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Adding this to the cy.visit() function solved it for me:
cy.visit(url, { headers: { "Accept-Encoding": "gzip, deflate" } });
… as referenced here: https://github.com/cypress-io/cypress/issues/943#issuecomment-730705557
We were able to solve this issue for our tests with our specific tech stack. We were using Next.js and our Cypress tests ran with the GitHub action.
We changed from:
to
Which caused our tests to run a lot faster and the GitHub action actually waits for the response of the server. We needed BOTH changes because the tests were running on the landing page (which loads fast even in dev mode) before the server was ready, which was fixed by the
wait-on
. And running the build helped to stay within the timeout window on the slower pages.