Use Cases/Screenshot

Catch visual bugs before your users do

Automated screenshot comparison for your CI/CD pipeline. Detect unintended UI changes with pixel-perfect accuracy.

CI/CD ReadyPixel DiffFull PageMulti-Viewport
import { Stack0 } from '@stack0/sdk'
const stack0 = new Stack0({ apiKey: process.env.STACK0_API_KEY })
// Capture screenshots for visual testing
export async function captureBaseline(pages: string[]) {
const screenshots = await Promise.all(
pages.map(async (path) => {
const { imageUrl } = await stack0.screenshot.capture({
url: `${process.env.APP_URL}${path}`,
viewport: { width: 1280, height: 800 },
fullPage: true,
// Wait for animations to complete
waitForSelector: '[data-testid="page-loaded"]',
})
return { path, imageUrl }
})
)
return screenshots
}
// Compare screenshots in CI
export async function compareScreenshots(
baseline: Screenshot[],
current: Screenshot[]
) {
const diffs = await stack0.screenshot.compare({
baseline: baseline.map(s => s.imageUrl),
current: current.map(s => s.imageUrl),
threshold: 0.1, // 0.1% pixel difference allowed
})
return diffs.filter(d => d.diffPercentage > 0)
}

Features

What's included

Screenshot Capture

Reliable screenshots with wait conditions. Capture after animations complete.

Diff Detection

Pixel-by-pixel comparison with configurable thresholds.

CI/CD Ready

GitHub Actions, GitLab CI, Jenkins. Integrates with your workflow.

Multiple Viewports

Test responsive designs. Mobile, tablet, desktop in one run.

Baseline Management

Update baselines when changes are intentional. Version with your code.

Fast Capture

Parallel screenshot capture. Full test suite in seconds.

Why Stack0

Built for production

Catch regressions

Detect unintended visual changes before they ship. CSS breaks, layout shifts, missing elements.

CI/CD integration

Run visual tests on every PR. Block merges when visual regressions are detected.

Pixel-perfect comparison

Configurable diff thresholds. Ignore anti-aliasing, catch real changes.

Full page capture

Capture entire scrollable pages. Test every part of your UI.

Multiple viewports

Test mobile, tablet, and desktop simultaneously. Catch responsive bugs.

Simple pricing

$1 per 1,000 screenshots. No per-comparison fees.

Applications

Common implementations

PR Validation

Block PRs that introduce unintended visual changes.

Cross-browser Testing

Compare renders across Chrome, Firefox, and Safari.

Design QA

Verify implementations match design specs pixel-perfectly.

Refactoring Safety

Refactor CSS with confidence. Visual tests catch regressions.

FAQ

Frequently asked questions

We compare images pixel by pixel, calculating the percentage of changed pixels. The threshold parameter lets you ignore minor anti-aliasing differences while catching real changes. You can also generate diff images highlighting exactly what changed.

Yes. Specify different viewport sizes in your capture requests to test mobile, tablet, and desktop layouts. Run all viewport sizes in parallel for fast testing.

Use the waitForSelector option to wait for specific elements, or waitForTimeout for time-based delays. You can also mask dynamic areas like timestamps or ads to exclude them from comparison.

Stack0 works with any CI/CD platform including GitHub Actions, GitLab CI, Jenkins, CircleCI, and Travis CI. Our SDK makes it easy to integrate visual testing into your existing pipeline.

Store baseline image URLs in your repository or a database. Update baselines when intentional changes are approved. Our SDK includes helpers for baseline management.

Ready to build?

Plans start at $5/month.

Get Started