diff --git a/README.md b/README.md index 4e92eaeb1..51cc6a15e 100644 --- a/README.md +++ b/README.md @@ -255,6 +255,51 @@ 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" + } + } + } +} +``` + +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 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! diff --git a/lib/helper/WebDriverIO.js b/lib/helper/WebDriverIO.js index e4c1b74ae..da452e49b 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.proxy = config.proxy; + } } static _config() {