-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ftr] remove digdug, use chromedriver directly (#11558)
* [ftr] remove digdug, use chromedriver directly why? - digdug is meant to be used by intern, and expects a certain lifecycle that the FTR has tried and continuously fails to mimic - rather than continue trying to force digdug into the stack, just spawn chromedriver ourselves. We know how to handle it - cleans up verbose remote logging while we're in there, since selenium-standalone-server went with digdug, which was previously doing the verbose logging - deprecate config.servers.webdriver - add config.chromedriver.url - if url at config.chromedriver.url points to a server that responds to http requests use it as the chromedriver instance, enables running chrome in a VM or container - if pings to config.chromedriver.url fail a local chromedriver is started * address review requests
- Loading branch information
Showing
21 changed files
with
280 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/functional_test_runner/lib/config/transform_deprecations.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { createTransform, Deprecations } from '../../../deprecation'; | ||
|
||
export const transformDeprecations = createTransform([ | ||
Deprecations.unused('servers.webdriver') | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
test/functional/services/remote/chromedriver_api/chromedriver_api.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { EventEmitter } from 'events'; | ||
|
||
import { createLocalChromedriverApi } from './chromedriver_local_api'; | ||
import { createRemoteChromedriverApi } from './chromedriver_remote_api'; | ||
import { ping } from './ping'; | ||
|
||
const noop = () => {}; | ||
|
||
/** | ||
* Api for interacting with a local or remote instance of Chromedriver | ||
* | ||
* @type {Object} | ||
*/ | ||
export class ChromedriverApi extends EventEmitter { | ||
static async factory(log, url) { | ||
return (await ping(url)) | ||
? createRemoteChromedriverApi(log, url) | ||
: createLocalChromedriverApi(log, url); | ||
} | ||
|
||
constructor(options = {}) { | ||
super(); | ||
|
||
const { | ||
url, | ||
start = noop, | ||
stop = noop, | ||
} = options; | ||
|
||
if (!url) { | ||
throw new TypeError('url is a required parameter'); | ||
} | ||
|
||
this._url = url; | ||
this._state = undefined; | ||
this._callCustomStart = () => start(this); | ||
this._callCustomStop = () => stop(this); | ||
this._beforeStopFns = []; | ||
} | ||
|
||
getUrl() { | ||
return this._url; | ||
} | ||
|
||
beforeStop(fn) { | ||
this._beforeStopFns.push(fn); | ||
} | ||
|
||
isStopped() { | ||
return this._state === 'stopped'; | ||
} | ||
|
||
async start() { | ||
if (this._state !== undefined) { | ||
throw new Error('Chromedriver can only be started once'); | ||
} | ||
|
||
this._state = 'started'; | ||
await this._callCustomStart(); | ||
} | ||
|
||
async stop() { | ||
if (this._state !== 'started') { | ||
throw new Error('Chromedriver can only be stopped after being started'); | ||
} | ||
|
||
this._state = 'stopped'; | ||
|
||
for (const fn of this._beforeStopFns.splice(0)) { | ||
await fn(); | ||
} | ||
|
||
await this._callCustomStop(); | ||
} | ||
} |
Oops, something went wrong.