-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwct.conf.js
47 lines (43 loc) · 1.77 KB
/
wct.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
var request=require('request');
module.exports = {
verbose: false,
testTimeout: 5 * 60 * 1000,
plugins: {
sauce: {
disabled: true,
browsers: [
"Windows 8.1/internet explorer",
"Windows 7/internet explorer@10",
"OS X 10.10/chrome",
"OS X 10.10/firefox",
"OS X 10.10/safari",
"OS X 10.11/safari"
],
'tunnelId': process.env.TRAVIS_JOB_NUMBER
}
},
registerHooks: function(wct) {
wct.on('browser-end', function(browser, error, stats, sessionId ) {
if (!sessionId || !process.env.TRAVIS_JOB_NUMBER) return;
var payload = {
"name": process.env.TRAVIS_BRANCH+"_"+browser.browserName+"@"+browser.platform,
"build": process.env.TRAVIS_BUILD_NUMBER,
"custom-data": stats
};
if (process.env.TRAVIS_TAG)
payload.tags = [process.env.TRAVIS_TAG];
wct.emit('log:debug', 'Updating sauce job ', sessionId, payload);
var username = process.env.SAUCE_USERNAME;
var accessKey = process.env.SAUCE_ACCESS_KEY;
request.put({
url: 'https://saucelabs.com/rest/v1/' + encodeURIComponent(username) + '/jobs/' + encodeURIComponent(sessionId),
auth: {user: username, pass: accessKey},
json: true,
body: payload
}).on('response',function(response) {
wct.emit('log:debug',
'Update complete https://saucelabs.com/rest/v1/' + encodeURIComponent(username) + '/jobs/' + encodeURIComponent(sessionId)+' ('+response.statusCode+') '+response.statusMessage);
});
});
}
};