Cypress · Middle · Question 50 of 77

What does cy.contains('button', /^Save$/) add with a regex?

Show the answer

Correct answer: Exact matching of the text, not a substring

Explanation

A plain string matches substrings, so "Save draft" would also match "Save". A regex makes the match precise.

Further reading

Problem with a question

Cypress · Middle · question 50

Test yourself

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

Take this quiz