Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Playwright does not have one universal timeout. A failed test may have exceeded the 30,000 ms test limit, while the operation inside it was an assertion using its separate 5,000 ms retry limit—or it may be an action, navigation, fixture, hook, or whole-run timeout. Read the error and call log first, identify the scope, then change only that limit. Broadly increasing every timeout can hide a broken locator or an incorrect readiness assumption.

Find the timeout that actually failed

Start with the operation named in the error and call log. The remedy depends on whether Playwright stopped the test itself, stopped an assertion retry, or stopped a browser operation.

Scope Playwright Test default Where to change it What it covers
Test 30,000 ms timeout in config; test.setTimeout(); supported hook flows with testInfo.setTimeout() Test function, fixture setup and beforeEach. Teardown and afterEach receive a separate timeout of the same value.
Auto-retrying assertion 5,000 ms expect.timeout in config or an assertion’s timeout How long an assertion retries. It is independent of the test timeout.
Whole run No global default globalTimeout The complete test run, not one test.
Action No timeout in the test-runner low-level option default use.actionTimeout or an action’s timeout Interactions such as click, fill and check.
Navigation No timeout in the test-runner low-level option default use.navigationTimeout, an individual navigation option, or page/context navigation defaults Navigation methods. A navigation-specific default takes priority over a general page default.
Fixture No fixture-specific default The fixture definition’s timeout Slow setup isolated from the test’s normal limit.
beforeAll/afterAll 30,000 ms by default in the guide’s table test.setTimeout() inside the hook These hooks have their own timeout and do not share an individual test’s clock.

These are documented Playwright Test defaults; exact behavior can vary by the Playwright version installed in your project, so check that version’s documentation when upgrading.

Change the per-test timeout

Set a suite-wide default

Use the configuration file when most tests genuinely need more time:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { defineConfig } from '@playwright/test';

export default defineConfig({
  timeout: 60_000,
});

This changes the budget for every test, including its setup and beforeEach. Do not use it as a first response to one slow step.

Extend one test

import { test } from '@playwright/test';

test('slow test', async ({ page }) => {
  test.setTimeout(120_000);
  // test steps
});

For a test that is legitimately slow as a whole, test.slow() is another option: it triples the default test timeout. Use that convention only when tripling is appropriate and obvious to future maintainers.

Give a hook extra time

A hook can extend its own budget without changing every test. The official guide demonstrates this pattern in beforeEach:

test.beforeEach(async ({}, testInfo) => {
  testInfo.setTimeout(testInfo.timeout + 30_000);
  // slow setup
});

Change assertion timeouts

An assertion can keep retrying after the test’s general work appears healthy, or it can fail at five seconds while the test still has plenty of time left. Configure assertions separately:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Default for the suite

import { defineConfig } from '@playwright/test';

export default defineConfig({
  expect: { timeout: 10_000 },
});

One assertion

await expect(locator).toBeVisible({ timeout: 10_000 });

Raising timeout at the test level does not extend this assertion retry period. Keep the assertion value close to the actual eventual-consistency window and investigate a locator that never becomes visible instead of making every expectation wait indefinitely.

Set action and navigation limits

Project defaults

import { defineConfig } from '@playwright/test';

export default defineConfig({
  use: {
    actionTimeout: 10_000,
    navigationTimeout: 30_000,
  },
});

Override one operation

await page.goto('https://example.com', { timeout: 30_000 });
await page.getByRole('button', { name: 'Continue' }).click({ timeout: 10_000 });

A targeted option is safer when one endpoint or interaction is exceptional. The Page API also exposes page.setDefaultTimeout() for methods accepting a timeout option and page.setDefaultNavigationTimeout() for navigation. The navigation default takes priority over the page’s general default. Equivalent browser-context defaults are available; page-level settings take priority over context-level settings.

Understand navigation completion

The waitUntil value controls when a navigation method considers navigation complete. The documented choices are load (the default), domcontentloaded, commit, and networkidle. networkidle waits for a period with no network connections and is discouraged for testing. Prefer a navigation call followed by a web assertion that represents the state your user needs:

await page.goto('/checkout', { waitUntil: 'domcontentloaded' });
await expect(page.getByRole('heading', { name: 'Checkout' })).toBeVisible();

Most explicit waitForLoadState() calls are unnecessary because Playwright auto-waits before actions. Add one only when a specific load state is part of the behavior you are testing.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fixtures, hooks and the whole run

Give a slow fixture its own budget

If environment provisioning is slow but the test should remain strict, define a fixture timeout rather than raising the test timeout. A fixture-specific limit keeps the cause visible and prevents unrelated test steps from receiving extra time.

