Playwright · Senior · Question 30 of 77

How do you add a custom matcher like toHaveCartTotal?

Show the answer

Correct answer: Use expect.extend and export the extended expect

Explanation

Custom matchers can be async and use locators, giving readable domain checks with good failure messages.

Further reading

Problem with a question

Playwright · Senior · question 30

Test yourself

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

Take this quiz