Skip to content

Commit e4323fb

Browse files
committed
Merge pull request #7 from petehouston/master
Add proxy config
2 parents 012c596 + 051f4f5 commit e4323fb

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,51 @@ Scenario('test some forms', (I, docsPage) => {
255255
});
256256
```
257257
258+
## Connect through proxy
259+
260+
CodeceptJS also provides flexible options when you want to execute tests to Selenium servers through proxy. You will
261+
need to update the `helpers.WebDriverIO.proxy` key.
262+
263+
```js
264+
{
265+
"helpers": {
266+
"WebDriverIO": {
267+
"proxy": {
268+
"proxyType": "manual|pac",
269+
"proxyAutoconfigUrl": "URL TO PAC FILE",
270+
"httpProxy": "PROXY SERVER",
271+
"sslProxy": "PROXY SERVER",
272+
"ftpProxy": "PROXY SERVER",
273+
"socksProxy": "PROXY SERVER",
274+
"socksUsername": "USERNAME",
275+
"socksPassword": "PASSWORD",
276+
"noProxy": "BYPASS ADDRESSES"
277+
}
278+
}
279+
}
280+
}
281+
```
282+
283+
For example,
284+
285+
```js
286+
{
287+
"helpers": {
288+
"WebDriverIO": {
289+
"proxy": {
290+
"proxyType": "manual",
291+
"httpProxy": "http://corporate.proxy:8080",
292+
"socksUsername": "codeceptjs",
293+
"socksPassword": "secret",
294+
"noProxy": "127.0.0.1,localhost"
295+
}
296+
}
297+
}
298+
}
299+
```
300+
301+
Please refer to [Selenium - Proxy Object](https://code.google.com/p/selenium/wiki/DesiredCapabilities#Proxy_JSON_Object) for more information.
302+
258303
## Current State
259304
260305
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!

lib/helper/WebDriverIO.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ class WebDriverIO extends Helper {
4141
if (!this.options.desiredCapabilities) this.options.desiredCapabilities = {};
4242
this.options.desiredCapabilities.browserName = config.browser;
4343
this.options.baseUrl = config.url;
44+
if(config.proxy) {
45+
this.options.desiredCapabilities.proxy = config.proxy;
46+
}
4447
}
4548

4649
static _config() {

0 commit comments

Comments
 (0)