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

cypress/unsafe-to-chain-command errors being throw for wait with alias (v2.13.1) #127

Closed
tgdevereux opened this issue Mar 28, 2023 · 6 comments

Comments

@tgdevereux
Copy link

tgdevereux commented Mar 28, 2023

With the latest version of eslint-plugin-cypress, version 2.13.1, cypress/unsafe-to-chain-command lint errors appear to be getting thrown for wait commands that chain commands from it, when wait is given an alias argument.

Based on the Cypress docs here, it is unsafe to chain further commands that rely on the subject after .wait(), when given a time argument. However, it doesn't say it is unsafe when given an alias argument, as that would be used to wait and return a response from a request, for use in the test.

Based on the above, should the cypress/unsafe-to-chain-command not be getting applied to wait commands with alias arguments?

@patrickcate
Copy link

Running into this same issue with the cy.wait command and the new rule.

https://docs.cypress.io/api/commands/wait even includes examples such as:

// Example: assert status from cy.intercept() before proceeding
cy.wait('@alias').its('response.statusCode').should('eq', 200)

and

cy.wait('@userPut').its('request.url').should('include', 'users')

@Erik-Outreach
Copy link
Contributor

Here's a PR to solve the issue: #128

@nagash77
Copy link
Contributor

I just merged that PR and the build should publish the latest shortly. I am going to close this issue for the time being. Please comment back if the latest version doesn't resolve your issue.

@patrickcate
Copy link

The PR and new release does fix the issue. Rather than not applying the rule to any cy.wait commands, however, it would be great if it was still applied to non-alias cy.wait commands.

@nagash77
Copy link
Contributor

Hi @patrickcate , Can you open a new feature request for that please?

@patrickcate
Copy link

@nagash77, done with: #131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants