Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
nightwatch test runner script
#!/usr/bin/env node
// -------------------
// nightwatchjs script running
// - automatically downloads the selenium jar if missing
// - automatically passes through all arguments to the runner.js
// -------------------
var fs = require('fs');
var path = 'Vendor/selenium-server-standalone-2.44.0.jar';
if (!fs.existsSync(path)) {
console.log('Selenium JAR File Not Found: ' + path);
var http = require('http');
var download = function(url, dest, cb) {
var file = fs.createWriteStream(dest);
var request = http.get(url, function(response) {
response.pipe(file);
file.on('finish', function() {
file.close(cb);
});
});
}
// download the file
download(
'http://selenium-release.storage.googleapis.com/2.44/selenium-server-standalone-2.44.0.jar',
path,
function() {
console.log("Download complete");
// runner for nightwatch
require('nightwatch/bin/runner.js');
}
);
} else {
// runner for nightwatch
require('nightwatch/bin/runner.js');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment