-
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
Cypress is intercepting API calls inconsistently. Ideally a call should be intercepted 22 times but it is getting intercepted by cypress 42 times. #15317
Comments
@Ppkd2021 We've recreated the situation from the repo you previously provided and confirmed the behavior you are saying is happening. So this appears to be a bug or unexpected behavior that one of our engineers will have to evaluate when we have time. Thanks for taking the time to report. |
Looking further at this, it appears that the graphql calls are doubled regardless of the |
ReproductionThe same problem in v6.5.0 v6.6.0 and branch https://github.com/cypress-io/cypress-example-recipes/tree/triple-intercept folder examples/server-communication__wait-for-api
The following test there shows double or sometimes triple intercept execution for a single it('fails because the API is not ready', () => {
cy.visit('/')
cy.intercept({
pathname: '/greeting',
},
{
forceNetworkError: true,
}).as('greeting')
cy.get('#get-api-response').click()
})
it('fails because the API is not ready (with log)', () => {
cy.visit('/')
cy.intercept({
pathname: '/greeting',
},
(req) => {
console.log('in the greeting intercept')
console.log(JSON.stringify(req))
req.reply({ forceNetworkError: true })
})
cy.get('#get-api-response').click()
}) Images |
@bahmutov I don't think this is related - those requests are probably actually being sent. I'm not sure if the Network tab will show it, but Chrome will re-send a request that fails due to network error a few times, so that is probably why you are seeing this behavior. Check out the |
@jennifer-shehane Thank you for having a look at it. Please let us know if you need anything else which helps fixing this issue. |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
This issue has been closed due to inactivity. |
Current behavior
There is an API which is getting called in frontend multiple time(22 times) when we are trying to intercept each call for that respective api by cypress then it is intercepting inconsistently, sometimes 42 or 44 times.
Desired behavior
It should intercept that API call 22 times.
Test code to reproduce
Versions
The text was updated successfully, but these errors were encountered: