* Overrides the parent build() method to add the websocket port argument * for Firefox when not connecting to an existing instance. * * @return {!DriverService} A new driver service instance.
()
| 420 | * @return {!DriverService} A new driver service instance. |
| 421 | */ |
| 422 | build() { |
| 423 | let port = this.options_.port || findFreePort() |
| 424 | let argsPromise = Promise.resolve(port).then((port) => { |
| 425 | // Start with the default --port argument. |
| 426 | let args = this.options_.args.concat(`--port=${port}`) |
| 427 | // If the "--connect-existing" flag is not set, add the websocket port. |
| 428 | if (!this.options_.args.some((arg) => arg === '--connect-existing')) { |
| 429 | return findFreePort().then((wsPort) => { |
| 430 | args.push(`--websocket-port=${wsPort}`) |
| 431 | return args |
| 432 | }) |
| 433 | } |
| 434 | return args |
| 435 | }) |
| 436 | |
| 437 | let options = Object.assign({}, this.options_, { args: argsPromise, port }) |
| 438 | return new remote.DriverService(this.exe_, options) |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | /** |
nothing calls this directly
no test coverage detected