Cypress clears cookies before JavaScript is terminated
See original GitHub issueCurrent behavior
When Cypress starts executing a new test, it will clear all cookies even if the JavaScript code in the old test is still executing.
This can be the source of confusing errors reporting 401 responses from the backend where Cypress wrongly reports them as having been triggered by beforeEach
.
Desired behavior
Make sure that the JavaScript code from the previous test has stopped or block all network traffic between tests before clearing all cookies.
Versions
6.4.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
clearCookies - Cypress Documentation
Cypress automatically clears all cookies before each test to prevent state from being shared across tests when test isolation is enabled.
Read more >Cypress not re-using cookies or session in headless mode
What I have tried: I have managed to get a code snippets from here that stores the cookies after each test, which works...
Read more >Cypress cy.intercept Problems - Gleb Bahmutov
intercept happens in the Command Log was a user experience failure. The solution. Make sure the network intercept is registered before the ...
Read more >Cypress Tutorial - Tutorialspoint
Before proceeding with the tutorial, you should have a fair knowledge on JavaScript and object oriented programming concepts.
Read more >Testing Browser Alerts, Confirmations, and Prompts with ...
How can we use automation tools like Cypress to test them? ... testing frameworks take advantage of JavaScript's ability to query selectors.
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 Free
Top 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
Here’s a minimal example to reproduce the issue. It’s still present in 7.4.0
The first test case always passes. The second always errors because the first instance of the app (as witnessed by the
#first
location) crashes.Released in
12.0.0
.This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v12.0.0, please open a new issue.