forked from web-illinois/toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackstop.config.js
59 lines (56 loc) · 1.59 KB
/
backstop.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const glob = require('fast-glob');
const path = require('path');
const util = require('./tests/tests.util');
const viewports = require('./viewports.json');
function makeId(file, config) {
const relativePath = path.relative('tests', file);
let id = relativePath.replace(/\.vis\.js$/, '').replace(/[\\\/]/g, '_');
if (config.test) {
id += '_' + config.test;
}
else if (config.variant) {
id += '_' + config.variant;
}
else if (config.suffix) {
id += '_' + config.suffix;
}
return id;
}
const scenarios = [];
glob.sync('tests/**/*.vis.js').forEach(file => {
const filePath = path.join(__dirname, file);
const fileScenarios = require(filePath)(viewports);
fileScenarios.forEach(s => {
const id = makeId(file, s);
s.file = file;
if (!s.url) {
s.url = util.testUrl(filePath);
}
if (!s.label) {
s.label = id;
}
});
scenarios.push(...fileScenarios);
})
module.exports = {
id: "web-toolkit",
//fileNameTemplate: '{scenarioLabel}_{viewportLabel}',
viewports: Object.values(viewports),
scenarios: scenarios,
paths: {
bitmaps_reference: "tests/_reference",
engine_scripts: "tests/_scripts",
bitmaps_test: "var/backstop/images",
html_report: "var/backstop/html",
},
report: ["browser"],
engine: "puppeteer",
engineOptions: {
args: ["--no-sandbox"]
},
onReadyScript: "onReady.js",
asyncCaptureLimit: 5,
dockerCommandTemplate: "docker run -e BACKSTOP_ENV=docker --rm -it --mount type=bind,source=\"{cwd}\",target=/src backstopjs/backstopjs:{version} {backstopCommand} {args}",
debugWindow: false,
debug: false
};