Playwright: Test timeout of 30000ms exceeded
Last verified
Test timeout of 30000ms exceeded.What it means
Playwright Test gives every test, including its beforeEach and afterEach hooks and fixtures, 30 seconds by default. When that budget runs out, the runner aborts the test and reports this message. Because actions in Playwright Test have no separate timeout by default, a single click waiting on an element that never becomes actionable will often consume the whole test budget, and the error you see is this one rather than an action timeout.
The runner usually prints a second error below it, for example the action that was still pending or Target page, context or browser has been closed because the page was torn down mid-action. That second error and its call log tell you where the time went.
What is not wrong: the 30-second value is a default, not a limit imposed by the browser. Long end-to-end flows legitimately need more.
What it looks like
// playwright.config.ts
export default defineConfig({
timeout: 60_000,
expect: { timeout: 10_000 },
use: { actionTimeout: 15_000, navigationTimeout: 30_000 },
});
// In a single long test
test('exports a large report', async ({ page }) => {
test.slow();
// ...
});Why it happens
- An action is waiting forever on a locator that never matches or never becomes actionable.
- A legitimately long flow (multi-page checkout, file processing) needs more than 30 seconds.
- A slow beforeEach hook or fixture (login, database seeding) eats most of the budget.
- Slow CI hardware or many parallel workers stretch every step.
- A page.waitForTimeout() or polling loop adds fixed delays.
How to fix it
- Read the error printed after the timeout and its call log to find the stuck step.
- Set actionTimeout and navigationTimeout in config so stuck actions fail fast with a specific message.
- Raise the budget only for slow tests with test.slow() (triples it) or test.setTimeout(ms).
- Move login into a setup project with storageState so each test does not repeat it.
- Replace fixed waits with web-first assertions.
How to stop it recurring
Give actions their own timeout so the test timeout is a safety net, not the first signal. Keep authentication and seeding out of individual tests with setup projects and storageState. Watch per-test duration in reports; a test that creeps toward the limit is a flaky test waiting to happen.
Official documentation: playwright.dev/docs/test-timeouts. See all Playwright error messages.
Related errors
- locator.click: Timeout 30000ms exceededTimeoutError: locator.click: Timeout 30000ms exceeded. Call log: - waiting…
- Target page, context or browser has been closedError: page.goto: Target page, context or browser has been closed
- expect(locator).toBeVisible() failedError: expect(locator).toBeVisible() failed Locator: getByText('Welcome…
Definitions
- PlaywrightPlaywright is Microsoft's open-source browser automation framework that provides a single API to control Chrom
- Chrome DevTools Protocol (CDP)The Chrome DevTools Protocol (CDP) is the JSON-over-WebSocket interface Chrome exposes for inspecting and cont
- CSS SelectorA CSS selector is a pattern used to identify and target specific HTML elements on a web page, widely used in b
- Headless ChromeHeadless Chrome is Google Chrome running without a visible window. It renders pages and runs JavaScript like n
- IframeAn iframe (inline frame) is an HTML element that embeds a separate web page within a parent page, creating an
- Web ElementA web element is any individual component rendered on a web page — buttons, links, input fields, images, text
Quick answers
What does "Test timeout of 30000ms exceeded" mean in Playwright?
Playwright Test gives every test, including its beforeEach and afterEach hooks and fixtures, 30 seconds by default. When that budget runs out, the runner aborts the test and reports this message.
How do I fix "Test timeout of 30000ms exceeded"?
1. Read the error printed after the timeout and its call log to find the stuck step. 2. Set actionTimeout and navigationTimeout in config so stuck actions fail fast with a specific message. 3. Raise the budget only for slow tests with test.slow() (triples it) or test.setTimeout(ms). 4. Move login into a setup project with storageState so each test does not repeat it. 5. Replace fixed waits with web-first assertions.
Run browser automation you can watch and take over
Autonoly runs each job in a real cloud Chromium browser driven by Playwright. Timeouts and detached elements still happen; the difference is that you can watch the run live, see the step that failed, and take control of the browser to finish it.
Also see Live browser control.