Cypress · Junior · Question 20 of 75

How do you check a list has exactly 3 items?

Show the answer

Correct answer: cy.get('li').should('have.length', 3)

Explanation

have.length retries until the count matches, so it works for lists that render gradually.

Further reading

Problem with a question

Cypress · Junior · question 20

Test yourself

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

Take this quiz