-
Notifications
You must be signed in to change notification settings - Fork 11
/
karma-saucelabs.conf.js
129 lines (112 loc) · 2.84 KB
/
karma-saucelabs.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
'use strict';
const karmaSauceLauncher = require('karma-sauce-launcher');
const karmaConfig = require('./karma.conf.js');
// Instances of browsers that specs will be splitted(sharded).
// More information here: https://github.com/rschuft/karma-sharding
// We cannot use sharding with Mocha.retries, so we are disabling it temporary.
function shard(browserList, instances) {
return Array.apply(null, { length: instances * browserList.length })
.map(function (e, i) { return browserList[i % browserList.length] });
};
module.exports = function(config) {
karmaConfig(config);
const launchers = [
{
// batch Apple
// Tests in latest safari(11) are disabled. Check the following links:
// https://stackoverflow.com/questions/47522080/selenium-webdriver-safari-11-0-typeerror-value-is-not-a-sequence?rq=1
// https://github.com/karma-runner/karma-sauce-launcher/pull/149
// sl_safari: {
// base: 'SauceLabs',
// browserName: 'safari',
// platform: 'OS X 10.11',
// },
sl_safari_10: {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.11',
version: '10',
},
},
{
// batch Mozilla
sl_firefox: {
base: 'SauceLabs',
browserName: 'firefox',
},
sl_firefox_53: {
base: 'SauceLabs',
browserName: 'firefox',
version: '53',
},
},
{
// batch Microsoft
sl_ie_11: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 8.1',
version: '11',
},
sl_edge: {
base: 'SauceLabs',
browserName: 'microsoftedge',
platform: 'Windows 10',
},
},
{
// batch Google
sl_chrome: {
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Windows 7',
},
sl_android: {
base: 'SauceLabs',
browserName: 'android',
platform: 'Linux',
version: '4.4',
},
},
];
let batch = launchers[process.argv[4] | 0];
let sauceLabsAccessKey = process.env.SAUCE_ACCESS_KEY;
if (!sauceLabsAccessKey) {
sauceLabsAccessKey = process.env.SAUCE_ACCESS_KEY_ENC;
if (sauceLabsAccessKey) {
sauceLabsAccessKey = new Buffer(
sauceLabsAccessKey,
'base64'
).toString('binary');
}
}
config.set({
browsers: Object.keys(batch),
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 2,
// mobile emulators in saucelabs are very slow
browserNoActivityTimeout: 300000,
captureTimeout: 300000,
customLaunchers: batch,
plugins: [
'karma-chai-sinon',
'karma-mocha',
'karma-webpack',
karmaSauceLauncher,
],
reporters: ['dots', 'saucelabs'],
sauceLabs: {
accessKey: sauceLabsAccessKey,
connectOptions: {
port: 4445,
logfile: 'sauce_connect.log',
},
recordScreenshots: false,
recordVideo: false,
startConnect: false,
testName: 'metal-plugins tests',
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER,
username: process.env.SAUCE_USERNAME,
},
});
};