QASYNTAX
QA Automation · 2026-11-15 · By Denis Sidorenko

Running Playwright in CI/CD Without Flaky Tests

Practical patterns for deterministic browser automation in Dockerized GitHub Actions and Jenkins pipelines.

Why Playwright Suites Turn Flaky in CI

Most flaky end-to-end failures come from three sources: shared test state, arbitrary waitForTimeout calls, and undersized CI runners.

1. Isolate Every Test Run

  • Seed test data per worker or use dedicated API fixtures before opening the browser.
  • Run against an ephemeral Docker Compose stack or a clean staging tenant.

2. Rely on Web-First Assertions

Avoid manual sleeps. Use expect(locator).toBeVisible() and network response waits so Playwright retries automatically until the UI settles.

3. Capture Traces Only on Retry

Configure trace: 'on-first-retry' and retries: 2 in CI. You get full DOM snapshots, console logs, and network waterfalls when a test fails—without slowing down green runs.

Need Help Stabilizing Your Suite?

If your team ignores red builds because of flaky tests, get in touch for a quick audit.

← Back to all articles