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

Add awaiting wrapped object section to Retry-ability guide #1542

amirrustam opened this issue Apr 2, 2019 · 1 comment


3 participants
Copy link

commented Apr 2, 2019

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(() => { = 42
    }, 100)

    // "expect" syntax does NOT work
    // because it is not retried!
    // expect(o)'foo', 42)

    // wrapping an object and using "should" syntax retries
    // the assertion until the " = 42" runs and the assertion passes
    cy.wrap(o).should('', 'foo', 42)

🔗 Source and more examples

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.

@amirrustam amirrustam self-assigned this Apr 2, 2019


This comment has been minimized.

Copy link

commented Apr 2, 2019

also this blog post that talks about Redux store might point it out explicitly "Testing Redux Store"

AND it needs link to the actual blog post !! And we need to call attention to automatic retrying of cy.window().its('STORE_NAME').should('exist')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.