Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk6 min

How to Add Screenshot Regression Tests to a GitHub Actions Workflow

Run Playwright screenshot assertions in GitHub Actions, keep capture environments consistent, review baseline changes, and save reports as workflow artifacts.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Add screenshot regression tests by writing Playwright Test assertions with toHaveScreenshot(), then run them in a GitHub Actions job that installs your project and Playwright browsers. Save the resulting report as an Actions artifact so reviewers can inspect failures. The key to useful comparisons is consistency: generate and compare screenshots in a stable environment, and review baseline changes rather than updating them automatically on every pull request.

1. Add screenshot assertions to your Playwright tests

Playwright Test compares a captured screenshot with a reference image. On the first run, it creates the reference; later runs compare against it. Treat that initial screenshot as a proposed baseline: inspect it, then commit approved reference files to the repository along with the test.

As an Amazon Associate I earn from qualifying purchases.

For example, add an assertion to an existing Playwright test:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

await expect(page).toHaveScreenshot('home.png');

The assertion belongs after the page has reached the state you want to verify. Make test data and page state deterministic where possible: wait for the relevant content, use stable test accounts or fixtures, and avoid capturing transient animations or timestamps unless those are intentionally under test. Playwright’s snapshot documentation explains screenshot assertions and reference management: Playwright visual comparisons.

#1 Best Overall
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
  • Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM)
  • Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
  • CanaKit Turbine Black Case for the Raspberry Pi 5
  • CanaKit Low Noise Bearing System Fan
  • Mega Heat Sink - Black Anodized

2. Add the GitHub Actions workflow

Create .github/workflows/visual-tests.yml in your repository. The example below runs on pushes to main and on pull requests, installs dependencies and browser requirements, runs the Playwright suite, and uploads the HTML report when the job is not cancelled.

name: Playwright visual tests

on:
  pull_request:
  push:
    branches: [main]

jobs:
  visual-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@<reviewed-version>
      - uses: actions/setup-node@<reviewed-version>
        with:
          node-version: <project-version>
      - run: npm ci
      - run: npx playwright install --with-deps
      - run: npx playwright test
      - uses: actions/upload-artifact@<reviewed-version>
        if: ${{ !cancelled() }}
        with:
          name: playwright-report
          path: playwright-report/
          retention-days: 30

Replace each action placeholder with a reviewed version and set node-version to a version supported by your project and the current Playwright release. The official Playwright CI example uses this general sequence; consult it for current requirements and workflow details: Playwright CI documentation. The example uses a 30-day report retention period; adjust it to your repository’s retention needs.

What each step does

  • actions/checkout makes the repository contents available to the runner.
  • actions/setup-node selects Node.js for the job.
  • npm ci installs the dependency versions recorded in the lockfile.
  • npx playwright install --with-deps installs Playwright’s browsers and required operating-system dependencies.
  • npx playwright test runs the configured Playwright Test suite, including screenshot assertions.
  • actions/upload-artifact stores the HTML report with the workflow run for later inspection.

Set up the report

Playwright’s HTML reporter writes to playwright-report/ when configured. If your project does not already configure it, add this to playwright.config.ts:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
CanaKit Raspberry Pi 5 16GB Starter Kit PRO - Turbine Black (128GB Edition) (16GB RAM)
  • Includes Raspberry Pi 5 16GB with 2.4Ghz 64-bit quad-core CPU (16GB RAM)
  • Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
  • CanaKit Turbine Black Case for the Raspberry Pi 5
  • CanaKit Low Noise Bearing System Fan
  • Mega Heat Sink - Black Anodized
import { defineConfig } from '@playwright/test';

export default defineConfig({
  reporter: 'html',
});

After a run, open the GitHub Actions run and download the playwright-report artifact to inspect the report. Playwright’s CI introduction describes inspecting test logs, reports, and traces: Playwright CI introduction.

3. Create and review reference screenshots

First run

The first execution creates reference screenshots because there are no existing snapshots to compare. Run the tests locally in the same kind of environment you intend to use in CI, inspect the generated images, and commit only approved baselines. The snapshot files are part of the test’s expected state; include intentional visual changes in the same reviewed change that updates them.

When a comparison fails

Use the report and any attached comparison images to determine whether the difference represents a real UI regression or an environmental fluctuation. If the interface change is intended, regenerate and review the baseline update, then commit it. Do not make ordinary pull-request CI update reference screenshots automatically: that can turn an unintended change into the new expected result without meaningful review.

