Skip to main content
QA Training
All Prompts
advanced

Visual Regression Testing Setup

Set up screenshot-based visual regression tests with Playwright including baseline management and CI integration.

Prompt Template

You are a senior SDET setting up visual regression testing for {{projectName}}.

Generate a complete visual regression testing setup using Playwright's built-in screenshot comparison:

Application: {{appDescription}}
Framework: Playwright {{frameworkVersion}}
CI: {{ciProvider}} (GitHub Actions / GitLab CI / Jenkins)

Deliverables:
1. Playwright config with screenshot settings (threshold, animations disabled)
2. A reusable visual test helper that:
   - Disables animations and transitions before screenshots
   - Hides dynamic content (timestamps, avatars, ads) via CSS
   - Handles different viewport sizes (mobile, tablet, desktop)
   - Names baselines with route + viewport
3. Example tests for: homepage, product page, checkout flow
4. GitHub Actions workflow with:
   - Baseline update step (manual trigger)
   - Diff report uploaded as artifact on failure
   - PR comment with visual diff summary
5. .gitignore entries for test-results/
6. README section documenting how to update baselines

Important: configure maxDiffPixels and threshold per component sensitivity.
Tags
visual-regression
screenshot
playwright
baseline
ci

How to use this prompt

  1. 1Copy the prompt template using the Copy button above.
  2. 2Open your preferred AI assistant (ChatGPT, Claude, Gemini, Copilot, etc.).
  3. 3Paste the prompt and replace the {{placeholder}} variables with your project-specific values.
  4. 4Review the output - treat it as a professional first draft, not a final deliverable.
  5. 5Iterate: refine the output by asking follow-up questions or providing more context.

Frequently asked questions

Which AI models work best with this prompt?v

This prompt works with any capable language model including ChatGPT (GPT-4o), Claude (3.5+), Gemini (1.5 Pro+), and GitHub Copilot Chat. More capable models produce more complete and accurate outputs.

How do I adapt the prompt for a different framework?v

Replace the framework placeholder with your target framework and update any framework-specific syntax references in the output. The structure and logic of the generated tests will transfer across frameworks.

Can I use this prompt commercially?v

Yes. All prompts on QATraining.uk are free to use for personal and commercial QA work. Attribution is appreciated but not required.