Cypress · Senior · Question 62 of 76
What does a stable selector policy for a team look like?
- 1XPath with positions for precise targeting
- 2Classes generated by CSS-in-JS for everything
- 3
data-cyfor test hooks, roles for accessible elements
Show the answer
Correct answer: data-cy for test hooks, roles for accessible elements
Explanation
A written policy keeps selectors consistent and tells developers not to remove test attributes.