use of com.gargoylesoftware.htmlunit.html.HtmlImage in project promoted-builds-plugin by jenkinsci.
the class PromotedBuildActionTest method testDeletedPromotionProcess.
@Test
public void testDeletedPromotionProcess() throws Exception {
FreeStyleProject p = j.createFreeStyleProject();
JobPropertyImpl base = new JobPropertyImpl(p);
p.addProperty(base);
PromotionProcess foo = base.addProcess("foo");
// promote a build
FreeStyleBuild b1 = j.assertBuildStatusSuccess(p.scheduleBuild2(0));
foo.promote(b1, new UserCause(), new ManualPromotionBadge());
// now delete the promotion process
p.removeProperty(base);
p.addProperty(base = new JobPropertyImpl(p));
assertTrue(base.getActiveItems().isEmpty());
// make sure that the page renders OK without any error
HtmlPage page = j.createWebClient().getPage(p);
List<?> candidates = page.getByXPath("//IMG");
for (Object candidate : candidates) {
if (!(candidate instanceof HtmlImage)) {
continue;
}
HtmlImage img = (HtmlImage) candidate;
try {
assertEquals("Failed to load " + img.getSrcAttribute(), 200, img.getWebResponse(true).getStatusCode());
} catch (IOException e) {
throw new AssertionError("Failed to load " + img.getSrcAttribute());
}
}
}
use of com.gargoylesoftware.htmlunit.html.HtmlImage 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"));
}
Aggregations