Cypress · Junior · Question 66 of 75

How do you assert that a text appears somewhere in an element?

Show the answer

Correct answer: .should('contain', 'Saved')

Explanation

contain checks a substring; have.text checks the exact text.

Further reading

Problem with a question

Cypress · Junior · question 66

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