run-jasmine.js: Drive Jasmine-based tests.

1.0
Ariya Hidayat 2010-12-31 17:05:36 -08:00
parent ad252166d7
commit a75e67a041
1 changed files with 26 additions and 0 deletions

26
examples/run-jasmine.js Normal file
View File

@ -0,0 +1,26 @@
if (phantom.storage.length === 0) {
if (phantom.arguments.length !== 1) {
phantom.log('Usage: run-jasmine.js URL');
phantom.exit();
} else {
phantom.storage = 'run-jasmine';
phantom.open(phantom.arguments[0]);
}
} else {
window.setInterval(function () {
var list, el, desc, i, j;
if (document.body.querySelector('.finished_at')) {
phantom.log(document.body.querySelector('.description').innerText);
list = document.body.querySelectorAll('div.jasmine_reporter > div.suite.failed');
for (i = 0; i < list.length; ++i) {
el = list[i];
desc = el.querySelectorAll('.description');
phantom.log('');
for (j = 0; j < desc.length; ++j) {
phantom.log(desc[j].innerText);
}
}
phantom.exit();
}
}, 100);
}