Intercept does not work between tests (`it`)
See original GitHub issueCurrent behavior
We intercept every request call that goes out of cypress to add an AUTH header to every request. When the header is not attached we get network requests that fail. Before when using Cypress 6.8, all requests were intercepted even between tests (it
). Now that is not the case anymore. This causes our tests to flake very frequently.
Desired behavior
Intercept all requests!
Test code to reproduce
You can reproduce the errors pretty consistently with the repo: https://github.com/giacaglia/cypress-test-tiny
You need to run both the frontend and the backend to test it out.
Cypress Version
8.3.1
Other
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:8
Top Results From Across the Web
Cypress cy.intercept Problems - Gleb Bahmutov
We have completely separated the suite of tests that should all start with zero items from the suite of tests that should start...
Read more >in cypress, intercept in test doesn't work - Stack Overflow
Since it works when the intercept is moved up in the command order, it seems that cy.waitLoading() triggers the POST and not ......
Read more >A Practical Guide to Intercepting Network Requests in Cypress
In our following test we are facing a weird situation. Let's first look at the code and then at the video from test...
Read more >intercept - Cypress Documentation
All intercepts are automatically cleared before every test. Syntax. // spying only cy.intercept(url) cy ...
Read more >Network Requests with Cypress by Cecelia Martinez - GitNation
So this image is from a presentation called how cy.intercept works, my glove bomb top. And essentially, you can see in the image...
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
I can confirm that I’m still seeing this behavior in cypress v10.6.
My use case is defining intercepts in a beforeEach hook. It appears that a test can complete, yet the page can still trigger a network request while the next test’s beforeEach hook is running (which is prior to those network request intercepts being defined).
In other words:
Would love any updates on this issue!