-
Notifications
You must be signed in to change notification settings - Fork 213
/
Runner.js
72 lines (63 loc) · 2.07 KB
/
Runner.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
const CapabilityRunner = require("./CapabilityRunner");
const sauceConnectLauncher = require('sauce-connect-launcher');
const username = process.env.SAUCE_USERNAME; //JSON-Patch repo uses "json-patch" user which is a subaccount of the Starcounter SauceLabs account
const accessKey = process.env.SAUCE_ACCESS_KEY;
const tunnelIdentifier = "tunnel" + (process.env.TRAVIS_JOB_NUMBER || "-local");
if (!username) {
console.error(
"You need Sauce Labs access to run these specs, if you're a Palindrom org member, please contact @alshakero for this information, if not you need to add your own SauceLabs auth info to your system environment variables."
);
process.exit(1);
} else {
const allCaps = [
{
browserName: "chrome",
platform: "Windows 10",
username: username,
accessKey: accessKey,
name: "Chrome: Running tests",
"tunnel-identifier": tunnelIdentifier
},
{
browserName: "firefox",
platform: "Windows 10",
username: username,
accessKey: accessKey,
name: "Firefox: Running tests",
"tunnel-identifier": tunnelIdentifier
},
{
browserName: "MicrosoftEdge",
platform: "Windows 10",
username: username,
accessKey: accessKey,
name: "MicrosoftEdge: Running tests",
"tunnel-identifier": tunnelIdentifier
}
];
(async function() {
try {
console.log("Preparing Sauce Connect");
sauceConnectLauncher({
tunnelIdentifier
}, async function (err, sauceConnectProcess) {
if (err) {
console.error(err.message);
return;
}
console.log("Sauce Connect ready");
await CapabilityRunner(allCaps[0]);
await CapabilityRunner(allCaps[1]);
await CapabilityRunner(allCaps[2]);
sauceConnectProcess.close(function () {
console.log("Closed Sauce Connect process");
process.exit(0);
})
console.log('Done!');
});
} catch (error) {
console.log(error);
process.exit(1);
}
})();
}