-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed as not planned
Labels
Description
The Retry-ability guide demonstrates assertions on DOM elements, but the concept of retrying assertions also applies to regular objects via cy.wrap. Example:
it('waits for changed property value', () => {
const o = { foo: 20 }
// changes property "foo" after delay
setTimeout(() => {
o.foo = 42
}, 100)
// "expect" syntax does NOT work
// because it is not retried!
// expect(o).to.have.property('foo', 42)
// wrapping an object and using "should" syntax retries
// the assertion until the "o.foo = 42" runs and the assertion passes
cy.wrap(o).should('have.property', 'foo', 42)
})This ability should also be stated in this guide. We already seen a large user create work-arounds because they did not know about using cy.wrap to wait on object changes.