TE

testing-visual-regression

Automate visual UI testing by comparing screenshots against baselines to detect unintended rendering changes.

Install

mkdir -p .claude/skills/testing-visual-regression && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/8573" && unzip -o skill.zip -d .claude/skills/testing-visual-regression && rm skill.zip

Installs to .claude/skills/testing-visual-regression

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Detect visual changes in UI components using screenshot comparison.
67 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Capture component screenshots
  • Compare pixel differences against baselines
  • Mask dynamic content in UI
  • Generate visual regression reports
  • Test across multiple viewport breakpoints

How it works

The tool captures screenshots of components and compares them pixel-by-pixel against stored baselines, flagging differences that exceed a defined threshold.

Inputs & outputs

You give it
UI component URL or state
You get back
Pass/fail status with diff images

When to use testing-visual-regression

  • Verify UI component consistency across different releases
  • Detect pixel-level rendering issues in automated tests
  • Validate visual state after refactoring styles
  • Automate regression checks for Storybook components

About this skill

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

When not to use it

  • Testing non-UI logic
  • Environments with inconsistent rendering

Prerequisites

Browser automation tool like PlaywrightVisual regression libraryBaseline screenshots

Limitations

  • Font rendering varies between OS
  • Animations cause flaky screenshots
  • Dynamic content causes false failures

How it compares

This automates visual verification, replacing manual inspection with programmatic pixel-level comparison.

Compared to similar skills

testing-visual-regression side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
testing-visual-regression (this skill)025dReviewIntermediate
webapp-testing3533moReviewIntermediate
ui-ux-expert-skill919moReviewAdvanced
skill-creator1283moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

You might also like

webapp-testing

anthropics

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

353585

ui-ux-expert-skill

fercracix33

Technical workflow for implementing accessible React user interfaces with shadcn/ui, Tailwind CSS, and TanStack Query. Includes 6-phase process with mandatory Style Guide compliance, Context7 best practices consultation, Chrome DevTools validation, and WCAG 2.1 AA accessibility standards. Use after Test Agent, Implementer, and Supabase agents complete their work.

91244

skill-creator

anthropics

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.

128200

python-testing-patterns

wshobson

Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development. Use when writing Python tests, setting up test suites, or implementing testing best practices.

77204

dependency-upgrade

wshobson

Manage major dependency version upgrades with compatibility analysis, staged rollout, and comprehensive testing. Use when upgrading framework versions, updating major dependencies, or managing breaking changes in libraries.

26240

playwright-mcp

sfc-gh-dflippo

Browser testing, web scraping, and UI validation using Playwright MCP. Use this skill when you need to test Streamlit apps, validate web interfaces, test responsive design, check accessibility, or automate browser interactions through MCP tools.

33197

Search skills

Search the agent skills registry