| name | visual-regression-tester |
| description | Implements visual regression testing with screenshot comparison, diff detection, and CI integration using Playwright or Chromatic. Use when users request "visual testing", "screenshot testing", "UI regression", "visual diff", or "Chromatic setup". |
Visual Regression Tester
Catch unintended UI changes with automated visual regression testing.
Core Workflow
- Choose tool: Playwright, Chromatic, Percy
- Setup baseline: Capture initial screenshots
- Configure thresholds: Define acceptable diff
- Integrate CI: Automated testing
- Review changes: Approve or reject
- Update baselines: Accept intentional changes
Playwright Visual Testing
Installation
npm install -D @playwright/test
npx playwright install
Configuration
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests/visual',
testMatch: '**/*.visual.ts',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.. ? : ,
: process.. ? : ,
: [
[, { : }],
[, { : }],
],
: ,
: ,
: {
: {
: ,
: ,
: ,
: ,
},
: {
: ,
},
},
: {
: ,
: ,
: ,
: ,
},
: [
{
: ,
: {
...devices[],
: { : , : },
},
},
{
: ,
: {
...devices[],
: { : , : },
},
},
{
: ,
: {
...devices[],
},
},
{
: ,
: {
: { : , : },
},
},
],
: {
: ,
: ,
: !process..,
: * ,
},
});