jshmrtn/generator-jm-vuejs

View on GitHub
generators/component/templates/__component__.visual.js

Summary

Maintainability
A
1 hr
Test Coverage
const path = require('path');
const support = require(path.resolve(process.env.PWD, 'test/browser.visual.js'));

let page;
let browser;
const width = 1024;
const height = 768;

beforeAll(async() => {

  const res = await support.openPage(width, height);

  page = res.page;
  browser = res.browser;

  const props = {};

  await page.evaluate(function (props) {
    window.changeComponent('<%= props.componentName %>', props);
  }, props);

});

afterAll(async() => {

  await page.close();
  await browser.close();

});

describe('visual: index', () => {

  it('should have matching image snapshot', async() => {

    const screenshot = await page.screenshot();

    expect(screenshot).toMatchImageSnapshot();

  });

});