generated from hmcts/expressjs-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcodecept.conf.js
113 lines (106 loc) · 3.08 KB
/
codecept.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
require('./src/test/end-to-end/helpers/event_listener');
const lodash = require('lodash');
const testConfig = require('./src/test/config.js').config;
exports.config = {
output: './output',
multiple: {
parallel: {
chunks: files => {
const splitFiles = (list, size) => {
const sets = [];
const chunks = list.length / size;
let i = 0;
while (i < chunks) {
sets[i] = list.splice(0, size);
i++;
}
return sets;
};
const buckets = parseInt(process.env.PARALLEL_CHUNKS || '1');
const slowTests = lodash.filter(files, file => file.includes('@slow'));
const otherTests = lodash.difference(files, slowTests);
let chunks = [];
if (buckets > slowTests.length + 1) {
const slowTestChunkSize = 1;
const regularChunkSize = Math.ceil((files.length - slowTests.length) / (buckets - slowTests.length));
chunks = lodash.union(splitFiles(slowTests, slowTestChunkSize), splitFiles(otherTests, regularChunkSize));
} else {
chunks = splitFiles(files, Math.ceil(files.length / buckets));
}
console.log(chunks);
return chunks;
},
},
},
helpers: {
Puppeteer: {
show: process.env.SHOW_BROWSER_WINDOW || false,
waitForTimeout: parseInt(process.env.WAIT_FOR_TIMEOUT || '20000'),
chrome: {
ignoreHTTPSErrors: true,
args: process.env.DISABLE_WEB_SECURITY === 'true' ? ['--disable-web-security'] : [],
devtools: process.env.SHOW_BROWSER_WINDOW || false,
},
windowSize: '1280x960',
},
HooksHelper: {
require: './src/test/end-to-end/helpers/hooks_helper.js',
},
BrowserHelpers: {
require: './src/test/end-to-end/helpers/browser_helper.js',
},
DumpBrowserLogsHelper: {
require: './src/test/end-to-end/helpers/dump_browser_logs_helper.js',
},
StepListener: {
require: './src/test/end-to-end/helpers/stepListener.js',
},
Mochawesome: {
uniqueScreenshotNames: true,
},
},
include: {
config: './src/test/end-to-end/config.js',
I: './src/test/end-to-end/actors/main.js',
},
plugins: {
autoLogin: testConfig.AutoLogin,
retryFailedStep: {
enabled: true,
},
screenshotOnFail: {
enabled: true,
fullPageScreenshots: true,
},
},
tests: './src/test/end-to-end/tests/*_test.js',
teardownAll: require('./src/test/end-to-end/hooks/aggregate-metrics'),
teardown: testConfig.teardown,
mocha: {
reporterOptions: {
'codeceptjs-cli-reporter': {
stdout: '-',
options: {
steps: false,
},
},
'mocha-junit-reporter': {
stdout: '-',
options: {
mochaFile: 'test-results/result.xml',
},
},
mochawesome: {
stdout: '-',
options: {
reportDir: './output',
inlineAssets: true,
json: false,
},
},
'../../src/test/end-to-end/reporters/json-file-reporter/reporter': {
stdout: '-',
},
},
},
};