🧪

Visual Regression Testing Pipeline

Set up visual regression testing to catch unintended UI changes

Intermediate🧪 TestingAll Models
prompt template
Set up visual regression testing for:

**Framework:** [FRAMEWORK — e.g., "Next.js with Tailwind"]
**Key pages:** [PAGES — e.g., "homepage, pricing, dashboard, settings"]
**Viewports:** [VIEWPORTS — e.g., "mobile 375px, tablet 768px, desktop 1440px"]

Generate:
1. **Tool setup** — Playwright visual comparison configuration
2. **Screenshot suite** — test file capturing each page at each viewport
3. **Threshold configuration** — acceptable pixel diff percentage per component
4. **Baseline management** — how to update baselines when changes are intentional
5. **CI integration** — run on PR, upload diff reports as artifacts
6. **Dynamic content handling** — mask timestamps, avatars, and variable content
7. **Component-level tests** — Storybook integration for isolated component screenshots

Include the complete test configuration and example test files.

How to Use This Prompt

  1. 1Copy the prompt template above
  2. 2Paste into Claude, ChatGPT, or Cursor
  3. 3Replace [bracketed placeholders] with your specific project details
  4. 4Iterate on the AI output to refine and customize the results