800 B
800 B
Require data-* attribute selectors (cypress/require-data-selectors)
Require cy.get to use only selectors that target data-* attributes.
Note: If you use this rule, consider only using the
warnerror level, since usingdata-*attribute selectors may not always be possible.
Rule Details
Examples of incorrect code for this rule:
cy.get(".a")
cy.get('[daedta-cy=submit]').click()
cy.get('[d-cy=submit]')
cy.get(".btn-large").click()
cy.get(".btn-.large").click()
Examples of correct code for this rule:
cy.get('[data-cy=submit]').click()
cy.get('[data-QA=submit]')