NEW saucelabs webdriver task
Thomas Aylott committed
Nov 8, 2013 at 16:28 UTC
f12c428c7895a55f227ca0f039e27943abb1c5d3
2 files changed
+30
-2
grunt/config/webdriver-jasmine.js
+27
-1
@@ -7,7 +7,6 @@ exports.local = {
7
},
8
url: "http://127.0.0.1:9999/test/index.html",
9
onComplete: function(report){
10
- var browser = this;
10
if (!report.passed){
11
grunt.fatal("tests failed");
12
}
@@ -16,3 +15,30 @@ exports.local = {
15
grunt.fatal(error);
16
}
17
}
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
+3
-1
@@ -12,9 +12,11 @@ module.exports = function(){
12
var SAUCE_USERNAME = process.env.SAUCE_USERNAME;
13
if (!SAUCE_USERNAME) grunt.fatal('Requires the environment variable SAUCE_USERNAME to be set');
14
15
+ var IDENTIFIER = process.env.TRAVIS_JOB_NUMBER || 'my awesome tunnel';
16
+
17
var taskCompletedSuccessfully = task.async();
18
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);
20
process.on('exit', stunnel.stop.bind(stunnel, function(){}));
21
22
stunnel.on('log:error', grunt.log.error.bind(grunt.log));