Skip to content
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

Intercept doesn't catch all requests. #16451

Closed
jennifer-shehane opened this issue May 11, 2021 · 2 comments · Fixed by #16457
Closed

Intercept doesn't catch all requests. #16451

jennifer-shehane opened this issue May 11, 2021 · 2 comments · Fixed by #16457

Comments

@jennifer-shehane
Copy link
Member

jennifer-shehane commented May 11, 2021

Current behavior

I've set up cy.intercept() for a request that goes out quickly 3 times. Each has a times to respond once. Sometimes when this test is run, it hangs on the last cy.wait() even though all 3 requests did occur.

Test code to reproduce

https://github.com/jennifer-shehane/cypress-intercept-times-flake

it(`test`, () => {
  cy.intercept('https://jsonplaceholder.typicode.com/todos/1', { times: 1 }, { title: 'baz' }).as('getTodo')
  cy.intercept('https://jsonplaceholder.typicode.com/todos/1', { times: 1 }, { title: 'bar' }).as('getTodo')
  cy.intercept('https://jsonplaceholder.typicode.com/todos/1', { times: 1 }, { title: 'foo' }).as('getTodo')
  cy.visit('/')
  cy.wait('@getTodo')
  cy.wait('@getTodo')
  cy.wait('@getTodo')

  cy.get('#api-response-list li')
    .first().should('have.text', 'foo')
    .next().should('have.text', 'bar')
    .next().should('have.text', 'baz')
})

Screen Shot 2021-05-11 at 2 20 15 PM

Versions

Cypress 7.3.0

@cypress-bot cypress-bot bot added stage: work in progress There is an open PR for this issue [WIP] and removed stage: to do labels May 11, 2021
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: work in progress There is an open PR for this issue [WIP] labels May 11, 2021
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 11, 2021

The code for this is done in cypress-io/cypress#16457, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot added stage: pending release There is a closed PR for this issue and removed stage: needs review The PR code is done & tested, needs review labels May 11, 2021
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 24, 2021

Released in 7.4.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v7.4.0, please open a new issue.

@cypress-bot cypress-bot bot removed the stage: pending release There is a closed PR for this issue label May 24, 2021
@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators May 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants