1 var page = require('webpage').create();
3 page.open("http://localhost:3000/test/index.html", function (status) {
4 if (status != "success") {
5 console.log("page couldn't be loaded successfully");
9 return page.evaluate(function () {
10 var output = document.getElementById('status');
11 if (!output) { return false; }
12 return (/^(\d+ failures?|all passed)/i).test(output.innerText);
15 var failed = page.evaluate(function () { return window.failed; });
16 var output = page.evaluate(function () {
17 return document.getElementById('output').innerText + "\n" +
18 document.getElementById('status').innerText;
21 phantom.exit(failed > 0 ? 1 : 0);
25 function waitFor (test, cb) {
29 setTimeout(function () { waitFor(test, cb); }, 250);