-
Notifications
You must be signed in to change notification settings - Fork 439
Expand file tree
/
Copy pathwdio.sauce.conf.js
More file actions
130 lines (106 loc) · 3.39 KB
/
wdio.sauce.conf.js
File metadata and controls
130 lines (106 loc) · 3.39 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
* Copyright (c) 2018, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
const path = require('path');
const merge = require('deepmerge');
const minimist = require('minimist');
require('dotenv').config({
path: path.resolve(__dirname, '../.env'),
});
const baseConfig = require('./wdio.conf.js');
// #TODO[3754]: Only Chrome and Edge on Windows platform currently works, all other browser tests fail.
// Need to investigate why sauce labs fails for all other platforms.
const browsers = [
// Note that headless Chrome also needs to be updated in wdio.conf.js for non-SauceLabs runs
{
commonName: 'chrome',
browserName: 'chrome',
version: 'latest',
// Note chrome fails for Linux and macOS
platform: 'Windows 11',
},
{
commonName: 'edge',
browserName: 'MicrosoftEdge',
version: 'latest',
platform: 'Windows 11',
},
{
commonName: 'safari',
browserName: 'safari',
version: 'latest',
// Note safari fails for macOS
platform: 'macOS 13',
},
{
commonName: 'firefox',
browserName: 'firefox',
version: 'latest',
// Note firefox is failing for both Linux and Windows 11
platform: 'Windows 11',
},
];
const mode = process.env.MODE;
const region = process.env.SAUCE_REGION || 'us';
const username = process.env.SAUCE_USERNAME;
if (!username) {
throw new TypeError('Missing SAUCE_USERNAME environment variable');
}
const accessKey = process.env.SAUCE_ACCESS_KEY || process.env.SAUCE_KEY;
if (!accessKey) {
throw new TypeError('Missing SAUCE_ACCESS_KEY or SAUCE_KEY environment variable');
}
const tunnelId = process.env.SAUCE_TUNNEL_ID;
const buildId = process.env.GITHUB_RUN_ID || Date.now();
const name = ['integration-test', mode].join(' - ');
const build = ['integration-test', buildId, mode].join(' - ');
const tags = [mode];
const customData = {
ci: !!process.env.CI,
buildId,
};
function getCapabilities() {
let filtered = browsers;
const args = minimist(process.argv.slice(2));
const userBrowsers = args.browsers;
if (userBrowsers) {
filtered = filtered.filter((b) => {
return userBrowsers.includes(b.commonName);
});
if (filtered.length === 0) {
throw new Error(
'No target browsers after filtering for the following browsers: ' + userBrowsers
);
}
}
return filtered.map((capability) => {
return {
...capability,
tunnelIdentifier: tunnelId,
name,
build,
tags,
customData,
};
});
}
exports.config = merge(baseConfig.config, {
region,
user: username,
key: accessKey,
capabilities: getCapabilities(),
maxInstances: 3,
// Specifies globally the timeout for all the `waitFor*` defined by wdio.
// https://webdriver.io/docs/timeouts.html#webdriverio-related-timeouts
waitforTimeout: 20 * 1000, // 20 seconds
connectionRetryTimeout: 2 * 60 * 1000, // 2 minutes
connectionRetryCount: 5,
mochaOpts: {
// Specify test timeout threshold time enforced by mocha.
// https://mochajs.org/#-timeout-ms-t-ms
timeout: 30 * 1000, // 30 seconds
},
});