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

Commit

Permalink
Fixed Sauce issues: low timeouts, shutdown and init order.
Browse files Browse the repository at this point in the history
Allowing user to override defaultTimeoutInterval with config in sauce tests.
  • Loading branch information
David Simon authored and juliemr committed Aug 27, 2013
1 parent 679c82d commit 1c9b98d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
36 changes: 21 additions & 15 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,39 @@ var config = {
},
jasmineNodeOpts: {
specs: [],
onComplete: null,
isVerbose: false,
showColors: true,
includeStackTrace: true
}
}

var originalOnComplete = config.jasmineNodeOpts.onComplete;

var originalOnComplete;
var server;
var driver;
var id;

var cleanUp = function(runner, log) {
var passed = runner.results().failedCount == 0;
if (originalOnComplete) {
originalOnComplete(runner, log);
}

var passed = runner.results().failedCount == 0;
if (sauceAccount) {
sauceAccount.updateJob(id, {'passed': passed}, function() {});
process.exit(passed? 0 : 1);
sauceAccount.updateJob(id, {'passed': passed}, function() {
driver.quit().then(function() {
process.exit(passed? 0 : 1);
});
});
} else {
driver.quit().then(function() {
if (server) {
util.puts('Shutting down selenium standalone server');
server.stop();
}
}).then(function() {
process.exit(passed? 0 : 1);
});
}

driver.quit().then(function() {
if (server) {
util.puts('Shutting down selenium standalone server');
server.stop();
}
}).then(function() {
process.exit(passed? 0 : 1);
});
};

var printVersion = function () {
Expand Down Expand Up @@ -81,6 +83,9 @@ var run = function() {
if (config.sauceUser && config.sauceKey) {
config.capabilities.username = config.sauceUser;
config.capabilities.accessKey = config.sauceKey;
if (!config.jasmineNodeOpts.defaultTimeoutInterval) {
config.jasmineNodeOpts.defaultTimeoutInterval = 30 * 1000;
}
config.seleniumAddress = 'http://' + config.sauceUser + ':' +
config.sauceKey + '@ondemand.saucelabs.com:80/wd/hub';

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

var options = config.jasmineNodeOpts;
originalOnComplete = options.onComplete;
options.onComplete = cleanUp;

minijn.executeSpecs(options);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Julie Ralph <[email protected]>",
"dependencies": {
"selenium-webdriver": "~2.35.0",
"minijasminenode": "~0.2.0",
"minijasminenode": "~0.2.4",
"saucelabs": "~0.1.0",
"glob": ">=3.1.14",
"adm-zip": ">=0.4.2"
Expand Down

0 comments on commit 1c9b98d

Please sign in to comment.