npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

mugshot-webdriverio

1.0.0 • Public • Published

Mugshot-WebdriverIO

WebdriverIO adapter for the Mugshot Visual regression testing lib.

Usage

'use strict';
const chai = require('chai');
const expect = require('chai').expect;
const Mugshot = require('mugshot');
const chaiMugshot = require('chai-mugshot');
const webdriverio = require('webdriverio');
const WebdriverIOAdapter = require('mugshot-webdriverio');
 
const BROWSER = {
  desiredCapabilities: {
    browserName: 'chrome'
  }
};
 
describe('Visual test suite'function() {
  let mugshotOptions = {
        acceptFirstBaseline: true
      },
      webdriverioInstance, browser;
 
  before(function(done) {
    webdriverioInstance = webdriverio.remote(BROWSER).init()
        .then(function() {
          browser = new WebdriverIOAdapter(webdriverioInstance);
          done();
        });
  });
 
  it(`should look OK`function() {
    let captureItem = {
      name: 'screenshot'
    };
 
    return webdriverioInstance.url('www.example.com')
        .then(function() {
          let mugshot = new Mugshot(browser, mugshotOptions);
          chai.use(chaiMugshot(mugshot));
          return expect(captureItem).to.be.identical;
        });
  });
 
  after(function() {
    return webdriverioInstance.end();
  });
});

Keywords

none

install

npm i mugshot-webdriverio

Downloadsweekly downloads

63

version

1.0.0

license

MIT

last publish

collaborators

  • avatar
  • avatar
  • avatar
Report a vulnerability