Testing · Junior · Question 44 of 78

Which query does Testing Library recommend first?

Explanation

Priority: queries accessible to everyone (ByRole, ByLabelText, ByPlaceholderText, ByText, ByDisplayValue), then semantic (ByAltText, ByTitle), and only then ByTestId.

Further reading

Problem with a question

Testing · Junior · question 44

Test yourself

Take the Testing · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz