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
[7.0.0] cy.intercept(): stubbed responses still send request to server #15841
Comments
Hmm, I do see it in v7.0.0 Reproduction: https://github.com/cypress-io/testing-workshop-cypress/tree/intercept-calls-server-15841
The test stubs the it.only('starts with zero items (fixture)', () => {
// stub route `GET /todos`, return data from fixture file
// THEN visit the page
cy.intercept('GET', '/todos', { fixture: 'empty-list.json' }).as('todos')
cy.visit('/')
cy.wait('@todos') // wait for `GET /todos` response
// inspect the server's response
.its('response.body')
.should('have.length', 0)
// then check the DOM
cy.get('li.todo').should('have.length', 0)
}) I see the stub working - but I also see the server showing |
@risa-hdqc did this only start happening with 7.0.0? |
FYI, the |
I tried testing-workshop example in v6.8.0 and with separate terminals to avoid the confusion. Did NOT show the request reaching the server When switching to Cypress v7.0.0 the server IS showing |
Hello, Just adding to the pot saying I have been experiencing the same issue. All my stubs have now been reaching the server. Commenting so I can stay updated for a fix. Thanks! |
I've bisected the issue down to this PR: #14543 I'll keep looking at it tomorrow. |
The code for this is done in cypress-io/cypress#15942, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior
After upgrading from 6.7.1 to 7.0.0, I noticed my tests are still working as expected, but my server logs show requests being made to my server for intercepted requests using fixtures, objects, or strings.
Each of these intercepts will return the stubbed response, but the requests are still being made afterward.
Example server log:
Desired behavior
The requests should NOT go to the server after returning the stubbed response.
Current workaround
req.reply
works as expected, blocking the requests to the server.Versions
7.0.0
The text was updated successfully, but these errors were encountered: