What problem does it solve?
Visual UI changes can slip through normal e2e tests, and screenshot comparisons fail inconsistently when baselines are generated on the wrong platform. This Skill guides writing Playwright visual regression tests that compare screenshots against committed baselines, with baselines generated inside the pinned Playwright Docker image so CI comparisons stay deterministic.
Core Features & Use Cases
- Visual Test Authoring: Use the
visual() helper to declare @visual-tagged tests and expectScreenshot to capture and diff screenshots, with optional target locators and mask regions for non-deterministic content.
- Baseline Generation: Run
pnpm test:visual:update inside the pinned Playwright Docker image to create or update baseline PNGs that match CI's exact renderer and font stack.
- CI Integration: Understand how the
visual-regression job discovers suites via find-visual-suites.mjs, gates on UI-affecting file changes, and excludes @visual tests from the regular e2e matrix.
- Use Case: You changed a CSS file affecting the admin list view. Write a
visual() test asserting the row is visible, generate the baseline with pnpm test:visual:update, commit the PNG, and let CI catch any future unintended pixel changes.
Quick Start
Write a Playwright visual regression test for the posts list view using the visual helper and generate its baseline screenshot with the Docker update command.