Closed
Description
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')
})
Versions
Cypress 7.3.0