0.1.0 • Published 9 months ago

@buddy-works/puppeteer v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

Puppeteer Snapshots

A Puppeteer plugin for performing visual testing using Buddy Works Visual Testing. This plugin allows automatic capturing of website snapshots across different screen resolutions and comparing them with reference versions to detect visual regressions.

Requirements

  • Node.js >= 20
  • Puppeteer >= 23.10.0

Installation

npm install @buddy-works/puppeteer

Usage

import { takeSnap } from '@buddy/puppeteer-visual-plugin';
import puppeteer from 'puppeteer';

async function run() {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  
  await page.goto('https://buddy.works/blog');
  await takeSnap(page, 'example-homepage');
  
  await browser.close();
}

run();

Examples

Example usage of the plugin can be found in the examples/ directory:

# Install dependencies
pnpm i
# Build plugin
pnpm run build
# Go to examples folder
cd examples
# Install examples dependencies
pnpm i
# Add enviroment variables with token
export BUDDY_VT_TOKEN=****
# Run an example
pnpm run test

License

MIT

0.1.0

9 months ago