Skip to content

Commit

Permalink
[js] Expose loopback option to remote/SeleniumServer
Browse files Browse the repository at this point in the history
  • Loading branch information
jleyba committed Sep 24, 2015
1 parent 8104d28 commit b097242
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions javascript/node/selenium-webdriver/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v2.48.0-dev

* FIXED: Surfaced the `loopback` option to `remote/SeleniumServer`. When set,
the server will be accessed using the current host's loopback address.

## v2.47.0

### Notice
Expand Down
7 changes: 6 additions & 1 deletion javascript/node/selenium-webdriver/lib/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ var NATIVE_BROWSERS = [

var serverJar = process.env['SELENIUM_SERVER_JAR'];
var remoteUrl = process.env['SELENIUM_REMOTE_URL'];
var useLoopback = process.env['SELENIUM_USE_LOOP_BACK'] == '1';
var startServer = !!serverJar && !remoteUrl;
var nativeRun = !serverJar && !remoteUrl;

Expand Down Expand Up @@ -91,6 +92,9 @@ var browsersToTest = (function() {
console.log('Using remote server ' + remoteUrl);
} else if (serverJar) {
console.log('Using standalone Selenium server ' + serverJar);
if (useLoopback) {
console.log('Running tests using loopback address')
}
}

return browsers;
Expand Down Expand Up @@ -208,7 +212,8 @@ function suite(fn, opt_options) {

if (!!serverJar && !remoteUrl) {
if (!(serverToUse = seleniumServer)) {
serverToUse = seleniumServer = new remote.SeleniumServer(serverJar);
serverToUse = seleniumServer = new remote.SeleniumServer(
serverJar, {loopback: useLoopback});
}

testing.before(function() {
Expand Down
2 changes: 1 addition & 1 deletion javascript/node/selenium-webdriver/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "selenium-webdriver",
"version": "2.47.0",
"version": "2.48.0-dev",
"description": "The official WebDriver JavaScript bindings from the Selenium project",
"license": "Apache-2.0",
"keywords": [
Expand Down
5 changes: 5 additions & 0 deletions javascript/node/selenium-webdriver/remote/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var _base = require('../_base'),
* information, refer to the documentation of `child_process.spawn`.
*
* @typedef {{
* loopback: (boolean|undefined),
* port: (number|!webdriver.promise.Promise.<number>),
* args: !(Array.<string>|webdriver.promise.Promise.<!Array.<string>>),
* path: (string|undefined),
Expand Down Expand Up @@ -276,6 +277,7 @@ function SeleniumServer(jar, opt_options) {
});

DriverService.call(this, 'java', {
loopback: options.loopback,
port: port,
args: args,
path: '/wd/hub',
Expand All @@ -289,6 +291,8 @@ util.inherits(SeleniumServer, DriverService);
/**
* Options for the Selenium server:
*
* - `loopback` - Whether the server should only be accessed on this host's
* loopback address.
* - `port` - The port to start the server on (must be > 0). If the port is
* provided as a promise, the service will wait for the promise to resolve
* before starting.
Expand All @@ -302,6 +306,7 @@ util.inherits(SeleniumServer, DriverService);
* information, refer to the documentation of `child_process.spawn`.
*
* @typedef {{
* loopback: (boolean|undefined),
* port: (number|!webdriver.promise.Promise.<number>),
* args: !(Array.<string>|webdriver.promise.Promise.<!Array.<string>>),
* jvmArgs: (!Array.<string>|
Expand Down

0 comments on commit b097242

Please sign in to comment.