From a1ce884c4c9c67f097e29760bc7093742869faf5 Mon Sep 17 00:00:00 2001 From: Pete Houston Date: Mon, 30 Nov 2015 21:06:13 +0700 Subject: [PATCH 1/4] Add proxy config --- lib/helper/WebDriverIO.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/helper/WebDriverIO.js b/lib/helper/WebDriverIO.js index e4c1b74ae..cf82b5ee6 100644 --- a/lib/helper/WebDriverIO.js +++ b/lib/helper/WebDriverIO.js @@ -41,6 +41,9 @@ class WebDriverIO extends Helper { if (!this.options.desiredCapabilities) this.options.desiredCapabilities = {}; this.options.desiredCapabilities.browserName = config.browser; this.options.baseUrl = config.url; + if(config.proxy) { + this.options.desiredCapabilities = config.proxy; + } } static _config() { From c57603a86215a50b3827c7156158df16e918b0e3 Mon Sep 17 00:00:00 2001 From: Pete Houston Date: Tue, 1 Dec 2015 19:52:08 +0700 Subject: [PATCH 2/4] Update the proxy json object for desiredcapabilities --- lib/helper/WebDriverIO.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helper/WebDriverIO.js b/lib/helper/WebDriverIO.js index cf82b5ee6..da452e49b 100644 --- a/lib/helper/WebDriverIO.js +++ b/lib/helper/WebDriverIO.js @@ -42,7 +42,7 @@ class WebDriverIO extends Helper { this.options.desiredCapabilities.browserName = config.browser; this.options.baseUrl = config.url; if(config.proxy) { - this.options.desiredCapabilities = config.proxy; + this.options.desiredCapabilities.proxy = config.proxy; } } From f228087f4847cbce211fb426a967b270e4bbc30f Mon Sep 17 00:00:00 2001 From: Pete Houston Date: Tue, 1 Dec 2015 20:07:30 +0700 Subject: [PATCH 3/4] Add proxy config usage --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 8da0f0981..32000413e 100644 --- a/README.md +++ b/README.md @@ -255,6 +255,33 @@ Scenario('test some forms', (I, docsPage) => { }); ``` +## Connect through proxy + +CodeceptJS also provides flexible options when you want to execute tests to Selenium servers through proxy. You will +need to update the `helpers.WebDriverIO.proxy` key. + +```js +{ + "helpers": { + "WebDriverIO": { + "proxy": { + "proxyType": "manual|pac", + "proxyAutoconfigUrl": "URL TO PAC FILE", + "httpProxy": "PROXY SERVER", + "sslProxy": "PROXY SERVER", + "ftpProxy": "PROXY SERVER", + "socksProxy": "PROXY SERVER", + "socksUsername": "USERNAME", + "socksPassword": "PASSWORD", + "noProxy": "BYPASS ADDRESSES" + } + } + } +} +``` + +Please refer to [Selenium - Proxy Object](https://code.google.com/p/selenium/wiki/DesiredCapabilities#Proxy_JSON_Object) for more information. + ## Current State CodeceptJS is in its early days. Any feedback, issues, and pull requests are welcome. Try it, and if you like it - help us make it better! From 051f4f56efbb537258614e9b267a58dcc9e3fa9a Mon Sep 17 00:00:00 2001 From: Pete Houston Date: Tue, 1 Dec 2015 20:11:47 +0700 Subject: [PATCH 4/4] Add sample for proxy usage --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 32000413e..e83dd115c 100644 --- a/README.md +++ b/README.md @@ -280,6 +280,24 @@ need to update the `helpers.WebDriverIO.proxy` key. } ``` +For example, + +```js +{ + "helpers": { + "WebDriverIO": { + "proxy": { + "proxyType": "manual", + "httpProxy": "http://corporate.proxy:8080", + "socksUsername": "codeceptjs", + "socksPassword": "secret", + "noProxy": "127.0.0.1,localhost" + } + } + } +} +``` + Please refer to [Selenium - Proxy Object](https://code.google.com/p/selenium/wiki/DesiredCapabilities#Proxy_JSON_Object) for more information. ## Current State