agentsclimarketplace

Testing visual regression

Skill jeremylongshore/claude-code-plugins-plus-skills/skills/.curated/testing-visual-regression

425 plugins, 2,810 skills, 200 agents for Claude Code. Open-source marketplace at tonsofskills.com with the ccpi CLI package manager.

Install
npx -y skills add jeremylongshore/claude-code-plugins-plus-skills --skill testing-visual-regression

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

'Detect visual changes in UI components using screenshot comparison.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

5.1 KB, as published. Nobody here has run it

Visual Regression Tester

Overview

Detect unintended visual changes in UI components by capturing screenshots and comparing them pixel-by-pixel against approved baselines. Supports Playwright visual comparisons, Percy, Chromatic, BackstopJS, and reg-suit.

Prerequisites

  • Browser automation tool installed (Playwright, Puppeteer, or Cypress)
  • Visual regression library configured (Playwright toHaveScreenshot, Percy, Chromatic, or BackstopJS)
  • Baseline screenshots committed to version control or stored in a cloud service
  • Storybook or component playground running for isolated component captures (optional)
  • Consistent rendering environment (Docker or CI with fixed OS/fonts/GPU settings)

Instructions

  1. Identify all UI components and pages requiring visual coverage using Glob to scan component directories and route definitions.
  2. Create a visual test file for each component or page:
    • Navigate to the component URL or Storybook story.
    • Wait for all network requests, animations, and lazy-loaded images to complete.
    • Set a consistent viewport size (e.g., 1280x720 for desktop, 375x812 for mobile).
  3. Capture screenshots with deterministic settings:
    • Disable animations and transitions (* { animation: none !important; transition: none !important; }).
    • Mask dynamic content (timestamps, random avatars, ads) with CSS overlays.
    • Use fullPage: true for scrollable pages.
  4. Compare captured screenshots against baselines:
    • Configure pixel difference threshold (recommended: 0.1% for component tests, 0.5% for full-page).
    • Generate diff images highlighting changed regions.
    • Flag tests as failed when differences exceed the threshold.
  5. For responsive testing, capture at multiple breakpoints:
    • Mobile: 375px width
    • Tablet: 768px width
    • Desktop: 1280px width
    • Wide: 1920px width
  6. Review diff images for each failure and classify as:
    • Intentional change: Update the baseline with --update-snapshots.
    • Regression: File a bug with the diff image attached.
  7. Integrate into CI so visual tests run on every pull request with diff images uploaded as artifacts.

Output

  • Screenshot baseline images stored in __screenshots__/ or equivalent directory
  • Diff images highlighting pixel-level changes between baseline and current
  • Visual regression test report with pass/fail status per component
  • CI artifacts containing all captured, baseline, and diff images
  • Responsive coverage matrix showing results across breakpoints

Error Handling

ErrorCauseSolution
Anti-aliasing differences across OSFont rendering varies between macOS, Linux, and WindowsRun visual tests in Docker with fixed fonts; use threshold option to allow sub-pixel variance
Flaky screenshots from animationsCSS transitions or JS animations still running at capture timeInject prefers-reduced-motion or disable animations via addStyleTag before capture
Missing baseline on first runNo previous screenshot exists to compare againstRun with --update-snapshots to create initial baselines; commit them to the repository
Viewport size mismatchBrowser chrome or scrollbar width differs between environmentsUse setViewportSize explicitly; hide scrollbars with CSS overflow: hidden
Dynamic content causes false failuresTimestamps, user avatars, or ads change between runsMask dynamic elements with mask option or replace content via page.evaluate

Examples

Playwright visual regression test:

import { test, expect } from '@playwright/test';

test('homepage matches baseline', async ({ page }) => {
  await page.goto('/');
  await page.waitForLoadState('networkidle');
  await page.addStyleTag({ content: '* { animation: none !important; }' });
  await expect(page).toHaveScreenshot('homepage.png', {
    maxDiffPixelRatio: 0.001,
    fullPage: true,
  });
});

BackstopJS scenario configuration:

{
  "label": "Login Page",
  "url": "http://localhost:3000/login",  # 3000: 3 seconds in ms
  "selectors": ["document"],
  "misMatchThreshold": 0.1,
  "viewports": [
    { "label": "phone", "width": 375, "height": 812 },  # 812: 375 = configured value
    { "label": "desktop", "width": 1280, "height": 720 }  # 1280: 720 = configured value
  ]
}

Resources

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.