2011-01-01 09:09:02 +03:00
|
|
|
if (phantom.state.length === 0) {
|
2011-01-15 09:24:47 +03:00
|
|
|
if (phantom.args.length !== 1) {
|
2011-01-01 07:10:34 +03:00
|
|
|
console.log('Usage: run-jasmine.js URL');
|
2011-01-01 04:05:36 +03:00
|
|
|
phantom.exit();
|
|
|
|
} else {
|
2011-01-01 09:09:02 +03:00
|
|
|
phantom.state = 'run-jasmine';
|
2011-01-15 09:24:47 +03:00
|
|
|
phantom.open(phantom.args[0]);
|
2011-01-01 04:05:36 +03:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
window.setInterval(function () {
|
|
|
|
var list, el, desc, i, j;
|
|
|
|
if (document.body.querySelector('.finished_at')) {
|
2011-01-01 07:10:34 +03:00
|
|
|
console.log(document.body.querySelector('.description').innerText);
|
2011-01-01 04:05:36 +03:00
|
|
|
list = document.body.querySelectorAll('div.jasmine_reporter > div.suite.failed');
|
|
|
|
for (i = 0; i < list.length; ++i) {
|
|
|
|
el = list[i];
|
|
|
|
desc = el.querySelectorAll('.description');
|
2011-01-01 07:10:34 +03:00
|
|
|
console.log('');
|
2011-01-01 04:05:36 +03:00
|
|
|
for (j = 0; j < desc.length; ++j) {
|
2011-01-01 07:10:34 +03:00
|
|
|
console.log(desc[j].innerText);
|
2011-01-01 04:05:36 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
phantom.exit();
|
|
|
|
}
|
|
|
|
}, 100);
|
|
|
|
}
|