Skip to content
Latchkey

How to Set Time Budgets and Timeouts for E2E Tests in GitHub Actions

Layer three timeouts: a job timeout to cap the run, a per-test timeout, and an expect timeout for assertions.

Set timeout-minutes on the job so a stuck browser is killed, and set timeout plus expect.timeout in the Playwright config so individual tests and waits fail quickly rather than hanging.

playwright.config.ts

playwright.config.ts
import { defineConfig } from '@playwright/test'

export default defineConfig({
  timeout: 30_000,
  expect: { timeout: 5_000 },
  use: { actionTimeout: 10_000, navigationTimeout: 15_000 },
})

Workflow

.github/workflows/ci.yml
jobs:
  e2e:
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npx playwright install --with-deps
      - run: npx playwright test

Gotchas

  • Without a job timeout-minutes, a hung E2E run can consume up to the 360-minute ceiling.
  • Set the per-test timeout above the slowest legitimate test, not the average, to avoid false failures.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →