-
Notifications
You must be signed in to change notification settings - Fork 0
/
runner.js
50 lines (47 loc) · 1.34 KB
/
runner.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
(async () => {
const createTestCafe = require("testcafe");
const testcafe = await createTestCafe();
const { exec } = require("child_process");
const args = require("minimist")(process.argv.slice(2));
const customTest = args.customTest;
const browser = args.headless
? "chrome:headless --window-size=1680,1050"
: "chrome --window-size=1680,1050";
try {
const runner = testcafe
.createRunner()
.src(`tests/*.js`)
.browsers(browser)
.reporter(["spec", "allure-expanded"])
.screenshots({
path: "Screenshots",
takeOnFails: true,
pathPattern:
"${DATE}_${TIME}/${TEST}/${USERAGENT}/${QUARANTINE_ATTEMPT}.png",
})
.video("Videos", {
singleFile: false,
failedOnly: false,
pathPattern: "${DATE}_${TIME}/${TEST}/${USERAGENT}/${FILE_INDEX}.mp4",
});
runner.filter(
async (testName, fixtureName, fixturePath, testMeta, fixtureMeta) => {
if (customTest) {
return testMeta.customTest === customTest;
} else {
return true;
}
}
);
await runner.run({
skipJsErrors: true,
skipUncaughtErrors: true,
disableMultipleWindows: true,
disableDevShmUsage: true,
});
} catch (err) {
console.log("Error:", err);
} finally {
await testcafe.close();
}
})();