Prompt

I'm building a frontend CI pipeline and want screenshot diffs on every PR

Technology / Testing & QA1 observationLast seen Oct 27, 2026

Latest observation

Oct 27, 2026OpenAI APIWeb search: off

A solid way to do this is:

  1. Run your app in CI
  2. Take screenshots of key pages/components
  3. Compare them against stored “baseline” screenshots
  4. Fail or comment on the PR if there’s a visual change

Recommended tools

  • Playwright for browser automation and screenshot capture
  • Percy, Chromatic, or Argos for hosted visual diffing
  • Or do it yourself with Playwright + pixelmatch if you want full control

Best-practice setup

Option A: Hosted visual testing

This is the easiest for PRs.

Pros

  • Easy PR comments with diffs
  • Flake handling and baseline management
  • Great UX for reviewers

Typical flow

  • On every PR, run screenshots
  • Upload to service
  • Service compares against baseline
  • PR gets pass/fail and a review link

Example tools

  • Percy: good general-purpose visual regression
  • Chromatic: excellent if you use Storybook
  • Argos: nice for Playwright-based workflows

Option B: Self-managed with Playwright

Good if you want no external dependency.

Flow

  • CI starts app
  • Playwright runs screenshot tests
  • Compare against checked-in baseline images
  • If mismatched, CI fails and uploads diffs as artifacts

Example with Playwright

Install

npm i -D @playwright/test
npx playwright install --with-deps

Test example

// tests/visual.spec.ts
import { test, expect } from '@playwright/test';

test('homepage looks correct', async ({ page }) => {
  await page.goto('http://localhost:3000');
  await expect(page).toHaveScreenshot('homepage.png', {
    fullPage: true,
  });
});

CI workflow idea

  • Build app
  • Start server
  • Run Playwright tests
  • Upload diff artifacts on failure

Example GitHub Actions sketch:

name: visual-tests

on:
  pull_request:

jobs:
  screenshot-diff:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm

      - run: npm ci
      - run: npm run build
      - run: npm run start &

      - run: npx wait-on http://localhost:3000
      - run: npx playwright test

Important tips to reduce flaky diffs

  • Use a consistent viewport
  • Disable animations
  • Wait for fonts to load
  • Mock API/data for deterministic rendering
  • Run in Docker/Linux in CI and match local fonts if possible
  • Prefer component/route-level screenshots over entire app if possible

Baseline management

A good pattern is:

  • PRs: compare against main branch baselines
  • Main branch merges: update baselines intentionally
  • Require a human approval to accept new screenshots

If you want the best reviewer experience

Use:

  • Playwright for capture
  • Percy/Chromatic/Argos for diff UI and PR comments

If you want, I can give you:

  1. a GitHub Actions workflow for Playwright screenshot diffs, or
  2. a Percy/Chromatic setup depending on your stack.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.