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

To show a Cypress visual-diff PNG in a Mochawesome report, first generate the diff with cypress-image-snapshot (or another visual-diff plugin), then attach the generated file path to the current test with cy.addTestContext() from cypress-mochawesome-reporter. The diff file existing on disk is not enough: its path must be added to the test before the report is rendered, and the image must remain available to the report or be embedded in it.

How the diff gets from Cypress into the report

There are two separate jobs in this workflow. A visual-diff plugin captures a page, compares it with a saved baseline, and writes a difference image. Mochawesome records test results and context. The report will not automatically discover every PNG in your snapshots directory: connect the jobs by adding the diff path to the test that produced it.

  1. Run a visual comparison, such as cypress-image-snapshot‘s image-match command.
  2. Find the diff PNG produced by that run.
  3. While the relevant test is still active, pass its path to cy.addTestContext().
  4. Generate or merge the report, keeping the referenced image available or enabling embedding.

This is distinct from calling cy.screenshot(). A screenshot captures an image; it does not compare that image with a baseline or create a diff. Cypress’s visual-testing guidance also distinguishes capture from comparison and describes hosted visual-testing alternatives.

Set up the direct reporter integration

For Cypress 10 and later, a typical setup registers the Mochawesome reporter plugin in the Cypress configuration and registers both Cypress-side commands in the support file. Confirm that the installed reporter and Cypress versions are compatible: the reporter’s compatibility table changes by major version.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Configure the reporter

// cypress.config.js
const { defineConfig } = require('cypress');

module.exports = defineConfig({
  reporter: 'cypress-mochawesome-reporter',
  reporterOptions: {
    embeddedScreenshots: true,
    inlineAssets: true
  },
  e2e: {
    setupNodeEvents(on, config) {
      require('cypress-mochawesome-reporter/plugin')(on);
      return config;
    }
  }
});

embeddedScreenshots: true tells the reporter to embed external screenshots into the HTML using base64. inlineAssets: true can be used when you want a single HTML file rather than an HTML report that relies on separate assets. The reporter is described by its README as a zero-configuration Mochawesome reporter for Cypress with screenshots attached to tests; manually adding a diff path is still the key step for this generated image.

Register commands in the support file

// cypress/support/e2e.js
import 'cypress-mochawesome-reporter/register';
import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command';

addMatchImageSnapshotCommand();

Keep the support-file imports in the file Cypress actually loads for the relevant test type. If your project uses a different support-file path or module format, apply the same registrations there using the syntax your project already uses.

Generate the diff, then attach its path

cypress-image-snapshot compares a new screenshot with a saved baseline and writes the resulting diff under cypress/snapshots/__diff_output__ by default. The exact filename depends on the test and plugin version. Do not assume a remembered filename is correct; confirm the path from the run output or the plugin configuration, especially if the project sets a custom diff directory.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
// In the test, after the image-match command has produced the diff:
cy.addTestContext({
  title: 'Image snapshot diff',
  value: 'cypress/snapshots/__diff_output__/login.png'
});

The filename above is an example of the default directory structure, not a guaranteed output name. Replace it with the actual path for that run. Attach the context after the visual comparison command so the diff has been produced, and before the test’s results are written out. The reporter API takes the title and value in the context object; the value should identify the image file you intend to include.

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

Make the path valid where the report is built and viewed

A path that works on a developer’s machine can fail in CI if it points into a temporary runner directory or if the file is discarded before report generation. Ensure the artifact is still present in the workspace at the time Mochawesome processes the test context. If the HTML will be opened without its image files, enable embedded screenshots. If it must be distributed as one standalone HTML file, enable inline assets as well.

Use plain Mochawesome when you need a merge pipeline

If the project uses the plain mochawesome reporter instead of cypress-mochawesome-reporter, Cypress’s reporter guidance shows emitting JSON per run and then merging and rendering it. Configure the reporter in the Cypress configuration:

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.
reporter: 'mochawesome',
reporterOptions: {
  reportDir: 'cypress/results',
  overwrite: false,
  html: false,
  json: true
}

Run the specs so they produce JSON files, merge those files, then render the HTML:

