Query priority #24304
Unanswered
dimazuien
asked this question in
Questions and Help
Query priority
#24304
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The best practices page states that data attributes should be preferred over other types of selectors.
However, on the React Mounting Components page, I see the following paragraph:
and also the link to the "Priority of Queries - Testing Library".
The thing is that on that page, Testing Library doesn't recommend using data attributes if there are more accessible options. If I have to choose between querying a button by text or by data attribute, Cypress recommends using a data selector because the text may change, and Testing Library recommends using text because it reflects the experience of users. So I'd like to have more details on best practices and common approaches here.
Beta Was this translation helpful? Give feedback.
All reactions