Open
Description
Current behavior
Notice in v12 (using 12.1.0 right now) that if there are assertions in the chain of queries, the query commands before an assertion are NOT retried, even if the assertion should pass.
Desired behavior
Cypress should go all the way to the start of the chain of queries and retry it, even if there are assertions in the mix.
Test code to reproduce
const double = (n) => n * 2
// @ts-ignore
Cypress.Commands.addQuery('apply', (fn) => (n) => fn(n))
it('fails to retry the cy.its', () => {
const list = []
cy.wrap(list)
.its(0) // first item
// this assertion breaks the query chain retries
// it never "sees" the new number 5
// because it never retries cy.its above
.should('be.a', 'number')
.apply(double)
.should('equal', 10)
setTimeout(() => {
list[0] = 1
}, 1000)
setTimeout(() => {
list[0] = 5
}, 2000)
})
it('retries queries with assertions', () => {
const list = []
cy.wrap(list)
// several queries (without assertion)
.its(0) // first item
.apply(double)
.should('equal', 10)
setTimeout(() => {
list[0] = 1
}, 1000)
setTimeout(() => {
list[0] = 5
}, 2000)
})
https://github.com/bahmutov/cypress-map/blob/main/cypress/e2e/chain-with-assertions.cy.js
Cypress Version
v12
Node version
16
Operating System
mac
Debug Logs
No response
Other
No response
Activity