Control the complete run

Set globalTimeout when a CI job must stop after a fixed wall-clock budget. It is not a replacement for per-test or assertion limits: a run can hit the global ceiling while individual tests are still below theirs.

Remember teardown clocks

Fixture teardown and afterEach run after the test function and receive an additional timeout equal to the test timeout. beforeAll and afterAll have separate hook budgets. This explains why a report can show a hook timeout even when the test body completed quickly.

Timeout 0 and timeout precedence

For the documented Page and BrowserContext timeout APIs, timeout: 0 disables that timeout. Use it only for a deliberately unbounded wait: a missing event, hung server or broken locator can then leave a worker running forever. Prefer a finite, operation-level value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When several defaults exist, the narrowest explicit operation setting should be considered first, followed by page defaults, context defaults and project defaults. Navigation-specific defaults take precedence over general defaults for navigation methods. Assertion timeouts remain separate from all of them.

Fix the cause before raising the number

  1. Classify the failure. Is the message about the test, an assertion, an action, navigation, a fixture, a hook or the run?
  2. Read the call log. Confirm which locator, URL or condition was still pending.
  3. Check the condition. Verify the locator matches the rendered UI, the click is actionable, and the application really reaches the expected state.
  4. Choose the smallest change. Use a one-call override for one exceptional operation; use config only when the broader suite shares the same need.
  5. Reproduce with diagnostics. Run the failing test alone, retain trace/video output configured by your project, and inspect network or server logs for slow dependencies.
  6. Remove temporary inflation. Once the underlying wait is corrected, return to a limit that catches regressions.

Common errors and precise fixes

“Test timeout of 30000ms exceeded”

The test function, setup or beforeEach consumed its 30-second budget. Fix the slow or blocked step; if it is expected, use test.setTimeout() or a justified project value.

“expect(…).toBeVisible timed out”

The assertion’s retry budget expired. Check the locator and application state, then use an assertion-level timeout or the expect config—not just the test timeout.

“page.goto timed out”

Check DNS, server response, redirects, authentication and the chosen waitUntil. Set navigationTimeout or the call’s timeout only after confirming the page is expected to take longer.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“locator.click timed out”

Playwright may be waiting for the element to exist, be visible, enabled and unobstructed. Correct the locator, dismiss the real overlay in the test flow, or wait for the application’s state; an inflated action timeout will not make an absent button appear.

Intermittent timeout

Flakiness commonly indicates a faulty wait condition, race in setup, unstable test data or an overloaded dependency. Do not reflexively raise every timeout. Assert the user-visible readiness condition and isolate shared state first.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability and cost of longer waits

  • Parallelism: long per-test limits allow stalled workers to occupy slots longer, slowing the suite even when no test ultimately passes.
  • Failure detection: short, scope-specific limits expose regressions sooner; excessively broad values delay feedback and can mask deadlocks.
  • CI variability: use measured, documented allowances for slower runners rather than one unlimited setting for every environment.
  • Navigation readiness: choose the earliest completion event that matches the test, then assert the actual page state. Treat networkidle as a poor generic remedy.

Or skip the browser setup

If your goal is a clean screenshot of a page rather than an interactive Playwright assertion, ScreenshotNeo provides a one-request alternative. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.

Use the API documentation at https://screenshotneo.com/docs/ for all options, including full-page lazy-image loading, selectors, device presets, retina scale, PDF settings, custom CSS or JavaScript, clicks, waits, request blocking, headers, cookies, user agents, timezone, geolocation, transparent backgrounds, resizing, caching, signed links, asynchronous webhooks, bulk capture and usage data.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

The free plan includes 1,000 screenshots a month with no card. Paid plans start at $5 for 3,000 shots; every feature is on every plan, and yearly billing provides two months free. Create a free ScreenshotNeo account.

FAQ

Does increasing the test timeout increase assertion time?

No. Assertions have their own retry timeout and must be configured with expect.timeout or an assertion-level option.

Should I always set networkidle?

No. It is discouraged for testing; assert the specific application state your test requires instead.

Can I disable a Playwright timeout?

timeout: 0 disables the documented Page or BrowserContext timeout API limit. Do this only when an unbounded wait is intentional.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Does increasing the test timeout increase assertion time?

No. Assertions have a separate retry timeout configured with expect.timeout or an assertion-level option.

Should I always set networkidle?

No. Playwright discourages it for tests; assert the specific application state instead.

Can I disable a Playwright timeout?

timeout: 0 disables the documented Page or BrowserContext timeout API limit, but an unbounded wait can hang a run.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.