generators/app/templates/src/components/index/index.visual.js
// eslint-globals pageconst 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(); }); Identical blocks of code found in 2 locations. Consider refactoring.describe('visual: index', () => { it('should have matching image snapshot', async() => { const screenshot = await page.screenshot(); expect(screenshot).toMatchImageSnapshot(); }); });