Interview practice question
Tests break whenever CSS classes change
Frontend Engineering · Testing and Tooling · Beginner
Your tests select elements by CSS class names and break every time styling changes. How would you fix this?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Query by role, label, text.
- Accessible queries reflect user experience.
- data-testid as last resort.
- Tests survive refactors.
- Improves accessibility too.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.