Page occasionally does not load from cy.visit()
See original GitHub issueCurrent behavior:
99+% of the time this is not an issue, but once in a while the cy.visit()
at the beginning of a test will not load the page, no matter how long of a timeout I set, no XHR requests are sent, nothing is loaded in the page. This is only ever seen in cypress tests and has never been seen manually by our testers so I am sure it is a bug with Cypress.
CypressError: Timed out after waiting ‘60000ms’ for your remote page to load.
Your page did not fire its ‘load’ event within ‘60000ms’.
You can try increasing the ‘pageLoadTimeout’ value in ‘cypress.json’ to wait longer.
Browsers will not fire the ‘load’ event until all stylesheets and scripts are done downloading.
When this ‘load’ event occurs, Cypress will continue running commands.
Desired behavior:
Always load the page.
Steps to reproduce: (app code and test code)
I realize I am not providing a reproducible example, but it is not triggered by any specific test and is not reliably reproducible. I have seen in other tickets that members of the cypress team have asked for additional logging to be turned on. I would like to turn on additional logging that may help diagnose this and provide you the logs next time this happens.
Versions
Cypress 3.1.3
Issue Analytics
- State:
- Created 5 years ago
- Reactions:42
- Comments:85 (24 by maintainers)
We also have this issue. Is there any update yet?
I having issue with cy.visit() as well but only with Electron browser… 100% of the time What are the steps of my application
At the step 3 users page is never opened.
A small spinner in the URL field is always loading and error of Cypress Timeout 😦

UPDATE: The issue was because of the error with ‘beforeUnload’ event. This error was in the console. Chrome ignores is, but Electron not. Found a workaround with this code added to support/index.ts
Cypress.on('window:load', function(window) { const original = window.addEventListener; window.addEventListener = function() { if (arguments && arguments[0] === 'beforeunload') { return; } return original.apply(this, arguments); }; });