Devii · Testing · 2026-01-18 · 6 min read
Share
Playwright In CI: Trace Files, Retries, And Deterministic Selectors
Engineering practices Playwright's own docs emphasize: traces, fixtures, and avoiding flaky timing.
Playwright (Microsoft's browser automation project) documents first-class tracing, screenshots, and video on failure. Those artifacts are the fastest way to turn intermittent CI failures into actionable bugs.
Prefer user-visible selectors (`getByRole`, `getByLabel`) over brittle CSS/XPath tied to implementation details. Combine auto-waiting assertions with explicit network stability only when the app truly streams data.
Run the same Docker image (or pinned browser build) locally and in CI so trace timelines match. Shard tests by file for wall-clock time, not by arbitrary grouping that hides setup costs.