Giter Club home page Giter Club logo

puppeteer-eyes.it's Introduction

puppeteer-eyes.it

Build Status

Automatic screenshot comparison using Puppeteer, Jest and Applitools Eyes.

Getting started

  npm i --save-dev puppeteer-eyes.it

Setup

  1. Add Puppeteer's page on global (if you are using jest-puppeteer you already have it on global)

  2. Require puppeteer-eyes.it:

      const eyes = require('puppeteer-eyes.it');
  3. Add your Applitools' eyes key to APPLITOOLS_API_KEY env variable:

    CI

    Travis: go to your build's options -> settings -> Environment Variables and add APPLITOOLS_API_KEY + your key

    locally

    add an .env file, with:

      APPLITOOLS_API_KEY=<your key here>
    
    • this step is not mandatory - you should use it if you want to use eyes when running locally.
    • you should put your .env file in git ignore!!!

    Key name change EYES_API_KEY is being replaced with APPLITOOLS_API_KEY. For now, we support both of them.

  4. Change your test to use eyes.it or eyes.test instead of it or test

Change screenshot baseline

In order to have a new screenshot baseline you can pass a version to your test:

eyes.it('test description', async () => {
    // test goes here
}, {version: '1.0.1'});

Default version is '1.0.0'

How does it work

puppeteer-eyes.it automatically takes a screenshot at the end of your test and sends it to Applitools eyes. When Eyes detects a diff in the screenshot, your build will fail and you will have a link to Applitools site with the visual diff of the screenshot.

Example

  const puppeteer = require('puppeteer');
  const eyes = require('puppeteer-eyes.it');
  let page;
  beforeAll(async () => {
    const browser = await puppeteer.launch();
    page = global.page = await browser.newPage();
  });
  afterAll(() => browser.close());
  eyes.it('test description', async () => {
    await page.goto('http://www.wix.com');
    expect(await page.title()).toEqual('Free Website Builder | Create a Free Website | Wix.com');
  });

puppeteer-eyes.it's People

Contributors

ohana54 avatar yanivefraim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppeteer-eyes.it's Issues

feature: make a different key for ci/local

different environments produce different results (see this issue.

In order to be able to work with eyes locally (not mandatory, but can be a nice option), we can append a 'ci' / 'local' to image keys. This way local runs (assuming all run on the same environment) should work fine (we have to test that this is actually working)

Feature Request: eyes.checkWindow()

Similar to the Applitools tutorials for Selenium, Cypress, etc.

Would it be possible to add a checkWindow method to manually trigger the screenshot diffing at different points throughout a test?

This would be extremely useful as it would allow us to verify intermediate states in our tests without restructuring the tests themselves.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.