Skip to content
masterclass Buddy

Playwright · Function

expect.extend

expect.extend adds custom assertions to Playwright. A matcher returns whether it passed and provides a failure message.

Last updated

Syntax

expect.extend({ matcherName(received, expected, options) { return { pass, message }; } })

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • expect
  • expect.configure
  • expect.poll
  • expect.toPass
  • testConfig.expect
  • toHaveAttribute

Source: Assertions | Playwright. Checked 2026-11-03.