This repository was archived by the owner on Aug 3, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 26
Config is read too early #37
Copy link
Copy link
Open
Labels
Description
Hi, could you read the settings in the onPrepare hook and not in the constructor of ChromeDriverLauncher?
The reason is I want to set a randomly chosen port, but since getting such port is an async function I can do it only in wdio config onPrepare hook.
Such setting is ignored by chromerdriver service because it reads the config already in the constructor.
You get the config in the onPrepare hook so something like this snippet below would fix my problem: :)
in https://github.com/atti187/wdio-chromedriver-service/blob/master/src/launcher.js
async onPrepare(config) {
this.args.forEach(argument => {
if (argument.includes('--port')) {
throw new Error('Argument "--port" already exists')
}
if (argument.includes('--url-base')) {
throw new Error('Argument "--url-base" already exists')
}
})
this.options.port = config.port || this.options.port;
this.args.push(`--port=${this.options.port}`)