CI/CD, parallelism and flaky tests
Automated tests earn their value by running automatically in CI. A typical pipeline (GitHub Actions):
- On every PR: lint + smoke suite (fast signal, <10 min)
- After main merges / nightly: full regression
- Artifacts: HTML report, traces, screenshots — uploaded for failure analysis
Parallelism: Playwright runs parallel by default (workers); for bigger scale, sharding splits the suite across machines: --shard=1/4. Requirement: tests must be fully independent.
A flaky test passes and fails without code changes. Causes: race conditions, fixed sleeps, shared data, external service dependencies, test ordering. Flaky tests kill trust in the suite — the "it's red again, probably flaky" culture hides real bugs.
The flaky-test protocol: (1) quarantine immediately (skip + ticket) — don't block the team; (2) root-cause via trace; (3) fix + prove with --repeat-each=20; (4) restore. Track the metric: a flaky rate >1-2% signals a systemic problem.
📚 Sources and documentation
- Continuous Integrationofficialplaywright.dev
- Parallelism and shardingofficialplaywright.dev