-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Install backstopjs and git lfs for visual regression testing
- Loading branch information
1 parent
4a180fc
commit fe19dc2
Showing
7 changed files
with
372 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
backstop_data/bitmaps_reference/*.png filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module.exports = { | ||
id: 'ds-vr-test', | ||
viewports: [ | ||
{ | ||
name: 'desktop', | ||
width: 1920, | ||
height: 1080, | ||
}, | ||
{ | ||
name: 'tablet', | ||
width: 768, | ||
height: 1024, | ||
}, | ||
{ | ||
name: 'mobile', | ||
width: 375, | ||
height: 667, | ||
}, | ||
], | ||
scenarios: [], | ||
paths: { | ||
bitmaps_reference: 'backstop_data/bitmaps_reference', | ||
bitmaps_test: 'backstop_data/bitmaps_test', | ||
engine_scripts: 'backstop_data/engine_scripts', | ||
html_report: 'backstop_data/html_report', | ||
ci_report: 'backstop_data/ci_report', | ||
}, | ||
engine: 'puppeteer', | ||
engineOptions: { | ||
args: ['--no-sandbox'], | ||
}, | ||
report: process.env.RUNNING_IN_CI === 'true' ? [] : ['browser'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const fs = require('fs'); | ||
const util = require('util'); | ||
const glob = require('glob'); | ||
|
||
const globUtil = util.promisify(glob); | ||
const readdir = util.promisify(fs.readdir); | ||
|
||
const port = process.env.TEST_PORT_NUMBER || 3010; | ||
const testURL = `http://localhost:${port}`; | ||
|
||
export default async () => { | ||
let urls = []; | ||
const directories = [ | ||
{ | ||
path: './src/components', | ||
}, | ||
{ | ||
path: './src/patterns', | ||
}, | ||
{ | ||
path: './src/foundations', | ||
}, | ||
]; | ||
for (const directory of directories) { | ||
const folders = await readdir(directory.path); | ||
for (const folder of folders) { | ||
const files = await globUtil(`${directory.path}/${folder}/**/example-*.njk`); | ||
for (const file of files) { | ||
const urlPath = file.replace(/^\.\/src\/(.*\/example-.*?)\.njk$/, '/$1'); | ||
urls.push({ url: `${testURL}${urlPath}`, label: urlPath, delay: 1000 }); | ||
} | ||
} | ||
} | ||
return urls; | ||
}; |
Oops, something went wrong.