Playwright gives you Web-First Assertions with convenience methods for creating assertions that will wait and retry until the expected condition is met.
Consider the following example:
public class ExampleTests : PageTest
public async Task StatusBecomesSubmitted()
Playwright will be re-testing the node with the selector
.status until fetched Node has the
"Submitted" text. It will be re-fetching the node and checking it over and over, until the condition is met or until the timeout is reached. You can pass this timeout as an option.
By default, the timeout for assertions is set to 5 seconds.
Expect(response)Added in: v1.18
Expect(locator)Added in: v1.18
Expect(page)Added in: v1.18