-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unresolved API calls cause Electron to fail all subsequent tests #1055
Comments
This is unfortunately a known issue and its documented in depth here: There is not really an elegant solution around this - we in fact used to abort current running XHR's specifically for this purpose, but it actually caused other issues. Because Cypress runs async things between tests, it was also possible in that brief moment for your app to make another XHR, which would then demonstrate the same problems as you're describing. The only real solution for this is doing what is described in that issue. Today, if you wanted to "work around this" you would have to visit a "blank page" in an |
Thank you for the quick reply! I figured that you guys might have ran into this before, so it's good to know that it's been explored. The discussion in the other thread makes sense; in the meantime, I will do the ugly workaround since this is mission-critical for us. |
Some other ideas - if your application has a "killswitch" you could directly call that from Cypress itself as long as your app exposed this globally... afterEach(() => {
cy.window().its('App').invoke('kill')
}) You could also likely force the app to visit afterEach(() => {
cy.window().then((win) => {
win.location.href = 'about:blank'
})
}) One final suggestion - conditionally run the |
Awesome tips, thank you very much! Sadly, no kill switch...looks like I'll have to try the 'about:blank' idea. Luckily, this issue is only happening with 2 tests, so it should not be too invasive. I'll definitely put it into an env variable, would be nice to turn off as needed. |
Video of test run: https://files.gitter.im/cypress-io/cypress/uJe7/0zezc.mp4 The thing that troubled me the most was the command log disappearing halfway through the video recording. |
Hi , I am facing this issue in electron only in headed mode. Workaround seems to flaky as some time blank page as browser waits for about:blank page to load. |
Is this a Feature or Bug?
Bug
Current behavior:
Unresolved API calls cause Electron to timeout each subsequent test in the suite. This happens when using the Electron GUI or the CLI. Chrome handles this error gracefully and allows the tests to pass.
In addition, the failure causes the log on the left-hand side of the GUI to disappear, and you have to completely kill Cypress in order for new tests to run.
Desired behavior:
All unresolved API calls should be cancelled before a new test runs. Ideally, the behavior could mimic what Chrome 63 does.
How to reproduce:
Write a test where the API will not resolve then put that test in the middle of a suite. You will see that all tests prior will pass, but any test after will fail.
Additional Info (images, stack traces, etc)
Electron, showing the calls that will timeout:
Chrome, showing the aborted calls:
Failure showing the log missing:
The text was updated successfully, but these errors were encountered: