function startSelenium(callback) { // Start selenium var opts = {version: '2.42.0'}; selenium.install(opts, function(err) { if (err) { console.error('Failed to install selenium'); process.exit(1); } selenium.start(opts, function(err, server) { sauceClient = wd.promiseChainRemote(); callback(); }); }); }
gulp.task('e2e', ['test', 'selenium'], function () { return gulp.src('wdio.conf.js', {read: false}) .pipe(webdriver({ // this is here because gulp-webdriver doesn't deal with a project with a flattened dependency (at the top level) on webdriverio // see https://github.com/webdriverio/gulp-webdriver/issues/20 wdioBin: path.join(__dirname, 'node_modules', '.bin', 'wdio'), desiredCapabilities: { browserName: 'phantomjs' } })) .once('end', function () { selenium.child.kill(); }); });