This repository has been archived by the owner on Feb 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwdio.docker.conf.js
60 lines (54 loc) · 1.6 KB
/
wdio.docker.conf.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
60
const path = require("path"),
VisualRegressionCompare = require("wdio-visual-regression-service/compare");
const config = require("./wdio.conf").config;
/**
* Gets the full, absolute path of a screenshot folder
* @param {string} folder The name of the sub folder in which to save screenshots
*/
const getScreenshotPath = (folder) => {
return (context) => {
const basePath = path.join(__dirname, "screenshots", folder),
browserWidth = context.meta.viewport.width,
browserHeight = context.meta.viewport.height,
browserVersion = parseInt(/\d+/.exec(context.browser.version)[0]),
browserNameVersion = `${ context.browser.name }_v${browserVersion}`;
const fileName = [
context.test.title,
browserNameVersion,
`${browserWidth}x${browserHeight}`
].join("_") + ".png";
return path.join(basePath, browserNameVersion, `${browserWidth}x${browserHeight}`, fileName);
};
};
const configOverrides = {
specs: [
"./test/functional/**/*.js",
"./test/visual/**/*.js"
],
capabilities: [
{
maxInstances: 5,
browserName: "chrome",
resolution: "1360x1020",
chromeOptions: {
args: ["--headless", "--window-size=1360,1020"]
}
},
{
maxInstances: 5,
browserName: "firefox",
resolution: "1360x1020"
}
],
plugins: { "wdio-screenshot":{}},
services: ["visual-regression"],
visualRegression: {
compare: new VisualRegressionCompare.LocalCompare({
referenceName: getScreenshotPath("reference"),
screenshotName: getScreenshotPath("taken"),
diffName: getScreenshotPath("diff"),
misMatchTolerance: 0.01,
})
}
};
exports.config = Object.assign({}, config, configOverrides);