Search in sources :

Example 1 with HtmlTableCell

use of com.gargoylesoftware.htmlunit.html.HtmlTableCell in project selenium_java by sergueik.

the class WhenBrowsingReportsList method checkReportTitle.

private void checkReportTitle(final HtmlTableRow row) {
    final HtmlTableCell cell = row.getCell(1);
    final String text = cell.getTextContent();
    Assert.assertFalse("Unexpected blank text in report title", text.isEmpty());
}
Also used : HtmlTableCell(com.gargoylesoftware.htmlunit.html.HtmlTableCell)

Example 2 with HtmlTableCell

use of com.gargoylesoftware.htmlunit.html.HtmlTableCell in project JSCover by tntim96.

the class HtmlUnitServerBranchAndFunctionTest method verifySource.

private void verifySource(HtmlTable sourceTable, int row, int coverageCount, String source, String alertLine, String cssClass) throws IOException {
    assertThat(sourceTable.getRow(row).getCell(1).asText(), equalTo("" + coverageCount));
    assertThat(sourceTable.getRow(row).getCell(3).asText(), equalTo(source));
    HtmlTableCell branchCell = sourceTable.getRow(row).getCell(2);
    if (alertLine == null) {
        assertThat(branchCell.asText(), equalTo(" "));
        assertThat(branchCell.getAttribute("class"), equalTo("numeric " + cssClass));
    } else {
        assertThat(branchCell.asText(), equalTo("info"));
        HtmlAnchor anchor = (HtmlAnchor) branchCell.getFirstChild().getFirstChild();
        final String[] alert = new String[1];
        webClient.setAlertHandler((page, message) -> alert[0] = message);
        anchor.click();
        assertThat(alert[0], containsString(alertLine));
    }
}
Also used : HtmlAnchor(com.gargoylesoftware.htmlunit.html.HtmlAnchor) Matchers.containsString(org.hamcrest.Matchers.containsString) HtmlTableCell(com.gargoylesoftware.htmlunit.html.HtmlTableCell)

Example 3 with HtmlTableCell

use of com.gargoylesoftware.htmlunit.html.HtmlTableCell in project selenium_java by sergueik.

the class WhenBrowsingReportsList method checkReportIcon.

private void checkReportIcon(final HtmlTableRow row) {
    final HtmlTableCell cell = row.getCell(0);
    final List<HtmlElement> elements = cell.getHtmlElementsByTagName("img");
    Assert.assertEquals("Unexpected number of image elements", 1, elements.size());
    final HtmlImage img = (HtmlImage) elements.get(0);
    final String iconPath = img.getSrcAttribute().toUpperCase();
    Assert.assertTrue("Unexpected report icon: ", iconPath.endsWith("/DOCUMENT.GIF"));
}
Also used : HtmlImage(com.gargoylesoftware.htmlunit.html.HtmlImage) HtmlElement(com.gargoylesoftware.htmlunit.html.HtmlElement) HtmlTableCell(com.gargoylesoftware.htmlunit.html.HtmlTableCell)

Example 4 with HtmlTableCell

use of com.gargoylesoftware.htmlunit.html.HtmlTableCell in project selenium_java by sergueik.

the class WhenBrowsingReportsList method checkReportDescription.

private void checkReportDescription(final HtmlTableRow row) {
    final HtmlTableCell cell = row.getCell(2);
    final String text = cell.getTextContent();
    Assert.assertFalse("Unexpected blank text in report description", text.isEmpty());
}
Also used : HtmlTableCell(com.gargoylesoftware.htmlunit.html.HtmlTableCell)

Example 5 with HtmlTableCell

use of com.gargoylesoftware.htmlunit.html.HtmlTableCell in project selenium_java by sergueik.

the class WhenBrowsingReportsList method checkReportInfo.

private void checkReportInfo(final HtmlTableRow row) {
    final HtmlTableCell cell = row.getCell(3);
    final String text = cell.getTextContent();
    Assert.assertFalse("Unexpected blank text in report info", text.isEmpty());
}
Also used : HtmlTableCell(com.gargoylesoftware.htmlunit.html.HtmlTableCell)

Aggregations

HtmlTableCell (com.gargoylesoftware.htmlunit.html.HtmlTableCell)6 HtmlAnchor (com.gargoylesoftware.htmlunit.html.HtmlAnchor)1 HtmlElement (com.gargoylesoftware.htmlunit.html.HtmlElement)1 HtmlImage (com.gargoylesoftware.htmlunit.html.HtmlImage)1 HtmlTableRow (com.gargoylesoftware.htmlunit.html.HtmlTableRow)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1