medium

Error: expect(locator).toBeVisible() — Timeout

A Playwright assertion (expect) timed out waiting for the expected condition. Playwright assertions auto-retry until the timeout, then fail.

Common Causes

  1. 1Element never becomes visible within the assertion timeout
  2. 2Wrong selector in the assertion
  3. 3Page is still loading when assertion runs
  4. 4Assertion timeout is too short for the operation

How to Fix

Increase the assertion timeout

await expect(page.locator('#element')).toBeVisible({ timeout: 15000 });

Override the default assertion timeout for slow-loading elements.

Set global assertion timeout

// playwright.config.ts
export default defineConfig({
  expect: { timeout: 10000 },
});

Increase the default assertion timeout for all expect() calls.

How ObserveOne Helps

ObserveOne analyzes assertion failure patterns and identifies flaky tests caused by inconsistent load times.

Start Monitoring Free

Related Errors