question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Page occasionally does not load from cy.visit()

See original GitHub issue

Current 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:closed
  • Created 5 years ago
  • Reactions:42
  • Comments:85 (24 by maintainers)

github_iconTop GitHub Comments

10reactions
davidnormocommented, Apr 25, 2019

We also have this issue. Is there any update yet?

7reactions
Postavshikcommented, May 24, 2019

I having issue with cy.visit() as well but only with Electron browser… 100% of the time What are the steps of my application

  1. Open users page with cy.visit()
  2. Click on user and navigate to user profile
  3. Call cy.visit() to open users page again.

At the step 3 users page is never opened. 2019-05-21_1346 A small spinner in the URL field is always loading and error of Cypress Timeout 😦 image

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress - cy.visit() failed trying to load - Stack Overflow
We had it in the cypress folder. Once moved to the root folder, cypress was able to find the file and therefore also...
Read more >
8 common mistakes in Cypress (and how to avoid them)
In this blogpost I'm sharing a couple of testing antipatterns that can make your test flaky, hard to read or slow.
Read more >
cypress-io/cypress - Gitter
I am trying to spin up my first ever test with Cypress and I am kinda bummed at not being able to get...
Read more >
Best Practices - Cypress Documentation
Anti-Pattern: Sharing page objects, using your UI to log in, and not taking ... Most of the time, these situations can be safely...
Read more >
Visit The Blank Page Between Cypress Tests - Gleb Bahmutov
This could be confusing if the next test does not immediately start ... Unfortunately, using the cy.visit('about:blank') would not work.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found