From 632f789fab4da521a4a17a0710ebcc2c8ef7a899 Mon Sep 17 00:00:00 2001 From: Dylan Lacey Date: Wed, 9 Jul 2014 00:44:23 -0700 Subject: [PATCH] Allow for custom server addresses when running against SauceLabs. --- lib/driverProviders/sauce.js | 11 +++++++++-- lib/runner.js | 8 ++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/driverProviders/sauce.js b/lib/driverProviders/sauce.js index 7e976fd9e..3f9e61d2e 100644 --- a/lib/driverProviders/sauce.js +++ b/lib/driverProviders/sauce.js @@ -55,8 +55,15 @@ SauceDriverProvider.prototype.setupEnv = function() { }); this.config_.capabilities.username = this.config_.sauceUser; this.config_.capabilities.accessKey = this.config_.sauceKey; - this.config_.seleniumAddress = 'http://' + this.config_.sauceUser + ':' + - this.config_.sauceKey + '@ondemand.saucelabs.com:80/wd/hub'; + var auth = 'http://' + this.config_.sauceUser + ':' + + this.config_.sauceKey + '@'; + + if (this.config_.seleniumAddress) { + this.config_.seleniumAddress = auth + this.config_.seleniumAddress; + } else { + this.config_.seleniumAddress = auth + 'ondemand.saucelabs.com:80/wd/hub'; + } + this.config_.seleniumAddress = this.config_.seleniumAddress; // Append filename to capabilities.name so that it's easier to identify tests if (this.config_.capabilities.name && this.config_.capabilities.shardTestFiles) { diff --git a/lib/runner.js b/lib/runner.js index 504f7ad30..07a149d1b 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -98,8 +98,8 @@ Runner.prototype.runTestPreparers = function() { * * Priority * 1) if chromeOnly, use that - * 2) if seleniumAddress is given, use that - * 3) if a sauceAccount is given, use that. + * 2) if a sauceAccount is given, use that + * 3) if seleniumAddress is given, use that * 4) if a seleniumServerJar is specified, use that * 5) try to find the seleniumServerJar in protractor/selenium */ @@ -107,10 +107,10 @@ Runner.prototype.loadDriverProvider_ = function() { var runnerPath; if (this.config_.chromeOnly) { runnerPath = './driverProviders/chrome'; - } else if (this.config_.seleniumAddress) { - runnerPath = './driverProviders/hosted'; } else if (this.config_.sauceUser && this.config_.sauceKey) { runnerPath = './driverProviders/sauce'; + } else if (this.config_.seleniumAddress) { + runnerPath = './driverProviders/hosted'; } else if (this.config_.seleniumServerJar) { runnerPath = './driverProviders/local'; } else if (this.config_.mockSelenium) {