visual-regression

Adds Playwright screenshot comparison tests with git-committed baselines and CI visual diff jobs.

Updated May 21, 2026
One-click install
npx skills add https://github.com/CagesThrottleUs/private-ai-harness --skill visual-regression-cagesthrottleus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: visual-regression
Source: https://github.com/CagesThrottleUs/private-ai-harness/tree/main/skills/visual-regression
Command: npx skills add https://github.com/CagesThrottleUs/private-ai-harness --skill visual-regression-cagesthrottleus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Functional E2E tests confirm a checkout flow completes, but they cannot catch a broken layout, overlapping text, or missing buttons. This Skill adds visual regression testing so CSS and layout regressions are caught automatically before they reach production. ## Core Features & Use Cases - Zero-dependency screenshot testing: Uses Playwright's built-in toHaveScreenshot() with animation disabling, dynamic-content masking, and configurable pixel thresholds — no new packages required. - Baseline management workflow: Commits baseline snapshots to git, documents the deliberate --update-snapshots update process, and forbids auto-updating baselines in CI. - CI integration with diff artifacts: Adds a pinned Playwright Docker container job that uploads visual diff images on failure for review. - Use Case: After redesigning a marketing landing page, run the visual suite to confirm every critical page and component still renders correctly across desktop and mobile viewports, then update baselines as a deliberate commit. ## Quick Start Set up Playwright visual regression tests for my homepage and checkout form with committed baselines and a CI job.

Frequently Asked Questions about visual-regression

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add visual regression tests with Playwright?

Use Playwright's built-in toHaveScreenshot() assertion to capture page or component screenshots and compare them against committed baseline images. Configure maxDiffPixels and threshold in playwright.config.ts, disable animations, and run with --update-snapshots to create baselines.

Playwright vs Chromatic vs Percy for visual testing?

Playwright's built-in toHaveScreenshot() is free and needs no extra dependencies, suiting page-level full-page captures. Chromatic fits Storybook component libraries with cloud baseline hosting, and Percy handles cross-browser comparison with BrowserStack integration.

Should visual regression snapshots be committed to git?

Yes, baseline PNG snapshots must be committed to git because they are the source of truth for comparisons. Verify the snapshots directory is not in .gitignore, and update baselines only through deliberate local commits, never automatically in CI.

Why are my Playwright screenshot tests flaky?

Flakiness comes from running animations, dynamic content like timestamps and avatars, font loading, third-party content, and platform differences. Fix it by disabling animations, masking dynamic locators, waiting for networkidle, and pinning the CI Docker image version.

When should I skip visual regression testing?

Skip visual regression for API-only services, internal admin tools without design requirements, and purely functional pages with no layout-sensitive design. It is required only for UI features with visual design intent where CSS regressions would go unnoticed.