Course contentsShow
React
Lesson 2117 of 2,39647. Testing Patterns and Best PracticesPro lesson

Query by Role, Not Test IDs

Prefer getByRole and getByLabelText over data-testid to test how users actually interact with your components.

This lesson is for subscribers

You've completed the free preview. Subscribe to unlock every lesson in every course.