Skip to content

Instantly share code, notes, and snippets.

@dark4eg
Created July 9, 2015 08:50
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 dark4eg/f6a69d2933b00794ccd5 to your computer and use it in GitHub Desktop.
Save dark4eg/f6a69d2933b00794ccd5 to your computer and use it in GitHub Desktop.
var page = require('webpage').create();
var url;
if (phantom.args) {
url = phantom.args[0];
} else {
url = require('system').args[1];
}
page.onConsoleMessage = function (message) {
console.log(message);
};
function exit(code) {
setTimeout(function(){ phantom.exit(code); }, 0);
phantom.onError = function(){};
}
console.log("Loading URL: " + url);
page.open(url, function (status) {
if (status != "success") {
console.log('Failed to open ' + url);
phantom.exit(1);
}
console.log("Running test.");
var result = page.evaluate(function() {
return st_container.test_runner.runner();
});
if (result != 0) {
console.log("*** Test failed! ***");
exit(1);
}
else {
console.log("Test succeeded.");
exit(0);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment