-
Notifications
You must be signed in to change notification settings - Fork 282
Description
🚀 Feature Request
A mechanism for defining custom assertions in Playwright .NET. The custom assertions would take advantage of the same retry logic (and any other good stuff) that the built-in assertions have.
This is possible in JS/TS, though I wouldn't expect .NET custom assertions to be registered in the same way.
Example
Expect(locator).ToContainNumberAsync(42)
Motivation
Currently, if you want to assert something that isn't covered by the built-in assertions, then you must resort to a method like ILocator.TextContentAsync()
and then make a (non-Playwright) assertion on the result. In doing so, you no longer have this benefit:
Playwright includes async matchers that wait until the expected condition is met. Using these matchers makes tests non-flaky and resilient
Indeed, custom assertions/matchers are already supported in Node.js.