Skip to content

GitbookIO/percy-puppeteer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();