Rank #3
CanaKit Raspberry Pi 5 Essentials Starter Kit (4GB RAM)
  • CanaKit Raspberry Pi 5 Essentials Starter Kit

4. Make screenshot runs reproducible

Screenshot comparisons are sensitive to the capture environment. Playwright recommends using a consistent environment for screenshot and visual-regression testing; its CI guidance documents a container as one way to achieve that consistency. Keep these factors stable where practical:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Browser version and operating-system libraries.
  • Installed fonts and font rendering environment.
  • Viewport and device scale settings.
  • Test data, authentication state, and the page state being captured.
  • Timing-sensitive content such as animations, clocks, or asynchronously loaded data.

If local screenshots differ consistently from CI, first compare the browser, fonts, OS dependencies, and viewport rather than immediately accepting a new baseline. A container can reduce environment drift when local and CI runners otherwise differ.

5. Choose a visual testing workflow

For a team already using Playwright, native screenshot assertions keep the test and reference images in the project’s test workflow. Hosted tools may fit better when their review or publishing workflow is a requirement. The cited integration documentation establishes the capabilities below, not current prices or which option is best for every project.

Rank #4
SANOOV Raspberry Pi 5 4GB Kit, 4GB RAM Single Board Computer with Active Cooler and ABS Case, Complete Raspberry Pi 5 Starter Kit for IoT Robotics Retro Gaming
  • All-in-One Complete Kit: This SANOOV RPi 5 bundle comes with Raspberry Pi 5 4GB RAM single board, active cooler, durable ABS case and screwdriver. No extra parts needed, ready to use right out of the box for beginners and hobbyists
  • Powerful Single Board Computer: Equipped with 4GB RAM and high-performance processor, delivers fast running speed for 4K playback, AI projects, programming and daily computing tasks. SANOOV for raspberry pi 5 4GB is equipped with broadcom 64 quad-core Arm Cortex A76 processor with gigabit ethernet and upgraded with IEEE 802.11ac Wi-Fi, Bluetooth 5.0 dual-band 2.4Ghz and 5Ghz and Power Over Ethernet (POE). Upgrading delivers 2-3 x speed vs Pi 4, redefining the experience
  • Efficient Active Cooler: Effectively lowers operating temperature and prevents performance throttling. Runs quietly even under long-time heavy load, ensures stable operation all day long. SANOOV RPi 5 4GB kit offer an active cooler, which combines an aluminium heatsink with a high-performance PWM fan. Active cooler is fully compatible with the Pi OS, which can effectively reduce the temperature of RPi5 and ensure its good performance during long-term high load operation
  • Sturdy ABS Protective Case: Well-fitted for Raspberry Pi 5 board, can be secured with 4 screws to effectively protect the Pi 5 motherboard from damage, reserves full access to all ports and buttons. SANOOV uses ABS material to produce the case, which has a softer texture and feel. Meanwhile, SANOOV case adopts a layered design for easy disassembly and installation. (Tip: The Case cannot install M.2 HAT Add on Board and Solid State Drive!)
  • Wide Application & Full Compatibility: Seamlessly compatible with official OS and mainstream peripheral accessories for Raspberry Pi 5. Whether you are a beginner, student, electronics hobbyist or professional developer, this all-in-one kit meets your diverse needs. It excels in IoT projects, robotics design, retro gaming devices, home media servers and other DIY creations. Backed by a large global community, you can easily find guides, technical support and shared projects online
Approach What the documentation describes Consider it when
ScreenshotNeo Website screenshot API and MCP server; see the product section below. You need screenshots through an API or an AI-agent MCP workflow rather than only in test assertions.
Playwright-native snapshots toHaveScreenshot() assertions and reference screenshots associated with Playwright tests. You want screenshot assertions and baseline files within the existing test repository.
Percy Playwright integration for snapshot workflows; documentation describes an optional reporter gate that can fail on changes. Hosted visual review is useful to your team.
Chromatic Documentation provides a GitHub Actions workflow for visual tests and publishing Storybook. Storybook publishing and visual testing belong in the same workflow.

For Percy and Chromatic, compare baseline management, review process, CI gating, runtime and repository complexity, and whether hosted review is needed. Their integration documentation is available at Percy’s Playwright integration guide and Chromatic’s GitHub Actions guide.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

6. Troubleshoot common failures

The workflow cannot find the browser

Cause: The runner has Playwright packages but not the browser binaries or operating-system dependencies. Fix: Run npx playwright install --with-deps after installing project dependencies, and check that the Playwright package version matches the project lockfile.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Many pixels differ between local and CI

