-
Notifications
You must be signed in to change notification settings - Fork 3
/
run-tests.js
65 lines (58 loc) · 1.29 KB
/
run-tests.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
61
62
63
64
65
const { codecept: Codecept } = require('codeceptjs');
const cfg = require('config');
const bsServerExit = require('./bs-config')
// define main config
const config = {
tests: './tests/*_test.js',
output: './output',
helpers: {
Puppeteer: {
url: cfg.get('HOST_URL'),
show: false,
windowSize: '1200x900'
},
"ChaiWrapper" : {
"require": "codeceptjs-chai"
},
"ExperimentDetails" : {
"require": "./helpers/ExperimentDetails_helper.js"
}
},
include: {
I: './steps_file.js'
},
bootstrap: null,
mocha: {},
name: 'regression-tests',
plugins: {
pauseOnFail: {},
retryFailedStep: {
enabled: true
},
tryTo: {
enabled: true
},
screenshotOnFail: {
enabled: true
}
}
};
const opts = { steps: true };
// run CodeceptJS inside async function
const codecept = new Codecept(config, opts);
codecept.init(__dirname);
(async () => {
try {
await codecept.bootstrap();
const test = codecept.loadTests('./tests/**_test.js');
// run tests
await codecept.run(test);
} catch (err) {
console.log(err);
process.exitCode = 1;
} finally {
await codecept.teardown();
await bsServerExit();
}
})
();