forked from maksrom/javascript-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
executable file
·32 lines (25 loc) · 1.11 KB
/
server.js
File metadata and controls
executable file
·32 lines (25 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const log = require('log')();
const SeleniumServer = require('selenium-webdriver/remote').SeleniumServer;
const config = require('config');
var seleniumServer;
// SELENIUM_LOCAL means using local selenium server + browser
// otherwise sauceLabs
// SELENIUM_DEBUG turns on debugging output from the local selenium server
// (sauceLabs doesn't use it, because it gives full log on-site)
if (+process.env.SELENIUM_LOCAL) {
var pathToJar = require.resolve('lib/selenium/selenium-server-standalone-2.45.0.jar');
// stdio goes to child_process.spawn()
// must be an array of file descriptors or stream which have file descriptors or ...
// because of file descriptors can't just redirect to log (there must be a way btw)
// so using a variable
seleniumServer = new SeleniumServer(pathToJar, {
port: 4444,
stdio: process.env.SELENIUM_DEBUG ? 'inherit' : 'ignore' // ignore by default, but inherit shows all output
});
// selenium starts unref'ed
seleniumServer.start();
exports.server = seleniumServer;
exports.address = seleniumServer.address();
} else {
exports.address = config.sauceLabs.address;
}