Visual regression testing expert using Playwright snapshots, Percy, Chromatic, BackstopJS, and pixel-diff analysis. Covers baseline management, responsive testing, cross-browser visual testing, component visual testing, and CI integration. Activates for visual regression, screenshot testing, visual diff, Percy, Chromatic, BackstopJS, pixel comparison, snapshot testing, visual testing, CSS regression, UI looks different, layout changed, style regression, component looks wrong, responsive breakpoints, cross-browser differences, screenshot comparison, baseline update, approve changes, Storybook visual tests, design QA, pixel perfect, UI drift, visual bugs.
View on GitHubanton-abyzov/specweave
sw-testing
January 25, 2026
Select agents to install to:
npx add-skill https://github.com/anton-abyzov/specweave/blob/main/plugins/specweave-testing/skills/visual-regression/SKILL.md -a claude-code --skill visual-regressionInstallation paths:
.claude/skills/visual-regression/# Visual Regression Testing Skill
Expert in visual regression testing - automated detection of unintended visual changes in web applications using screenshot comparison, pixel diffing, and visual testing frameworks.
## Why Visual Regression Testing?
**Problems It Solves**:
- CSS changes breaking layout unexpectedly
- Responsive design regressions (mobile/tablet/desktop)
- Cross-browser rendering differences
- Component library changes affecting consumers
- UI regressions that functional tests miss
**Example Scenario**:
```
Developer changes global CSS: `.container { padding: 10px }`
↓
Accidentally breaks checkout page layout
↓
Functional E2E tests pass (buttons still clickable)
↓
Visual regression test catches layout shift
```
## Core Tools
### 1. Playwright Visual Snapshots (Built-in)
**Why Playwright?**
- No third-party service required (free)
- Fast (parallel execution)
- Built-in automatic masking (hide dynamic content)
- Cross-browser support (Chromium, Firefox, WebKit)
#### Basic Snapshot Test
```typescript
import { test, expect } from '@playwright/test';
test('homepage should match visual baseline', async ({ page }) => {
await page.goto('https://example.com');
// Take full-page screenshot and compare to baseline
await expect(page).toHaveScreenshot('homepage.png');
});
```
**First Run** (create baseline):
```bash
npx playwright test --update-snapshots
# Creates: tests/__screenshots__/homepage.spec.ts/homepage-chromium-darwin.png
```
**Subsequent Runs** (compare to baseline):
```bash
npx playwright test
# Compares current screenshot to baseline
# Fails if difference exceeds threshold
```
#### Element-Level Snapshots
```typescript
test('button should match visual baseline', async ({ page }) => {
await page.goto('/buttons');
const submitButton = page.locator('[data-testid="submit-button"]');
await expect(submitButton).toHaveScreenshot('submit-button.png');
});
```
#### Configurable Thresholds
```typescript
// playwright.config.