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

Why can I use cy.waitFor()? #20556

Closed
Serhansolo opened this issue Mar 10, 2022 · 4 comments · Fixed by #21286
Closed

Why can I use cy.waitFor()? #20556

Serhansolo opened this issue Mar 10, 2022 · 4 comments · Fixed by #21286
Labels
type: typings Issue related to Cypress types (for TypeScript)

Comments

@Serhansolo
Copy link

Serhansolo commented Mar 10, 2022

Current behavior

I noticed that I can use cy.waitFor(string) to wait for a cypress alias. I can't find any documentation on the matter. While there is a good page for cy.wait(string) (https://docs.cypress.io/api/commands/wait). While this oddly seems to work whilst waiting for an API stub to resolve. I'm not sure if it is the expected behavior for wait().

My IDE tells me that cy.waitFor() is a valid function to use. I just don't think it is. It looks like it's wrongly exposed in the typing files.

image

Desired behavior

I would not expect the waitFor() function to show in my IDE as a possible method. Since it is not described in the documentation. OR it should be described in the documentation with the intended behavior.

Test code to reproduce

Just write cy.wait in any IDE enabled with code hinting and typescript for cypress.

Cypress Version

9.5.0

Other

Or this all has to do with my IDE setup, although I can't imagine it is since it happens with multiple (if not all) team members...

@davidmunechika davidmunechika added type: typings Issue related to Cypress types (for TypeScript) topic: intellisense labels Mar 10, 2022
@emilyrohrbough
Copy link
Member

cy.waitFor is not an out-of-the box Cypress command and I just validated we do not provide types for this function. Does your project by chance leverage a plugin that might be adding this command & its corresponding types?

@mike-mccormick
Copy link

@emilyrohrbough I can maybe help clarify this one; I'm seeing too but following the definition shows it's coming from eventemitter2:

image

other methods in it's d.ts also show with intellesense:

image

Spitballing, but any chance it's coming through EventEmitter?

image

@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 11, 2022

The code for this is done in cypress-io/cypress#21286, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label May 11, 2022
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 23, 2022

Released in 9.7.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v9.7.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators May 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: typings Issue related to Cypress types (for TypeScript)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants