generated from hmcts/ccd-client
-
Notifications
You must be signed in to change notification settings - Fork 1
/
crossBrowsers
98 lines (90 loc) · 2.67 KB
/
crossBrowsers
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
/* eslint-disable no-process-env */
const config = require('config');
const supportedBrowsers = require('./test/e2e/crossbrowsers/supportedBrowsers');
const evidenceUploadEnabled = config.get('optionalFeature.evidenceUpload.enabled');
const defaultSauceOptions = {
username: process.env.SAUCE_USERNAME || config.get('saucelabs.username'),
accessKey: process.env.SAUCE_ACCESS_KEY || config.get('saucelabs.key'),
acceptSslCerts: true,
tags: ['ET'],
};
function merge(intoObject, fromObject) {
return Object.assign({}, intoObject, fromObject);
}
function getBrowserConfig(browserGroup) {
const browserConfig = [];
for (const candidateBrowser in supportedBrowsers[browserGroup]) {
if (candidateBrowser) {
const candidateCapabilities = supportedBrowsers[browserGroup][candidateBrowser];
candidateCapabilities['sauce:options'] = merge(defaultSauceOptions, candidateCapabilities['sauce:options']);
browserConfig.push({
browser: candidateCapabilities.browserName,
capabilities: candidateCapabilities,
});
} else {
console.error('ERROR: supportedBrowsers is empty or incorrectly defined');
}
}
return browserConfig;
}
const setupConfig = {
tests: './test/*_test.js',
output: config.get('saucelabs.outputDir'),
features: {
evidenceUpload: {
enabled: evidenceUploadEnabled,
},
},
helpers: {
WebDriver: {
url: process.env.TEST_URL || config.get('e2e.frontendUrl'),
browser: process.env.SAUCE_BROWSER || config.get('saucelabs.browser'),
smartWait: parseInt(config.get('saucelabs.smartWait')),
cssSelectorsEnabled: 'true',
host: 'ondemand.eu-central-1.saucelabs.com',
port: 80,
region: 'eu',
capabilities: {},
},
MyHelper: {
require: './helpers/helper.js',
url: config.get('e2e.frontendUrl'),
},
SauceLabsReportingHelper: { require: './helpers/SauceLabsReportingHelper.js' },
},
include: {
I: './steps_file.js',
},
mocha: {
reporterOptions: {
'codeceptjs-cli-reporter': {
stdout: '-',
options: { steps: true },
},
mochawesome: {
stdout: './e2e-output/console.log',
options: {
reportDir: config.get('saucelabs.outputDir'),
reportName: 'index',
inlineAssets: true,
},
},
},
},
multiple: {
chrome: {
browsers: getBrowserConfig('chrome'),
},
firefox: {
browsers: getBrowserConfig('firefox'),
},
safari: {
browsers: getBrowserConfig('safari'),
},
// edge: {
// browsers: getBrowserConfig('edge'),
// },
},
name: 'Employment Tribunal Crossbrowser Tests',
};
exports.config = setupConfig;