From 879aac6ee6c1c36d005b538472e2754b987b3368 Mon Sep 17 00:00:00 2001 From: mgiambalvo Date: Wed, 18 Jan 2017 14:06:42 -0800 Subject: [PATCH] chore(blockingproxy): Allow using a pre-existing Blocking Proxy instance (#3970) --- lib/cli.ts | 1 + lib/config.ts | 6 ++++++ lib/driverProviders/driverProvider.ts | 5 ++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/cli.ts b/lib/cli.ts index c0aa1202c..f1d6cee75 100644 --- a/lib/cli.ts +++ b/lib/cli.ts @@ -41,6 +41,7 @@ let allowedNames = [ 'seleniumSessionId', 'webDriverProxy', 'useBlockingProxy', + 'blockingProxyUrl', 'sauceUser', 'sauceKey', 'sauceAgent', diff --git a/lib/config.ts b/lib/config.ts index 107d62f25..d274bdd18 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -104,6 +104,12 @@ export interface Config { */ useBlockingProxy?: boolean; + /** + * If specified, Protractor will connect to the Blocking Proxy at the given + * url instead of starting it's own. + */ + blockingProxyUrl?: string; + // ---- 3. To use remote browsers via Sauce Labs ----------------------------- /** diff --git a/lib/driverProviders/driverProvider.ts b/lib/driverProviders/driverProvider.ts index fbbaa900a..9926b8a1d 100644 --- a/lib/driverProviders/driverProvider.ts +++ b/lib/driverProviders/driverProvider.ts @@ -31,6 +31,9 @@ export abstract class DriverProvider { } getBPUrl() { + if (this.config_.blockingProxyUrl) { + return this.config_.blockingProxyUrl; + } return `http://localhost:${this.bpRunner.port}`; } @@ -105,7 +108,7 @@ export abstract class DriverProvider { */ setupEnv(): q.Promise { let driverPromise = this.setupDriverEnv(); - if (this.config_.useBlockingProxy) { + if (this.config_.useBlockingProxy && !this.config_.blockingProxyUrl) { // TODO(heathkit): If set, pass the webDriverProxy to BP. return q.all([driverPromise, this.bpRunner.start()]); }