Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 1c9b98d

Browse files
David Simonjuliemr
David Simon
authored andcommitted
Fixed Sauce issues: low timeouts, shutdown and init order.
Allowing user to override defaultTimeoutInterval with config in sauce tests.
1 parent 679c82d commit 1c9b98d

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

lib/cli.js

+21-15
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,39 @@ var config = {
2121
},
2222
jasmineNodeOpts: {
2323
specs: [],
24-
onComplete: null,
2524
isVerbose: false,
2625
showColors: true,
2726
includeStackTrace: true
2827
}
2928
}
3029

31-
var originalOnComplete = config.jasmineNodeOpts.onComplete;
32-
30+
var originalOnComplete;
3331
var server;
3432
var driver;
3533
var id;
3634

3735
var cleanUp = function(runner, log) {
38-
var passed = runner.results().failedCount == 0;
3936
if (originalOnComplete) {
4037
originalOnComplete(runner, log);
4138
}
39+
40+
var passed = runner.results().failedCount == 0;
4241
if (sauceAccount) {
43-
sauceAccount.updateJob(id, {'passed': passed}, function() {});
44-
process.exit(passed? 0 : 1);
42+
sauceAccount.updateJob(id, {'passed': passed}, function() {
43+
driver.quit().then(function() {
44+
process.exit(passed? 0 : 1);
45+
});
46+
});
47+
} else {
48+
driver.quit().then(function() {
49+
if (server) {
50+
util.puts('Shutting down selenium standalone server');
51+
server.stop();
52+
}
53+
}).then(function() {
54+
process.exit(passed? 0 : 1);
55+
});
4556
}
46-
47-
driver.quit().then(function() {
48-
if (server) {
49-
util.puts('Shutting down selenium standalone server');
50-
server.stop();
51-
}
52-
}).then(function() {
53-
process.exit(passed? 0 : 1);
54-
});
5557
};
5658

5759
var printVersion = function () {
@@ -81,6 +83,9 @@ var run = function() {
8183
if (config.sauceUser && config.sauceKey) {
8284
config.capabilities.username = config.sauceUser;
8385
config.capabilities.accessKey = config.sauceKey;
86+
if (!config.jasmineNodeOpts.defaultTimeoutInterval) {
87+
config.jasmineNodeOpts.defaultTimeoutInterval = 30 * 1000;
88+
}
8489
config.seleniumAddress = 'http://' + config.sauceUser + ':' +
8590
config.sauceKey + '@ondemand.saucelabs.com:80/wd/hub';
8691

@@ -137,6 +142,7 @@ var startJasmineTests = function() {
137142
require('../jasminewd');
138143

139144
var options = config.jasmineNodeOpts;
145+
originalOnComplete = options.onComplete;
140146
options.onComplete = cleanUp;
141147

142148
minijn.executeSpecs(options);

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"author": "Julie Ralph <[email protected]>",
1414
"dependencies": {
1515
"selenium-webdriver": "~2.35.0",
16-
"minijasminenode": "~0.2.0",
16+
"minijasminenode": "~0.2.4",
1717
"saucelabs": "~0.1.0",
1818
"glob": ">=3.1.14",
1919
"adm-zip": ">=0.4.2"

0 commit comments

Comments
 (0)