/percy-puppeteer

Percy.io integration with Google Puppeteer

Primary LanguageJavaScript

percy-puppeteer

Percy integration for Google Puppeteer.

Install

$ npm install puppeteer percy-puppeteer --dev

Usage

import puppeteer from 'puppeteer';
import { PuppeteerPercy, FileSystemAssetLoader } from 'percy-puppeteer';

// Create a percy client
const percy = new PuppeteerPercy({
    loaders: [
        new FileSystemAssetLoader({
            buildDir: './some-local-folder',
            mountPath: '/public/'
        })
    ]
});

// Start a build
await percy.startBuild();


// Do some stuffs with puppeteer
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com');

// Take a screemshot
await percy.takeScreenshot('First Screenshot', page);

// Push the result to Percy
await percy.finalizeBuild();