Skip to content

Commit 0ac67d4

Browse files
DylanLaceydignifiedquire
authored andcommittedAug 22, 2017
feat(config): allow SE traffic to be sent via Sauce Connect's Relay
Tests with Sauce Connect have two connections to Sauce Labs, a tunnel from Sauce Connect client to host, and Selenium commands themselves which are sent independently. Sauce Connect is able to relay Selenium commands through the established tunnel, which helps obviate proxy and other issues with Selenium traffic. This change adds config values `connectLocationForSERelay` and `connectPortForSERelay` which allow users to make Karma send Selenium commands through a Sauce Connect instance at that host and port.
1 parent 0219065 commit 0ac67d4

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed
 

‎README.md

+13
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,19 @@ Default:
128128

129129
Options to send to Sauce Connect. Check [here](https://github.com/bermi/sauce-connect-launcher#advanced-usage) for all available options.
130130

131+
### connectLocationForSERelay
132+
Type: `String`
133+
default: `ondemand.saucelabs.com`
134+
135+
If set, will attempt to connect to the specified host as a Selenium relay. This is intended to send Selenium commands through a Sauce Connect tunnel.
136+
137+
### connectPortForSERelay
138+
Type: `Integer`
139+
Default: 80
140+
141+
If set, will change the host used to connect to the Selenium server. This is intended to send Selenium commands through a Sauce Connect tunnel.
142+
143+
131144
### build
132145
Type: `String`
133146
Default: *One of the following environment variables*:

‎lib/sauce_launcher.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ function processConfig (helper, config, args) {
2828
tunnelIdentifier: tunnelIdentifier
2929
})
3030

31+
var seleniumHostLocation = config.connectLocationForSERelay || 'ondemand.saucelabs.com'
32+
var seleniumHostPort = config.connectPortForSERelay || connectOptions.port || 80
33+
3134
var build = process.env.BUILD_NUMBER ||
3235
process.env.BUILD_TAG ||
3336
process.env.CI_BUILD_NUMBER ||
@@ -78,8 +81,10 @@ function processConfig (helper, config, args) {
7881
browserName: browserName,
7982
username: username,
8083
accessKey: accessKey,
81-
proxy: proxy,
82-
startConnect: startConnect
84+
startConnect: startConnect,
85+
seleniumHost: seleniumHostLocation,
86+
seleniumPort: seleniumHostPort,
87+
proxy: proxy
8388
}
8489
}
8590

@@ -104,6 +109,8 @@ var SauceLauncher = function (
104109
var accessKey = pConfig.accessKey
105110
var proxy = pConfig.proxy
106111
var startConnect = pConfig.startConnect
112+
var seleniumHost = pConfig.seleniumHost
113+
var seleniumPort = pConfig.seleniumPort
107114

108115
var pendingCancellations = 0
109116
var sessionIsReady = false
@@ -115,7 +122,7 @@ var SauceLauncher = function (
115122
var log = logger.create('launcher.sauce')
116123
var driverLog = logger.create('wd')
117124

118-
var driver = wd.promiseChainRemote('ondemand.saucelabs.com', 80, username, accessKey)
125+
var driver = wd.promiseChainRemote(seleniumHost, seleniumPort, username, accessKey)
119126

120127
driver.on('status', function (info) {
121128
driverLog.debug(info.cyan)

0 commit comments

Comments
 (0)
Please sign in to comment.