Skip to content

Instantly share code, notes, and snippets.

@klamping
Created October 17, 2015 14:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save klamping/f48f3167775e483e712e to your computer and use it in GitHub Desktop.
Save klamping/f48f3167775e483e712e to your computer and use it in GitHub Desktop.
Start selenium-standalone via wdio.conf.js
/*global browser:false*/
var selenium = require("selenium-standalone");
var Promise = require("bluebird");
exports.config = {
// Other configs go here
//
// =====
// Hooks
// =====
// Run functions before or after the test. If one of them returns with a promise, WebdriverIO
// will wait until that promise got resolved to continue.
//
// Gets executed before all workers get launched.
onPrepare: function() {
Promise.promisifyAll(selenium);
var promise = selenium.installAsync({
logger: function(message) {
console.log(message);
}
}).then(function() {
console.log("Starting Selenium");
return selenium.startAsync().then(function(child) {
selenium.child = child;
console.log("Selenium started");
});
});
return promise;
},
//
// Gets executed after all workers got shut down and the process is about to exit. It is not
// possible to defer the end of the process using a promise.
onComplete: function() {
selenium.child.kill();
console.log("\nSelenium process ended. Test suite complete");
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment