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

cy.its() no longer waits on undefined #3837

Closed
tnightingale opened this issue Mar 27, 2019 · 3 comments · Fixed by #3870
Closed

cy.its() no longer waits on undefined #3837

tnightingale opened this issue Mar 27, 2019 · 3 comments · Fixed by #3870
Assignees
Labels
type: bug type: regression A bug that didn't appear until a specific Cy version release

Comments

@tnightingale
Copy link

Current behavior:

cy.its() yields undefined.

cy.window().its('__store__').then((store) => {
    ...
    /* `store` is undefined as value is yielded before my application gets a chance to set `window.__store__ = myStore;` */
});

Desired behavior:

Docs state:

.its() will automatically retry itself until the property exists on the subject.

https://docs.cypress.io/api/commands/its.html#Assertions

Steps to reproduce: (app code and test code)

Interestingly, asserting that the yielded property exists resolves this issue:

cy.window().its('__store__').should('exist').then((store) => {
    ...
    /* `store` is *not* `undefined` 👌 */
});

I suspect all that is required is that the documentation needs to be updated to indicate that by default it will yield undefined unless there's a subsequent command that triggers the retry behaviour/state.

Versions

Cypress 3.2.0
macOS: 10.14.3
Chrome 73

@kuceb
Copy link
Contributor

kuceb commented Mar 27, 2019

Hi @tnightingale thanks for letting us know about this. The PR #3226 was incorrectly targeted at the wrong branch.

We'll revert this in the next release, and will keep the behavior you expect.

The goal of the PR was to allow this to work:

cy.window().its('someProp').should('not.exist')

But we'll keep the default behavior of retrying when undefined

@kuceb kuceb added type: bug type: regression A bug that didn't appear until a specific Cy version release and removed type: bug labels Mar 27, 2019
@cypress-bot cypress-bot bot added the stage: investigating Someone from Cypress is looking into this label Mar 27, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 15, 2019

The code for this is done in cypress-io/cypress#3870, 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 and removed stage: investigating Someone from Cypress is looking into this labels Apr 15, 2019
@brian-mann brian-mann self-assigned this Apr 15, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 17, 2019

Released in 3.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug type: regression A bug that didn't appear until a specific Cy version release
Projects
None yet
3 participants