jshmrtn/generator-jm-vuejs

View on GitHub
generators/app/templates/src/components/index/index.visual.js

Summary

Maintainability
A
1 hr
Test Coverage
// eslint-globals page
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 = {
    title: 'Index Title',
  };

  await page.evaluate(function (props) {
    window.changeComponent('index', 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();

  });

});