Skip to content

Commit f12c428

Browse files
NEW saucelabs webdriver task
1 parent 7ee3055 commit f12c428

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

grunt/config/webdriver-jasmine.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ exports.local = {
77
},
88
url: "http://127.0.0.1:9999/test/index.html",
99
onComplete: function(report){
10-
var browser = this;
1110
if (!report.passed){
1211
grunt.fatal("tests failed");
1312
}
@@ -16,3 +15,30 @@ exports.local = {
1615
grunt.fatal(error);
1716
}
1817
}
18+
19+
20+
exports.saucelabs = {
21+
webdriver: {
22+
remote: {
23+
/* https://github.com/admc/wd/blob/master/README.md#named-parameters */
24+
user: process.env.SAUCE_USERNAME,
25+
pwd: process.env.SAUCE_ACCESS_KEY,
26+
27+
protocol: 'http:',
28+
hostname: 'ondemand.saucelabs.com',
29+
port: '80',
30+
path: '/wd/hub'
31+
}
32+
},
33+
desiredCapabilities: {
34+
"build": process.env.TRAVIS_BUILD_NUMBER,
35+
"tunnel-identifier": process.env.TRAVIS_JOB_NUMBER || 'my awesome tunnel',
36+
"browserName": "chrome"
37+
},
38+
url: exports.local.url,
39+
onStart: function(browser){
40+
grunt.log.writeln("Starting WebDriver Test. Watch results here: http://saucelabs.com/tests/" + browser.sessionID);
41+
},
42+
onComplete: exports.local.onComplete,
43+
onError: exports.local.onError
44+
}

grunt/tasks/sauce-tunnel.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ module.exports = function(){
1212
var SAUCE_USERNAME = process.env.SAUCE_USERNAME;
1313
if (!SAUCE_USERNAME) grunt.fatal('Requires the environment variable SAUCE_USERNAME to be set');
1414

15+
var IDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'my awesome tunnel';
16+
1517
var taskCompletedSuccessfully = task.async();
1618

17-
var stunnel = new SauceTunnel(SAUCE_USERNAME, SAUCE_ACCESS_KEY, /*identifier*/null, /*tunneled*/true, /*tunnelTimeout*/10e3);
19+
var stunnel = new SauceTunnel(SAUCE_USERNAME, SAUCE_ACCESS_KEY, IDENTIFIER, /*tunneled*/true, /*tunnelTimeout*/5);
1820
process.on('exit', stunnel.stop.bind(stunnel, function(){}));
1921

2022
stunnel.on('log:error', grunt.log.error.bind(grunt.log));

0 commit comments

Comments
 (0)