use of com.gargoylesoftware.htmlunit.html.HtmlSpan in project javaee7-samples by javaee-samples.
the class MyBeanTest method testZipAlphabets.
@Test
public void testZipAlphabets() throws IOException {
nameInputText.setText("abc");
ageInputText.setText("20");
zipInputText.setText("abcde");
HtmlPage result = button.click();
HtmlSpan span = (HtmlSpan) result.getElementById("zipMessage");
assertEquals("must match \"[0-9]{5}\"", span.asText());
}
use of com.gargoylesoftware.htmlunit.html.HtmlSpan in project javaee7-samples by javaee-samples.
the class MyBeanTest method testAgeLessThan.
@Test
public void testAgeLessThan() throws IOException {
nameInputText.setText("abc");
ageInputText.setText("16");
zipInputText.setText("12345");
HtmlPage result = button.click();
HtmlSpan span = (HtmlSpan) result.getElementById("ageMessage");
assertEquals("must be greater than or equal to 18", span.asText());
}
use of com.gargoylesoftware.htmlunit.html.HtmlSpan in project javaee7-samples by javaee-samples.
the class MyBeanTest method testZipBoundary.
@Test
public void testZipBoundary() throws IOException {
nameInputText.setText("abc");
ageInputText.setText("20");
zipInputText.setText("12345");
HtmlPage result = button.click();
HtmlSpan span = (HtmlSpan) result.getElementById("zipMessage");
assertEquals("", span.asText());
}
use of com.gargoylesoftware.htmlunit.html.HtmlSpan in project core by weld.
the class JsfTest method testELWithParameters.
@Test
public void testELWithParameters(@ArquillianResource URL baseURL) throws Exception {
WebClient client = new WebClient();
HtmlPage page = client.getPage(new URL(baseURL, "charlie.jsf"));
page.asXml();
HtmlSpan oldel = getFirstMatchingElement(page, HtmlSpan.class, "oldel");
assertNotNull(oldel);
final String charlie = "Charlie";
assertEquals(charlie, oldel.asText());
HtmlSpan newel = getFirstMatchingElement(page, HtmlSpan.class, "newel");
assertNotNull(newel);
assertEquals(charlie, newel.asText());
}
use of com.gargoylesoftware.htmlunit.html.HtmlSpan in project JSCover by tntim96.
the class HtmlUnitJSTest method shouldTestJavaScript.
@Test
public void shouldTestJavaScript() throws Exception {
HtmlPage page = webClient.getPage("http://localhost:8081/jscoverage.html?src/test/javascript/spec/suite.html");
webClient.waitForBackgroundJavaScript(2000);
// Verify Jasmine test result
HtmlPage frame = (HtmlPage) page.getFrameByName("browserIframe").getEnclosedPage();
List<HtmlSpan> passed = frame.getByXPath("//span[contains(@class,'jasmine-passed')]");
assertThat(passed.size(), equalTo(1));
assertThat(frame.getByXPath("//span[contains(@class,'jasmine-failed')]").size(), equalTo(0));
assertThat(frame.getByXPath("//span[contains(@class,'jasmine-skipped')]").size(), equalTo(0));
assertThat(passed.get(0).asText(), startsWith("15 specs, 0 failures"));
// Store Report
frame.executeJavaScript("jscoverage_report();");
webClient.waitForBackgroundJavaScript(2000);
// Verify coverage
page.getHtmlElementById("summaryTab").click();
webClient.waitForBackgroundJavaScript(2000);
assertEquals("100%", page.getElementById("summaryTotal").getTextContent());
}