Created
April 20, 2015 18:23
-
-
Save zeroasterisk/d4323a1b935196ae683e to your computer and use it in GitHub Desktop.
nightwatch test runner script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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