DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk5 min

How to Configure Timeouts in Playwright

Playwright Test uses separate timeout controls for tests, assertions, browser operations, fixtures, and the full run. Set the right scope instead of raising every limit.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Configure the timeout for the thing that is actually waiting: Playwright Test gives each test 30 seconds by default, retrying assertions 5 seconds, and browser actions and navigation operations no timeout by default. These limits are separate. Use timeout for a test, expect.timeout for retrying assertions, use.actionTimeout or use.navigationTimeout for browser operations, and globalTimeout to cap the complete run. The examples below use Playwright Test and the current official documentation accessed October 3, 2026.

Set the timeout that matches the work

Playwright Test has several independent timeout scopes. Raising the test timeout will not, by itself, give an assertion a longer retry window or impose a limit on the whole run. Conversely, a longer assertion timeout does not extend the test’s total budget.

As an Amazon Associate I earn from qualifying purchases.

What is limited Suite or run setting Narrow override Default
Test, including its setup timeout test.setTimeout(ms) or test.slow() 30,000 ms (30 seconds)
Retrying assertion expect.timeout Matcher option, such as toBeVisible({ timeout: ms }) 5,000 ms (5 seconds)
Browser action use.actionTimeout Operation option, such as locator.click({ timeout: ms }) No timeout
Navigation operation use.navigationTimeout Operation option, such as page.goto(url, { timeout: ms }) No timeout
Complete test run globalTimeout Set the run-level configuration Disabled; no global limit
Individual fixture Fixture definition’s timeout Set the fixture’s own timeout Shares the test timeout by default

Defaults and scope are from the Playwright Timeouts guide, TestConfig API, Assertions guide, and Page API.

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

Configure suite defaults

Put shared test, assertion, action, navigation, and run limits in playwright.config.ts. This example sets illustrative budgets; they are not universal recommended values.

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

export default defineConfig({
  // Each test gets two minutes.
  timeout: 120_000,

  // Auto-retrying assertions get ten seconds.
  expect: {
    timeout: 10_000,
  },

  // Per-action and per-navigation defaults.
  use: {
    actionTimeout: 10_000,
    navigationTimeout: 30_000,
  },

  // Optional cap for the complete test run.
  globalTimeout: 3_600_000,
});

The timeout setting applies to each test and includes the test function, fixture setup, and beforeEach. Teardown and afterEach receive a separate budget of the same value. The beforeAll and afterAll hooks have a separate timeout that defaults to the test timeout. See the official timeout guide for the scope details.

Change one test or hook

Give one test a larger budget

Call test.setTimeout() inside the test when its expected work genuinely needs more time:

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

test('exports a large report', async ({ page }) => {
  test.setTimeout(120_000);
  await page.goto('/reports');
  await page.getByRole('button', { name: 'Export' }).click();
  await expect(page.getByText('Export complete')).toBeVisible();
});

test.slow() is shorthand for tripling the default test timeout. Use it when that convention is appropriate rather than duplicating a custom duration everywhere. The Playwright Test API documents these test-level controls.

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

Extend the current timeout in a hook

From beforeEach, you can increase the current test’s budget relative to its existing timeout:

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

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

beforeAll and afterAll can set their own timeout from within the hook. For exact behavior and the relevant methods, see the TestInfo API and Playwright Test API.

Set assertion, action, and navigation limits

Retrying assertions

Auto-retrying assertions have their own timeout, independent of the test budget. Set a suite default with expect: { timeout: ms }, as in the config example, or give one matcher a narrower limit:

await expect(page.getByRole('status')).toHaveText('Ready', { timeout: 10_000 });

This is useful when the required condition may take longer to become true. The assertion still needs to fit within the available test budget. The Assertions guide describes retrying assertions and their timeout option.

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.

Actions and navigation

Set defaults in the config’s use object, or override only the operation that needs a different limit:

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

Action and navigation operations have no timeout by default. A per-call timeout option lets a single click or navigation use a defined budget without changing the rest of the suite. The Page API also documents page- and browser-context-level default timeout methods; consult the Page API for those methods and their operation scope.

Limit a fixture or the whole run

Give a slow fixture its own budget

A fixture normally shares the test timeout. If fixture setup is the slow part and tests should retain a tighter limit, assign a timeout in the fixture definition instead:

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

export const test = base.extend({
  preparedData: [async ({}, use) => {
    const data = await prepareData();
    await use(data);
  }, { timeout: 60_000 }],
});

Use this when the setup work has a distinct, explainable budget; do not increase every test just to accommodate one fixture. The timeouts guide covers fixture-specific timeouts.

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

Set a hard cap for the suite

globalTimeout caps the complete test run and is disabled by default. Set it in the config when a run-level ceiling is useful, for example in CI to prevent a broken or stalled suite from running indefinitely. In the earlier config, 3_600_000 means a one-hour cap; choose a value that fits the suite and environment rather than copying the example uncritically. Configuration is documented in the TestConfig API.

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

Diagnose timeouts instead of masking them

A timeout may be a symptom of a readiness or stability problem rather than an undersized budget. Playwright’s official guide cautions: “If you happen to be in this section because your tests are flaky, it is very likely that you should be looking for the solution elsewhere.”

  • An assertion times out: check whether its condition accurately represents readiness and whether the page reaches that state. Increase the assertion timeout only when the expected wait is legitimate.
  • An action or navigation appears stuck: inspect the specific operation and set its limit explicitly if it needs one. These operation timeouts have no default cap.
  • The whole job runs too long: configure globalTimeout as a run-level safeguard; it is not a replacement for appropriate test and operation budgets.
  • A test is flaky: identify the unstable condition rather than raising all timeout values. For navigation, Playwright marks networkidle as discouraged for testing and recommends web assertions to assess readiness.

For navigation readiness, prefer waiting for the user-visible or application state that establishes success, such as a retrying web assertion, rather than treating network quiet as proof. See the Page API and Assertions guide.

Or skip the browser setup

If your task is to capture a website rather than test browser behavior, ScreenshotNeo takes a screenshot with one GET request. Its API can remove cookie/consent banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents.

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

For a screenshot API key, see the ScreenshotNeo API documentation. This runnable cURL example saves the screenshot response:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

ScreenshotNeo includes 1,000 screenshots per month on its free plan with no card required; paid plans start at $5 for 3,000 screenshots. Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Does increasing Playwright’s test timeout also increase the assertion timeout?

No. The test and retrying-assertion timeouts are independent settings.

Are action and navigation timeouts unlimited by default?

They have no timeout by default; configure a default or a per-operation timeout when you need a limit.

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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.