Testing · Senior · Question 70 of 75
Which approach to test-ids is most maintainable when roles and names aren't enough?
- ✓Correct answer: Stable
data-testidattributes with meaningful names, and a configured attribute name if the team usesdata-test - 2Auto-generated CSS class names
- 3Indexes of elements in the DOM
Explanation
Playwright's testIdAttribute and Testing Library's configure({ testIdAttribute }) let you choose the attribute.