From aj-geddes-useful-ai-prompts-4
Detects visual regressions by comparing screenshots across versions. Covers Playwright, Percy, Chromatic, Cypress, and BackstopJS for CSS bugs, layout shifts, and responsive design validation.
How this skill is triggered — by the user, by Claude, or both
Slash command
/aj-geddes-useful-ai-prompts-4:visual-regression-testingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- [Overview](#overview)
Visual regression testing captures screenshots of UI components and pages, then compares them across versions to detect unintended visual changes. This automated approach catches CSS bugs, layout issues, and design regressions that traditional functional tests miss.
Minimal working example:
// tests/visual/homepage.spec.ts
import { test, expect } from "@playwright/test";
test.describe("Homepage Visual Tests", () => {
test("homepage matches baseline", async ({ page }) => {
await page.goto("/");
// Wait for images to load
await page.waitForLoadState("networkidle");
// Full page screenshot
await expect(page).toHaveScreenshot("homepage-full.png", {
fullPage: true,
maxDiffPixels: 100, // Allow small differences
});
});
test("responsive design - mobile", async ({ page }) => {
await page.setViewportSize({ width: 375, height: 667 }); // iPhone SE
await page.goto("/");
await expect(page).toHaveScreenshot("homepage-mobile.png");
});
test("responsive design - tablet", async ({ page }) => {
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Playwright Visual Testing | Playwright Visual Testing |
| Percy Visual Testing | Percy Visual Testing |
| Chromatic for Storybook | Chromatic for Storybook |
| Cypress Visual Testing | Cypress Visual Testing |
| BackstopJS Configuration | BackstopJS Configuration |
| Handling Dynamic Content | Handling Dynamic Content |
| Testing Responsive Components | Testing Responsive Components |
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin aj-geddes-useful-ai-prompts-4Detects visual regressions in UI components by comparing screenshots against baselines. Supports Playwright, Percy, Chromatic, BackstopJS, and reg-suit.
Detects visual and UI regressions via screenshot comparison and pixel-diff analysis using Playwright or Puppeteer. Captures cross-browser/viewport screenshots, categorizes layout shifts and color changes, generates diff reports for CI/CD PR checks.
Sets up automated screenshot comparison for visual regression testing across viewports and themes, with CI integration and sensible thresholds to catch UI regressions.