npx mochawesome-merge cypress/results/*.json -o mochawesome.json
npx marge mochawesome.json

The test context containing the diff reference needs to be in the JSON before the merge and render steps. If the context is absent from the per-spec results, the merged HTML cannot recover the reference merely because the PNG exists in the workspace. When specs run separately, overwrite: false preserves each run’s JSON for the merge rather than replacing earlier output.

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.

Choose the report workflow that matches your CI

Approach Attachment and report behavior Good fit Trade-off to plan for
cypress-mochawesome-reporter Attach test context with cy.addTestContext(); reporter options support embedding screenshots and inlining assets. Projects that want Cypress screenshots and manually attached context in a direct reporter workflow. Diff output paths still need to be valid at report-generation time, and reporter compatibility depends on installed versions.
Plain Mochawesome plus merge and render Write per-run JSON, merge it with mochawesome-merge, then render with marge. CI jobs that produce separate results for specs and need an explicit merge stage. Context must survive in the JSON inputs, and referenced images must be retained or embedded for later viewing.
Hosted visual testing Hosted integrations can centralize screenshot and diff review. Teams that want centralized review rather than only locally generated report artifacts. This changes retention, access, and cost characteristics; confirm those terms for the service selected.

The first choice is usually the shortest path when the report itself is the destination. A JSON merge pipeline is useful when independently run specs must become one report. Hosted review is a separate operating model, not just another way to attach a local PNG; decide based on where results need to live and who must be able to access them.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Troubleshoot a diff that is missing from Mochawesome

The diff PNG was never created

Check the visual-diff command’s run output and look in the configured diff directory. The default for cypress-image-snapshot is a sibling __diff_output__ directory under cypress/snapshots; a custom customDiffDir changes that location. If no file exists, solve the comparison or plugin setup first. Adding a context entry cannot create a diff image.

The report shows a broken image or no image

  • Check that the context value points to the actual generated file, not a guessed test-name filename.
  • Check that the path resolves in the CI workspace during report generation and remains available with the published artifact.
  • Enable embeddedScreenshots: true when readers will not have the original image files beside the report.
  • For a single standalone HTML artifact, use inlineAssets: true as well.

The diff exists but the merged report omits it

Inspect the per-spec JSON before merging. The context attachment must already be present there; then run mochawesome-merge and marge. In a multi-spec job, preserve the JSON outputs from each run instead of overwriting them, and do not remove image files before the final report is created.

The capture appears, but there is no comparison image

cy.screenshot() alone is not a visual-diff operation. Register and run a comparison command such as the one provided by cypress-image-snapshot, then attach the generated diff. If the comparison is configured to write to a custom directory, use that directory when locating the file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

The setup fails after a dependency upgrade

Check the reporter’s published compatibility table against the Cypress and Node versions installed in the project. Compatibility varies by reporter major version, so do not infer that a setup working with one major release will work unchanged after an upgrade. Re-run one representative spec and verify the diff, context in the result, and final HTML as separate checkpoints.

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

Performance, artifact reliability, and cost

The described documentation does not establish a universal runtime cost, reliability percentage, or storage duration for this workflow, so those figures should not be assumed. Operationally, the report is only as portable as its referenced assets: embedding reduces dependence on a neighboring image directory but makes the HTML carry base64 image data; keeping external images separate avoids that embedding but requires the files to travel with the report. In CI, retain the diff files through the merge/render stage and publish them with the report unless they have been embedded.

For a stable pipeline, treat comparison output, test context, JSON merge, HTML render, and artifact publishing as distinct steps. A failure at any link can make the image unavailable even when Cypress itself completed the test. Validate the final published artifact, not only a report opened inside the original runner workspace.

When an API screenshot is useful instead

ScreenshotNeo is a screenshot API and MCP server, not a Cypress visual-diff engine or a Mochawesome attachment mechanism. It can be useful when your need is to obtain a website screenshot without setting up a browser capture in your own code; it does not replace the Cypress comparison-and-context steps above when the requirement is a diff image inside a test report.

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

Or skip the browser setup

For a standalone website capture, one GET request returns an image or PDF. The example below saves a WebP screenshot of Stripe; see the ScreenshotNeo API documentation for request options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and each response says which outcome occurred in X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients.

The free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is on every plan. ScreenshotNeo is made by Yorker Media. Learn more at ScreenshotNeo, or sign up free for 1,000 screenshots a month with no card.

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.

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