WEBINARLive webinar: Buddy MCP, Sept 15th.Buddy MCP: read the logs, find the bug, ship the fix. Live on September 15th.Save your seat

Puppeteer

View as Markdown

This guide shows how to add Buddy Visual Tests to your existing Puppeteer scripts running on headless Chrome. Snapshots taken in your scripts are uploaded on every run and compared against the approved baseline.

Buddy Visual Tests - Every UI change, reviewed before merge | Product Hunt

Prerequisites

  • bdy CLI installed (requires Node.js v20+)
  • Suite token exported as BUDDY_VT_TOKEN - copy it from the suite settings (in Buddy pipelines the token is set automatically)

Install the plugin

bash
npm i @buddy-works/visual-tests-puppeteer $

Requires Puppeteer v23.10.0 or higher.

Configure your scripts

Import the takeSnap function and call it on the pages you visit:

javascript
import { takeSnap } from '@buddy-works/visual-tests-puppeteer'; import puppeteer from 'puppeteer'; const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto('https://localhost:3000/'); await takeSnap(page, 'homepage'); await browser.close();

Run the scripts

Wrap your usual command with the CLI to create a visual test session:

bash
bdy tests visual session create "node test.js" $

When the run finishes, the session appears in the suite with all captured snapshots rendered across the browsers and devices configured in the suite settings. See Reviewing & Approvals for the next step.

Let AI do it

If you use an AI coding agent, paste this prompt to have it wire up visual tests in your existing scripts:

prompt
Add Buddy Visual Tests to my Puppeteer scripts: 1. Check that the `bdy` CLI is available - run `bdy --version`. If it is missing, install it with `npm i -g bdy`. 2. Install @buddy-works/visual-tests-puppeteer as a dev dependency (requires Puppeteer >= 23.10.0). 3. Import the snapshot helper in each script: import { takeSnap } from '@buddy-works/visual-tests-puppeteer'; 4. After each meaningful, stable UI state, take a snapshot of the page: await takeSnap(page, '<descriptive-snapshot-name>'); 5. Use kebab-case snapshot names; group related views with "/" (e.g. "checkout/step-1"). 6. Do not change any script logic. The scripts will be executed with: bdy tests visual session create "node test.js"

Last modified on Aug 25, 2026