HtmlElement element = page.getHtmlElementById("qunit-tests");
List<HtmlElement> testResults = element.getElementsByTagName("li");
TestSuite currentModule = null;
for (HtmlElement result : testResults) {
Matcher matcher = summary.matcher(result.asText());
List<HtmlElement> testOutput = result.getElementsByTagName("li");
if (matcher.lookingAt()) {
TestSuite module = getModule(matcher);
TestCase test = buildTest(matcher);
if (currentModule != module) {
if (currentModule != null) {
currentModule.done();
}
currentModule = module;
}
for (HtmlElement outputLine : testOutput) {
test.print(outputLine.getFirstChild().asXml());
}
module.addTest(test);
}
}
}