diff --git a/lib/driverProviders/sauce.ts b/lib/driverProviders/sauce.ts index e70984545..36b8a733c 100644 --- a/lib/driverProviders/sauce.ts +++ b/lib/driverProviders/sauce.ts @@ -60,9 +60,13 @@ export class Sauce extends DriverProvider { agent: this.config_.sauceAgent, proxy: this.config_.webDriverProxy }); - this.config_.capabilities['username'] = this.config_.sauceUser; - this.config_.capabilities['accessKey'] = this.config_.sauceKey; - this.config_.capabilities['build'] = this.config_.sauceBuild; + + // Avoid unexpected behavior if users set build capability as supposed, + // but don't break legacy code using config_.sauceBuild. + if (!this.config_.capabilities['build'] && this.config_.sauceBuild) { + this.config_.capabilities['build'] = this.config_.sauceBuild; + } + let protocol = this.config_.sauceSeleniumUseHttp ? 'http://' : 'https://'; let auth = protocol + this.config_.sauceUser + ':' + this.config_.sauceKey + '@'; this.config_.seleniumAddress = auth +