Playwright assertions retry until they pass or time out
Answer: Playwright assertions use the expect function. Generic matchers such as toEqual assert a value immediately. Playwright also ships web-specific async matchers that wait until the expected condition is met. The auto-retrying assertions retry until the assertion passes or the assertion timeout is reached. Those retrying assertions are async.
call shape
Auto-retrying assertions are async, so you must await expect(locator).toBeVisible().
See also
Claims
- id: C1 claim: Playwright assertions are made with the expect function. source: S1 evidence: "Playwright includes test assertions in the form of"
- id: C2 claim: Auto-retrying assertions retry until they pass or time out. source: S1 evidence: "The following assertions will retry until the assertion passes"
- id: C3 claim: Retrying assertions are async. source: S1 evidence: "retrying assertions are async, so you must"
- id: C4 claim: The source module exports the toBeVisible matcher. source: S2 evidence: "toBeVisible,"
Sources
- [S1] Assertions. Playwright docs. https://playwright.dev/docs/test-assertions . License: Apache-2.0. Accessed 2026-11-16.
- [S2] expect matchers (Playwright source). microsoft/playwright (GitHub). https://github.com/microsoft/playwright/blob/main/packages/playwright/src/matchers/expect.ts . License: Apache-2.0. Accessed 2026-11-16.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Playwright docs, Assertions, Apache-2.0 (https://raw.githubusercontent.com/microsoft/playwright/main/LICENSE). Copyright (c) Microsoft Corporation; microsoft/playwright (GitHub), expect matchers (Playwright source), Apache-2.0 (https://raw.githubusercontent.com/microsoft/playwright/main/LICENSE). Copyright (c) Microsoft Corporation. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Playwright docs, Assertions, Apache-2.0 (https://raw.githubusercontent.com/microsoft/playwright/main/LICENSE). Copyright (c) Microsoft Corporation; microsoft/playwright (GitHub), expect matchers (Playwright source), Apache-2.0 (https://raw.githubusercontent.com/microsoft/playwright/main/LICENSE). Copyright (c) Microsoft Corporation.
Cite this
iinventedlight. 2026. "Playwright assertions retry until they pass or time out." iinventedlight Library, iil:note:d8gxh2kv, version of 2026-11-16. https://iinventedlight.com/library/notes/playwright-async-assertions/. License: CC-BY-4.0.
@misc{iil_note_d8gxh2kv,
author = {{iinventedlight}},
title = {{Playwright assertions retry until they pass or time out}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-16},
url = {https://iinventedlight.com/library/notes/playwright-async-assertions/},
note = {Permanent ID iil:note:d8gxh2kv. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/playwright-async-assertions.md.