What this thread does
Do first: run npx playwright test path/to/failing.spec.ts --workers=1 --retries=0 --trace=on and inspect the first failed action before changing a wait.
Short answer
As of November 2026, this card pins Playwright 1.65.1 (release). Replace sleeps with the observable condition the next action needs. Separate assertion, action, navigation and whole-test budgets; a passing retry still records a flaky test.
Choose / don't choose
- Web-first assertion: choose
await expect(locator).toBeVisible()when the next action needs rendered state; don't use an immediateisVisible()result as a waiting assertion. Best practices. - Response waiter: choose
page.waitForResponse()when the contract concerns a particular HTTP operation; don't infer that its response means rendering finished. Match URL and method, then assert status separately so error responses do not disappear into a success-only predicate. API. - Independent context and data: choose the per-test page fixture; don't assume browser isolation isolates a shared database/account. Assign owned records and clean them in teardown. Browser contexts.
Not for: reviewing agent-added sleeps or skips; see agent-fixed-flaky-test-with-sleep-or-skip.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
timeout | Default 30_000 ms; use the documented 60_000 example only when the whole scenario needs that budget | Playwright 1.65.1 | timeouts |
expect.timeout | Default 5_000 ms; local { timeout: 10_000 } for a measured slower assertion | 1.65.1 | timeouts |
use.actionTimeout | Default no independent timeout; explicit 10_000 can bound clicks | 1.65.1 | timeouts |
use.navigationTimeout | Default no timeout; 30_000 ms is the documented navigation example | 1.65.1; navigation has its own scope | timeouts |
retries | 0 while diagnosing (default); retain failure-rate evidence before enabling retries | 1.65.1 | retries |
use.trace | 'retain-on-failure' records the failing first attempt even with zero retries; 'on-first-retry' needs a retry | 1.65.1 | recording options |
use.screenshot | 'only-on-failure' for failure images | 1.65.1 | recording options |
--fail-on-flaky-tests | Enable if CI must fail when any test is flagged as flaky; default false | 1.65.1 CLI | CLI |
The timeout values are documented examples, not a latency target. Increasing the outer budget cannot repair the wrong locator. A navigation failure and a failed UI assertion should retain their separate call logs.
Order of operations
1. Open npx playwright show-trace path/to/trace.zip; inspect action log, DOM snapshots and network around the first failure. Trace viewer. 2. Scope a user-facing locator to the correct region and assert toHaveCount(1). For a click, check visible, stable, event-receiving, enabled and non-inert state; inspect overlays instead of forcing the click. Locators and strictness, actionability. For repeated list items, use getByRole('listitem').filter({ hasText: 'orange' }) to select the intended row; replace the example text with your row’s text. 3. When the API result matters, create the waiter before the action, await the response, then await the resulting UI. Read response.status() from the awaited response when checking the HTTP outcome. The endpoint and labels below are illustrative:
const done = page.waitForResponse(r =>
r.url().endsWith('/api/orders') && r.request().method() === 'POST');
await page.getByRole('button', { name: 'Submit', exact: true }).click();
const response = await done;
4. For redirects, await page.waitForURL() with the expected destination. For hydration, disable controls until handlers attach; reproduce under Slow 3G to distinguish visible HTML from usable controls. Navigation readiness, hydration. 5. Compare the repaired file alone, with neighbours, and at normal concurrency using --retries=0; choose a repeat count in advance using --repeat-each <N>. Keep test inventory and assertions intact. CLI.
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
| Locator exception (symptom) | A single-target action resolves to multiple elements | Scope the role/name to the intended region and assert count; don't hide ambiguity with .first() | strictness |
Test timeout of 30000ms exceeded. | Test, setup or beforeEach consumes the whole-test budget | Use trace to find the blocked operation; fix readiness/fixtures before increasing the outer limit | timeout scopes |
TimeoutError | Actionability never becomes satisfied | Inspect overlay, disabled state and movement; await the real transition | actionability |
Vojtech Machacek's 30 October 2024 report #33367 concerns 1.44.0 clicks returning without a UI change. On 18 November the author reported removing the click delay as the local fix. This is historical evidence of a timing symptom, not a 1.64.0 regression diagnosis.
Missing
- The failing trace, accessible names and backend ownership model determine the concrete selector and readiness predicate; no universal timeout value establishes them.
Checked
2026-11-15: release, actionability, timeout, retry, recording and CLI settings rechecked; other sources checked 2026-11-12. No runtime commands were run.
Started from a post by @Microsoft Playwright, packaged by the editor. Original post