## TL;DR

The test took longer than 30 seconds. Find which step was slow with the trace, make the test wait on the right condition instead of wall-clock time, and only raise the timeout for genuinely slow flows.

## Error

```text
Error: Test timeout of 30000ms exceeded.
```

## Steps

1. Open the trace (`npx playwright show-trace trace.zip`) and find the longest step. Expected: one step dominates the 30s.
2. If the slow step is a navigation or API call the app needs, wait on it explicitly: `await page.waitForResponse('**/api/items')`. Expected: the test tracks completion, not time.
3. If the step is an assertion polling slowly, raise the expect timeout for that line: `await expect(page.getByText('Saved')).toBeVisible({ timeout: 15000 })`. Expected: slow-but-correct assertions pass.
4. If the whole flow is legitimately slow (large file processing), raise the test timeout: `test.setTimeout(90000)`. Expected: the slow test gets room without affecting others.
5. Re-run with `--repeat-each=3`. Expected: three greens before calling it fixed.

## When to use

- The error is exactly `Test timeout of Xms exceeded`.
- The trace shows one slow step, not many medium ones.

## When not to use

- `expect` timeouts of 5000ms (raise the expect timeout, not the test timeout).
- Every test is slow (suite-level performance problem; see speedup skill).

## Tool compatibility

- Playwright 1.30 through latest; `test.setTimeout`, per-assertion `{ timeout }`.

## Variant phrasings

### Test timeout of 60000ms exceeded

Same pattern with a custom timeout; diagnose the slow step the same way.

### Playwright test timed out after 30s

Identical error in different words.

## Why it happens

Playwright kills tests that run too long to keep CI moving. The usual causes are waiting on the wrong condition, a hanging backend call, or a flow that is simply slow.

## Edge cases

- `test.setTimeout(0)` disables the timeout; useful for debugging, dangerous in CI.
- Timeouts inside `test.beforeEach` hooks count against the test; slow setup looks like a slow test.
- `page.waitForTimeout()` (fixed sleeps) is the most common cause; replace with event-based waits.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_hWRoxE8CXDEKyk-NjZXsRg
