Playwright · Junior · Question 36 of 75

How do you check that a list shows exactly 3 items?

Show the answer

Correct answer: await expect(items).toHaveCount(3)

Explanation

toHaveCount retries until the number of matches is right, which handles lists that render gradually.

Further reading

Problem with a question

Playwright · Junior · question 36

Test yourself

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

Take this quiz