From 72669029636e56911de59ec90f0d893e7406dc1d Mon Sep 17 00:00:00 2001 From: Craig Date: Tue, 26 Jul 2016 16:19:56 -0700 Subject: [PATCH] fix(sauce): sauceAgent passed incorrectly to sauce node module (#3415) closes #3410 --- lib/config.ts | 19 ++++++++++++++++--- lib/driverProviders/sauce.ts | 3 ++- lib/globals.d.ts | 4 ++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/config.ts b/lib/config.ts index f562cd7dd..893409dae 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -92,10 +92,23 @@ export interface Config { */ sauceKey?: string; /** - * Use sauceAgent if you need customize agent for https connection to - * saucelabs.com (i.e. your computer behind corporate proxy) + * Use sauceAgent if you need custom HTTP agent to connect to saucelabs.com. + * This is needed if your computer is behind a corporate proxy. + * + * To match sauce agent implementation, use + * [HttpProxyAgent](https://github.com/TooTallNate/node-http-proxy-agent) + * to generate the agent or use sauceProxy as an alternative. If a + * sauceProxy is provided, the sauceAgent will be overridden. + */ + sauceAgent?: HttpProxyAgent; + /** + * Use sauceProxy if you are behind a corporate proxy to connect to + * saucelabs.com. + * + * The sauceProxy is used to generate an HTTP agent. If a sauceProxy is + * provided, the sauceAgent will be overridden. */ - sauceAgent?: string; + sauceProxy?: string; /** * Use sauceBuild if you want to group test capabilites by a build ID */ diff --git a/lib/driverProviders/sauce.ts b/lib/driverProviders/sauce.ts index 2ec40bea9..84591393c 100644 --- a/lib/driverProviders/sauce.ts +++ b/lib/driverProviders/sauce.ts @@ -57,7 +57,8 @@ export class Sauce extends DriverProvider { this.sauceServer_ = new SauceLabs({ username: this.config_.sauceUser, password: this.config_.sauceKey, - agent: this.config_.sauceAgent + agent: this.config_.sauceAgent, + proxy: this.config_.sauceProxy }); this.config_.capabilities['username'] = this.config_.sauceUser; this.config_.capabilities['accessKey'] = this.config_.sauceKey; diff --git a/lib/globals.d.ts b/lib/globals.d.ts index c654c1088..03c358ed5 100644 --- a/lib/globals.d.ts +++ b/lib/globals.d.ts @@ -105,3 +105,7 @@ declare namespace webdriver { isPresent?: Function; } } + +declare interface HttpProxyAgent { + constructor(opts: Object): HttpProxyAgent; +}