Cancelled network requests fail to resolve with cy.wait
See original GitHub issueCurrent behavior
If a network request is aliased and the network request is cancelled by the browser, cy.wait
will timeout waiting for the network request.
Desired behavior
cy.wait
should complete with a failed network request and should convey that the request was cancelled.
Test code to reproduce
// Intercept an outbound request with `cy.intercept` and set it to an alias
cy.intercept("route-to-request", req => {
req.id = "cancelled-request-id"
req.reply()
}
// Redirect to a new page before the request resolves
cy.visit('http://localhost:3000/path-to-new-url')
// Wait for the cancelled request to resolve
cy.wait("@cancelled-request-id")
Cypress Version
9.1.1
Other
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Network Requests - Cypress Documentation
Stubbing a response's headers; Delaying a response; Waiting for a response to happen. Within Cypress, you have the ability to choose whether to...
Read more >javascript - Cypress intercepted api request canceled (with ...
With new release of cypress 7.0.0, the API gives back a response and is no longer hitting the Err_empth_Response But still the cy.wait()...
Read more >Cypress cy.intercept Problems - Gleb Bahmutov
This is the browser trying to be robust and retrying a failed network request. The browser sees a network error coming back from...
Read more >Listen for Cancellation Requests That Have Wait Handles
In this article If a method is blocked while it is waiting for an event to be signaled, it cannot check the value...
Read more >A Practical Guide to Intercepting Network Requests in Cypress
wait () command to resolve, and only then start to look for our board item elements. Now that our .wait() is in place,...
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
@mjhenkes this is fixed by #24709, right?
Poking around in the debugger, once cancelled intercepted requests get a response, they are marked with the state
ResponseReceived
but will never reach theComplete
state.