test: detect site case failures explicitly
This commit is contained in:
parent
c73dbc8503
commit
9e70dde366
@ -260,6 +260,16 @@ void cli_run_http_smoke()
|
||||
cli_expect_http("uce_http_smoke:configurable error page 500 + error info", "/demo/error-reporting.uce?mode=trap", 500, "mode=trap");
|
||||
}
|
||||
|
||||
bool cli_site_body_reports_failure(String lower)
|
||||
{
|
||||
if(cli_contains(lower, "status-badge status-error\">fail</span>"))
|
||||
return(true);
|
||||
for(String digit : split("1 2 3 4 5 6 7 8 9", " "))
|
||||
if(cli_contains(lower, ">failed " + digit))
|
||||
return(true);
|
||||
return(false);
|
||||
}
|
||||
|
||||
void cli_run_site_suite()
|
||||
{
|
||||
DValue manifest;
|
||||
@ -287,13 +297,13 @@ void cli_run_site_suite()
|
||||
for(String marker : { "compile error", "runtime error", "timed out acquiring compile lock", "near line" })
|
||||
if(cli_contains(lower, marker))
|
||||
ok = false;
|
||||
if(cli_contains(lower, "<div class=\"tests-summary\">") && !cli_contains(lower, ">failed 0</span>"))
|
||||
if(cli_contains(lower, "<div class=\"tests-summary\">") && cli_site_body_reports_failure(lower))
|
||||
ok = false;
|
||||
if(ok)
|
||||
break;
|
||||
}
|
||||
String name = "uce_site_suite:site tests " + (file == "index.uce" ? "index" : file == "io.uce" ? "filesystem" : file == "websockets.ws.uce" ? "websockets page" : replace(replace(replace(file, ".uce", ""), ".ws", ""), "_", " "));
|
||||
String fail_detail = "; status=" + std::to_string(res.status) + "; expected_marker=" + (cli_contains(res.body, expected) ? "yes" : "no") + "; summary=" + (cli_contains(lower, "<div class=\"tests-summary\">") ? "yes" : "no") + "; failed_zero=" + (cli_contains(lower, ">failed 0</span>") ? "yes" : "no") + "; body=" + cli_truncate(res.body);
|
||||
String fail_detail = "; status=" + std::to_string(res.status) + "; expected_marker=" + (cli_contains(res.body, expected) ? "yes" : "no") + "; summary=" + (cli_contains(lower, "<div class=\"tests-summary\">") ? "yes" : "no") + "; reports_failure=" + (cli_site_body_reports_failure(lower) ? "yes" : "no") + "; body=" + cli_truncate(res.body);
|
||||
cli_test_case(name, ok, (ok ? "HTTP 200 with suite page marker and no failed cases for /tests/" : "site suite failed for /tests/") + file + (ok ? "" : fail_detail));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user