webdriverio-boneyard / wdio-selenium-standalone-service

WebdriverIO v4 service to start & stop Selenium Standalone http://webdriver.io
MIT License
54 stars 28 forks source link

Do not start a server for remote hosts #8

Closed monolithed closed 8 years ago

monolithed commented 8 years ago

It would be nice to have an additional option to exclude the selenium-standalone service from services for remote hosts or something like:

onPrepare (options) {
    let { host, services = [] } = options;

    if (!/127\.0\.0\.1|localhost|::1/.test(host)) {
        let index = services.includes('selenium-standalone');

        if (index) {
            options.services.splice(index, 1);
        }
    }
}
christian-bromann commented 8 years ago

Why do you want to do that in the onPrepare hook. You can tweak the service list depending of the host in your config already since it is a normal js file.

monolithed commented 8 years ago

I don't want use the onPrepare hook for that )

You can tweak the service list depending of the host in your config already since it is a normal js file.

Could you provide an example? I tried to pass the services to the Launcher and that did not work for me.

christian-bromann commented 8 years ago

something like that:

// wdio.conf.js
exports.config = {
  // ...
}

if (!/127\.0\.0\.1|localhost|::1/.test(exports.config.host)) {
    let index = exports.config.services.includes('selenium-standalone');

    if (index) {
        exports.config.services.splice(index, 1);
    }
}

However I don't know how you've setup WebdriverIO.

monolithed commented 8 years ago

Hm, I guess it will work, thanks!