-
Notifications
You must be signed in to change notification settings - Fork 93
feat: add no-chained-get rule #249
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
Conversation
|
docs/rules/no-chained-get.md
Outdated
``` | ||
|
||
## Further Reading | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly this should link to [cy.get()](https://on.cypress.io/api/get)
(cy.get())
In the section https://docs.cypress.io/api/commands/get#Get-vs-Find it shows an example valid use of cy.get('#comparison').get('div')
cy.get('#comparison')
.get('div')
// finds the div.test-title outside the #comparison
// and the div.feature inside
.should('have.class', 'test-title')
.and('have.class', 'feature')
cy.get('#comparison')
.find('div')
// the search is limited to the tree at #comparison element
// so it finds div.feature only
.should('have.length', 1)
.and('have.class', 'feature')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest that you either remove the heading ## Further Reading
if there is no content for this section, or you link to the documentation page
Co-authored-by: Mike McCready <[email protected]>
Co-authored-by: Mike McCready <[email protected]>
@duranbe Do you have time to address feedback here? |
This comment was marked as resolved.
This comment was marked as resolved.
Hey - sorry missed this ! Thanks for the feedbacks, addressing them |
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for resolving the comments!
🎉 This PR is included in version 4.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR creates a new rule to disallow the usage of
cy.get().get()
as.get()
is often misused as it is starting search from the document and the previously selected element.