Cause: The comparison environments may differ in browser, operating system, fonts, viewport, or page state. Fix: Standardize the environment, use the same browser configuration, and verify test data and fonts before regenerating snapshots.

Best Value
RasTech Raspberry Pi 5 8GB Kit with Active Cooler and Pi5 Case
  • 【What you Get】You will get 1*Pi 5 8GB Single Board,1*RasTech Case,1*Active Cooler,1*Screwdriver,1*Installation instructions,12-month free warranty, lifetime service, 24-hour prompt and friendly response.
  • 【More Connectors】There are two USB 3.0 ports(5Gbps simultaneously) and two USB 2.0 ports, which triple total bandwidth ,support any combination of up to two cameras or displays. Peak SD card performance is doubled through support for the SDR104 high-speed mode. It provides a smooth desktop experience for you. Offer Gigabit Ethernet and a PCIe interface, along with dual-band Wi-Fi and Bluetooth 5.0/BLE wireless capability. The RasTech Pi 5 Kit use the new 27W 5.1V 5A USB-C power connector.
  • 【 Support Dual 4Kp60 Display 】Each of the two microHDMI sockets can control a 4K display at 60 Hertz, now support HDR, offering super HD video for media streaming projects. RPi 5 is the first RPi model that comes with a PCI Express port (PCIe 2.0 x1 with 500 MB/s) to attach SSDs (requires separate M.2 HAT).
  • 【 Excellent Chips And Applications】Pi 5 is a full-size Pi computer using silicon built in-house at Pi. The RP1 “southbridge” provides the bulk of the I/O capabilities for Pi 5. Pi 5 is more friendly and convenient in the development of Internet of Things, Web development, machine identification, automatic control and other electronic equipment applications and network.
  • 【 Faster CPU, Better GPU 】 Pi 5 features a Broadcom BCM2712 64-bit quad-core Arm Cortex-A76 processor running at 2.4GHz, it delivers a 2–3× increase in CPU performance relative to RaspberryPi 4. The 800MHz VideoCore VII GPU is compatible to OpenGL ES 3.1 and Vulkan 1.2, substantial uplift in graphics performance. Pi 5 Offers lightning-fast CPU speed, a PCI Express interface, a Real Time Clock (RTC) and a power button and runs significantly cooler than Pi 4.

The report artifact is missing

Cause: The report directory may not have been produced, its configured path may differ, or the upload step may not have run. Fix: Confirm the HTML reporter is enabled and writes to playwright-report/; verify the artifact path and inspect the workflow step status. The sample’s if: ${{ !cancelled() }} allows upload after failures while skipping a cancelled run.

A pull request fails on a legitimate design change

Cause: The committed baseline still represents the previous design. Fix: Inspect the rendered change, regenerate the affected reference screenshots using the project’s approved process, and submit those baseline changes for review with the UI change.

Or skip the browser setup

For an independent page capture, ScreenshotNeo takes a screenshot with one GET request. This example saves the response as WebP:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots monthly with no card; paid plans start at $5 for 3,000 screenshots.

Learn about ScreenshotNeo or sign up free for 1,000 screenshots a month with no card.

FAQ

Can Playwright tests run on a CI provider other than GitHub Actions?

Yes. Playwright says its tests can run on any CI provider; GitHub Actions is one supported workflow, not a requirement.

Frequently Asked Questions

Can Playwright tests run on a CI provider other than GitHub Actions?

Yes. Playwright says its tests can run on any CI provider; GitHub Actions is one supported workflow, not a requirement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 1
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM); CanaKit Turbine Black Case for the Raspberry Pi 5
$259.95
Bestseller No. 2
CanaKit Raspberry Pi 5 16GB Starter Kit PRO - Turbine Black (128GB Edition) (16GB RAM)
CanaKit Raspberry Pi 5 16GB Starter Kit PRO - Turbine Black (128GB Edition) (16GB RAM)
Includes Raspberry Pi 5 16GB with 2.4Ghz 64-bit quad-core CPU (16GB RAM); CanaKit Turbine Black Case for the Raspberry Pi 5
$419.99
Bestseller No. 3
CanaKit Raspberry Pi 5 Essentials Starter Kit (4GB RAM)
CanaKit Raspberry Pi 5 Essentials Starter Kit (4GB RAM)
CanaKit Raspberry Pi 5 Essentials Starter Kit
$189.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.