GitHub

Visual Diff Viewer

Inspect visual regression failures with four interactive view modes: Slider, 2-Up, Diff Overlay, and Onion Skin.

A specialized component for inspecting visual regression test failures. When a test includes visual comparison artifacts (snapshots comparing expected vs actual screen captures), Zen Reports for Playwright embeds the Visual Diff Viewer inside the test case detail.

Visual regression comparison embedded in a test case detail
The visual regression comparison in the expanded test case detail.

Overview

The viewer displays the comparison target name and provides an interactive inspection canvas with four view modes to pinpoint pixel shifts and rendering regressions.

Visual Diff Viewer view mode toolbar
The four view modes in the viewer toolbar.

View Modes

Switch between view modes using the toolbar selector or keyboard shortcuts:

Mode Key Behavior
Slider 1 An interactive before/after split slider allowing you to drag the divider horizontally to reveal expected vs actual images.
2-Up (Side by Side) 2 Displays the expected baseline image and actual test snapshot side by side with synchronized dimensions.
Diff Overlay 3 Highlights mismatching pixels. If Playwright generated an image diff artifact (diffUrl), it renders the diff; otherwise, it applies CSS difference blend modes.
Onion Skin 4 Overlays actual and expected images with an adjustable transparency opacity slider to spot subtle layout shifts.
2-Up side-by-side view of expected and actual screenshots
2-Up mode: expected baseline and actual snapshot side by side.
Diff Overlay view highlighting mismatching pixels
Diff Overlay: mismatching pixels highlighted.
Onion Skin view with the transparency slider
Onion Skin: expected and actual overlaid at adjustable opacity.

Controls & Keyboard Shortcuts

  • 1 – Switch to Slider mode.
  • 2 – Switch to 2-Up (Side by Side) mode.
  • 3 – Switch to Diff Overlay mode (available when diff image or CSS blend mode is applicable).
  • 4 – Switch to Onion Skin mode.
  • Esc – Close the visual diff viewer modal.

  • Opening visual regression comparisons from test cases: see the Suites tab.
  • Inspecting other test artifacts (logs, videos, screenshots): see Attachments & Preview.