don't bother with tests if there are javascript errors
This commit is contained in:
parent
39a1132293
commit
a313b9bdfd
@ -153,28 +153,30 @@ void HeadlessSpecRunner::timerEvent(QTimerEvent *event)
|
|||||||
if (hasErrors && m_runs > 2)
|
if (hasErrors && m_runs > 2)
|
||||||
QApplication::instance()->exit(1);
|
QApplication::instance()->exit(1);
|
||||||
|
|
||||||
if (!hasElement(".jasmine_reporter") && !hasElement(".runner.running"))
|
if (!hasErrors) {
|
||||||
return;
|
if (!hasElement(".jasmine_reporter") && !hasElement(".runner.running"))
|
||||||
|
return;
|
||||||
|
|
||||||
if (hasElement(".runner.passed")) {
|
if (hasElement(".runner.passed")) {
|
||||||
QWebElement desc = m_page.mainFrame()->findFirstElement(".description");
|
QWebElement desc = m_page.mainFrame()->findFirstElement(".description");
|
||||||
std::cout << "\033[0;32m" << "PASS: " << qPrintable(desc.toPlainText()) << "\033[m" << std::endl;
|
std::cout << "\033[0;32m" << "PASS: " << qPrintable(desc.toPlainText()) << "\033[m" << std::endl;
|
||||||
QApplication::instance()->exit(0);
|
QApplication::instance()->exit(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasElement(".runner.failed")) {
|
if (hasElement(".runner.failed")) {
|
||||||
QWebElement desc = m_page.mainFrame()->findFirstElement(".description");
|
QWebElement desc = m_page.mainFrame()->findFirstElement(".description");
|
||||||
std::cout << "\033[0;31m" << "FAIL: " << qPrintable(desc.toPlainText()) << "\033[m" << std::endl;
|
std::cout << "\033[0;31m" << "FAIL: " << qPrintable(desc.toPlainText()) << "\033[m" << std::endl;
|
||||||
m_page.mainFrame()->evaluateJavaScript(DUMP_MSG);
|
m_page.mainFrame()->evaluateJavaScript(DUMP_MSG);
|
||||||
//QDesktopServices::openUrl(m_page.mainFrame()->url());
|
//QDesktopServices::openUrl(m_page.mainFrame()->url());
|
||||||
QApplication::instance()->exit(1);
|
QApplication::instance()->exit(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_runs > 30) {
|
if (m_runs > 30) {
|
||||||
std::cout << "WARNING: too many runs and the test is still not finished!" << std::endl;
|
std::cout << "WARNING: too many runs and the test is still not finished!" << std::endl;
|
||||||
QApplication::instance()->exit(1);
|
QApplication::instance()->exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user