Skip to content

Instantly share code, notes, and snippets.

@zeroasterisk
Created April 20, 2015 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeroasterisk/d4323a1b935196ae683e to your computer and use it in GitHub Desktop.
Save zeroasterisk/d4323a1b935196ae683e to your computer and use it in GitHub Desktop.
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