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

Use Puppeteer to capture the pages you want to test, then point reg-suit’s core.actualDir at the directory containing those screenshots. Run the capture script first and npx reg-suit run second. Puppeteer creates the actual images; reg-suit identifies the baseline, compares images, and produces a report.

How the Puppeteer and reg-suit handoff works

The tools have separate responsibilities. Your Puppeteer script opens a page and saves screenshot files. reg-suit reads those files from core.actualDir, uses configured key-generation and publisher plugins to locate or store expected snapshots, compares the actual images with the baseline, and builds an HTML report. The directory path is the connection between the two tools.

The official reg-puppeteer-demo illustrates this workflow. Its sample output directory is named screenshot; you can choose another directory as long as the script and reg-suit configuration use the same path.

Capture screenshots with Puppeteer

Install Puppeteer and a directory-creation helper as development dependencies. The following CommonJS example captures a local HTML file to screenshot/home.png; change the URL, viewport, output path, and readiness check to match your application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
npm install --save-dev puppeteer mkdirp
const puppeteer = require('puppeteer');
const mkdirp = require('mkdirp');
const path = require('path');

async function main() {
  const outputDir = path.resolve(__dirname, 'screenshot');
  await mkdirp(outputDir);

  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.setViewport({ width: 1280, height: 800 });
    await page.goto('http://localhost:3000/', { waitUntil: 'networkidle0' });
    await page.screenshot({
      path: path.join(outputDir, 'home.png'),
      fullPage: true
    });
  } finally {
    await browser.close();
  }
}

main().catch(error => {
  console.error(error);
  process.exitCode = 1;
});

Save it as capture.js and run it only after the application is available at the target URL. Use a readiness condition that reflects your app rather than relying on a fixed sleep. For example, if a page has a reliable element that appears when rendering is complete, wait for that selector before capturing:

await page.goto('http://localhost:3000/', { waitUntil: 'domcontentloaded' });
await page.waitForSelector('[data-test="page-ready"]');

A stable visual-regression capture also needs consistent input data, viewport dimensions, and page state. Animations, timestamps, randomized content, or data that changes between runs can create image differences unrelated to the code change.

Install and configure reg-suit

Install reg-suit and the plugins you plan to use, then initialize its configuration with npx reg-suit init, or edit regconfig.json directly. The sample configuration below shows the directory handoff and an S3 publisher. It is an illustrative configuration shape, not a guarantee that every plugin version accepts identical settings; consult the README for the installed plugin version.

npm install --save-dev reg-suit reg-keygen-git-hash-plugin reg-publish-s3-plugin
{
  "core": {
    "workingDir": ".reg",
    "actualDir": "screenshot",
    "thresholdRate": 0.05
  },
  "plugins": {
    "reg-keygen-git-hash-plugin": {},
    "reg-publish-s3-plugin": {
      "bucketName": "your-aws-s3-bucket"
    }
  }
}

reg-suit’s actualDir is required. Its workingDir defaults to .reg. You can set a comparison threshold using thresholdRate, a rate from 0 to 1, or use thresholdPixel as an absolute-pixel alternative. The documented default for comparison thresholds is zero. concurrency defaults to 4. Plugin configuration belongs under plugins, with each plugin package name as a key and its settings as the value. See the official reg-suit README and CLI/config reference for supported fields and plugin options.

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

Choose keying and snapshot storage

The key-generator determines how reg-suit identifies a revision’s snapshots, while the publisher determines where expected images and reports are retrieved or published. The reg-suit project lists Git-hash and simple key generators, as well as S3 and Google Cloud Storage publisher options. Select plugins that match your repository and storage setup, and follow each installed plugin’s documentation for credentials and required fields.

Set comparison sensitivity deliberately

A zero threshold is strict: small rendering differences can produce reported changes. Raising the allowed difference can reduce noise, but may also conceal small genuine visual changes. Pick a threshold based on your project’s tolerance and review the generated report rather than assuming a permissive value is harmless.

Run the workflow locally and in CI

  1. Start the application or otherwise make the target page available.
  2. Run node capture.js and confirm that the expected PNG files are present in screenshot.
  3. Run npx reg-suit run. The CLI workflow syncs expected snapshots, compares them, publishes results, and can notify through installed plugins.
  4. Review the generated HTML report. On the first run of the demonstration workflow, images are reported as new because there is no expected baseline yet; subsequent runs compare against published snapshots.

In CI, order the job so that application startup and screenshot capture complete successfully before reg-suit runs. If the chosen key-generator depends on Git history or branch relationships, check out enough history and branch information for it to work. Provide cloud credentials to the job through your CI system’s secure mechanism rather than committing secrets in configuration.

Keep the Node runtime, Puppeteer version, downloaded or system browser, CI image, and reg-suit plugins compatible. The demo repository’s printed initialization output identifies reg-suit 0.6.1 and its CI sample uses Node 8 with CircleCI 2 syntax; treat these as historical examples, not current setup recommendations. In reg-suit v0.13.0, the release notes say the S3 publisher switched to @aws-sdk/client-s3 and removed the prepare option that created an S3 bucket. Verify current plugin and runtime requirements instead of copying old CI YAML or setup prompts.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Keep Puppeteer configuration separate

Puppeteer configuration is not reg-suit configuration: a Puppeteer config file does not replace regconfig.json. Puppeteer documents filenames including .puppeteerrc.json, .puppeteerrc.js, puppeteer.config.js, and settings in package.json. Its documentation says Puppeteer downloads a specific Chrome version by default and supports specifying another executable path. For modified browser download settings, it gives npx puppeteer browsers install as the command to apply installation configuration.

The Puppeteer guide also notes that Puppeteer configuration files and environment variables are ignored by puppeteer-core. Check the Puppeteer configuration guide if you use that package or need to adjust browser installation.

Troubleshooting common failures

  • reg-suit finds no actual images: Check that the capture script ran successfully, that it wrote files to the expected location, and that core.actualDir matches that directory relative to the project’s working context.
  • The page screenshot is blank or incomplete: Confirm the target server is running and the URL is correct. Replace arbitrary delays with a readiness condition for the application, and check whether asynchronous content has finished rendering before capture.
  • Every run reports visual changes: Compare viewport settings, input data, and page state between runs. Stabilize timestamps, animation, randomized content, or other changing UI elements before weakening the comparison threshold.
  • The CI key or baseline cannot be resolved: Check the selected key-generator and publisher configuration. For a Git-graph-based key generator, ensure the CI checkout includes the relevant history and branch information, and verify storage credentials are available to the job.
  • Browser launch fails in a container: Check the installed browser and runtime requirements for the Puppeteer version in use, and verify the executable path if using a system browser. The older demo includes --no-sandbox and --disable-setuid-sandbox; that historical sample is not a universal recommendation. Decide any sandbox change in light of the security model of your CI environment.
  • An old setup prompt or plugin option no longer works: Confirm the installed reg-suit and plugin versions and use their current documentation. The S3 plugin behavior changed in the v0.13.0 release.

Or skip the browser setup

If you need screenshots as inputs but do not want to manage a browser capture script, ScreenshotNeo is a screenshot API and MCP server for developers. A request can return PNG, JPEG, WebP, or PDF; you would still need to arrange how those outputs become reg-suit actual images and choose reg-suit’s own keying and publisher plugins.

For example, save a screenshot of your application route to a file:

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://your-app.example/ -o shot.webp

See the ScreenshotNeo API documentation for request options. Cookie and consent banners, newsletter popups, and chat widgets are removed before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for the free plan.

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.