use of com.gargoylesoftware.htmlunit.html.HtmlPage in project JSCover by tntim96.
the class HtmlUnitServerTest method testIncreaseCoverage.
protected void testIncreaseCoverage(int[] branchPercentages, int[] functionPercentages) throws IOException {
HtmlPage page = webClient.getPage("http://localhost:9001/jscoverage.html?" + getTestUrl());
verifyTotal(webClient, page, 15);
page.getHtmlElementById("browserTab").click();
HtmlPage frame = (HtmlPage) page.getFrameByName("browserIframe").getEnclosedPage();
frame.getHtmlElementById("radio1").click();
page.executeJavaScript("jscoverage_recalculateSummaryTab();");
verifyTotals(page, 57, branchPercentages[0], functionPercentages[0]);
frame.getHtmlElementById("radio2").click();
page.executeJavaScript("jscoverage_recalculateSummaryTab();");
verifyTotals(page, 73, branchPercentages[1], functionPercentages[1]);
frame.getHtmlElementById("radio3").click();
page.executeJavaScript("jscoverage_recalculateSummaryTab();");
verifyTotals(page, 84, branchPercentages[2], functionPercentages[2]);
frame.getHtmlElementById("radio4").click();
page.executeJavaScript("jscoverage_recalculateSummaryTab();");
verifyTotals(page, 100, branchPercentages[3], functionPercentages[3]);
}
use of com.gargoylesoftware.htmlunit.html.HtmlPage in project JSCover by tntim96.
the class WebDaemonTest method shouldStopDaemon.
@Test
public void shouldStopDaemon() throws Exception {
HtmlPage page = webClient.getPage("http://localhost:8081/jscoverage.html");
assertThat(page.getTitleText(), equalTo("JSCover"));
main.stop();
server.join(1000);
assertThat(server.getState(), equalTo(Thread.State.TERMINATED));
}
use of com.gargoylesoftware.htmlunit.html.HtmlPage in project JSCover by tntim96.
the class HtmlUnitUITest method shouldSortFilesByCoverage.
@Test
public void shouldSortFilesByCoverage() throws IOException {
HtmlPage page = webClient.getPage("file:///" + new File(reportDir + "/jscoverage.html").getAbsolutePath());
page.getHtmlElementById("summaryTab").click();
webClient.waitForBackgroundJavaScript(2000);
page.getHtmlElementById("sortByName").click();
webClient.waitForBackgroundJavaScript(100);
sortByField(page, "Line");
sortByField(page, "Branch");
sortByField(page, "Function");
}
use of com.gargoylesoftware.htmlunit.html.HtmlPage in project JSCover by tntim96.
the class HtmlUnitUITest method shouldSortFilesByName.
@Test
public void shouldSortFilesByName() throws IOException {
HtmlPage page = webClient.getPage("file:///" + new File(reportDir + "/jscoverage.html").getAbsolutePath());
page.getHtmlElementById("summaryTab").click();
webClient.waitForBackgroundJavaScript(2000);
page.getHtmlElementById("sortByName").click();
webClient.waitForBackgroundJavaScript(100);
Collections.sort(data, byName());
for (int i = 0; i < data.size(); i++) verifyScriptMatchesRow(data.get(i), ((HtmlTableRow) page.getByXPath("//tbody[@id='summaryTbody']/tr[" + (i + 1) + "]").get(0)));
}
use of com.gargoylesoftware.htmlunit.html.HtmlPage in project JSCover by tntim96.
the class HtmlUnitUITest method storeResult.
private static void storeResult() throws IOException {
WebClient webClient = new WebClient();
webClient.getOptions().setTimeout(1000);
HtmlPage page = webClient.getPage("http://localhost:9001/jscoverage.html?index.html");
page.getHtmlElementById("storeTab").click();
webClient.waitForBackgroundJavaScript(500);
page.getHtmlElementById("storeButton").click();
webClient.waitForBackgroundJavaScript(2000);
String result = page.getElementById("storeDiv").getTextContent();
assertThat(result, containsString("Coverage data stored at target"));
}
Aggregations