Prompt

How do I compare screenshots across browsers and viewports in CI?

Technology / Testing & QA1 observationLast seen Oct 27, 2026

Latest observation

Oct 27, 2026OpenAI APIWeb search: off

A good CI setup for screenshot comparison usually has three parts:

  1. Capture screenshots in multiple browsers/viewports
  2. Compare against baselines
  3. Review and approve diffs when they’re intentional

Recommended approach

1) Use a visual regression tool

Common choices:

  • Playwright with built-in screenshot assertions
  • Cypress + Percy
  • Storybook + Chromatic
  • Applitools
  • Loki / BackstopJS for more custom setups

If you already use Playwright, it’s often the simplest option.


2) Structure your test matrix

Run the same page/component across combinations like:

  • Browsers: chromium, firefox, webkit
  • Viewports: mobile, tablet, desktop
  • Themes/locales if relevant

Example matrix:

  • Chrome 128, 375×667
  • Chrome 128, 1280×720
  • Firefox 128, 1280×720
  • Safari/WebKit, 375×667

Keep the matrix small at first, then expand.


3) Use stable rendering settings

To reduce flaky diffs:

  • Wait for fonts to load
  • Disable animations
  • Mock time/randomness
  • Stub APIs and network calls
  • Use fixed data
  • Hide dynamic elements like timestamps/counters
  • Set consistent timezone and locale
  • Use consistent device scale factor if needed

For Playwright, common settings:

  • animations: 'disabled'
  • mask dynamic selectors
  • fullPage: true only when needed

4) Save baselines per browser if needed

Browsers render slightly differently, so you may want:

  • one baseline per browser
  • or one baseline per browser + viewport combination

This depends on how strict you want comparisons to be.

Typical layout:

screenshots/
  homepage-chromium-1280.png
  homepage-firefox-1280.png
  homepage-webkit-375.png

5) Run in CI

Use a CI job matrix to parallelize.

Example with GitHub Actions:

name: visual-tests

on: [push, pull_request]

jobs:
  screenshots:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        browser: [chromium, firefox, webkit]
        viewport: [mobile, desktop]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - run: npx playwright install --with-deps
      - run: npx playwright test --project=${{ matrix.browser }} --grep @visual
        env:
          VIEWPORT: ${{ matrix.viewport }}

6) Compare and report diffs

Most tools generate:

  • actual screenshot
  • expected screenshot
  • diff image
  • HTML report

In CI, publish these as:

  • build artifacts
  • PR comments
  • screenshots in a dashboard

That way reviewers can inspect the visual change before merging.


7) Make approvals explicit

For intentional UI changes:

  • update baselines in a separate commit/PR
  • require human review before accepting new screenshots
  • avoid auto-updating baselines on every run

Example: Playwright screenshot testing

import { test, expect } from '@playwright/test';

test.use({ viewport: { width: 1280, height: 720 } });

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

You can parameterize browser/viewports via Playwright projects.


Practical tips

  • Start with the most important pages/components only
  • Use a dedicated “visual” test suite
  • Keep screenshots small and focused
  • Don’t compare pages with live ads, chat widgets, or other unstable third-party content
  • Use thresholds sparingly; too much tolerance can hide regressions

If you want the easiest production-ready path

  • Playwright if you want control and low cost
  • Percy/Chromatic if you want collaboration and review tooling
  • Applitools if you want more advanced AI-based diffing

If you tell me your stack (Playwright/Cypress/Storybook/GitHub Actions/GitLab/etc.), I can give you a concrete CI config and test example.

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.