Cypress did not catch all XHR requests: No request ever occurred
See original GitHub issueCurrent behavior:
if we are calling some XHR request on the end of the test then it will pass, but if we want to catch XHR request on page load it’s not working…
example:
describe('Help Page', () => {
it('visit /help', () => {
const USER = Cypress.env('username');
const PASS = Cypress.env('userpass');
cy.visit('/');
cy.server();
cy.route('POST', '**login').as('auth');
cy.get('input[name=username]').type(USER);
cy.get('input[name=password]').type(PASS);
cy.get('button[type=submit]').click();
cy.wait('@auth');
Versions
latest cypress version 3.0.2
Issue Analytics
- State:
- Created 5 years ago
- Comments:37 (12 by maintainers)
Top Results From Across the Web
Cypress intercept - No request ever occurred - Stack Overflow
I have tried the following with no luck. Someone please help me to find out where and what am I missing here as...
Read more >Cypress cy.intercept Problems - Gleb Bahmutov
Cypress shows XHR calls by default in its Command Log, thus it has nothing to do with our intercept. I always thought NOT...
Read more >Network Requests - Cypress Documentation
Since no responses are stubbed, that means your server has to actually send real responses. This can be problematic because you may have...
Read more >cypress-io/cypress - Gitter
Yeah you should not have had to. ... Hi all, I have a search modal which is populated via Ajax. ... But Cypress...
Read more >XHR requests are cancelled in Cypress - SQA Stack Exchange
It seems you want to wait until routes resolve. If that is the case, you need to explicitly tell Cypress to do just...
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
Closing, some have mentioned resolving their issues after providing a reproducible example while others have not provided a reproducible example.
Please open a new issue with a fully reproducible example if you are experiencing a related issue that appears to be a bug in Cypress. We can’t do anything without understanding the complete picture and seeing the problem ourselves.
I ended up adding a
cy.wait(500)
since theXHR
is too fast for thecy.wait('@postAPI')
to catch. 😦