use of com.gargoylesoftware.htmlunit.html.HtmlPage 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.HtmlPage in project javaee7-samples by javaee-samples.
the class UserTest method testLinkWithParam.
@Test
public void testLinkWithParam() throws IOException {
HtmlAnchor anchor = (HtmlAnchor) page.getElementById("link2");
assertTrue(anchor.getHrefAttribute().contains("faces/login.xhtml"));
assertTrue(anchor.getHrefAttribute().contains("?name=Jack"));
assertEquals("Login2", anchor.asText());
HtmlPage output = anchor.click();
assertEquals("HTTP GET (Login)", output.getTitleText());
}
use of com.gargoylesoftware.htmlunit.html.HtmlPage in project javaee7-samples by javaee-samples.
the class UserTest method testLink.
@Test
public void testLink() throws IOException {
HtmlAnchor anchor = (HtmlAnchor) page.getElementById("link1");
assertTrue(anchor.getHrefAttribute().contains("faces/login.xhtml"));
assertEquals("Login1", anchor.asText());
HtmlPage output = anchor.click();
assertEquals("HTTP GET (Login)", output.getTitleText());
}
use of com.gargoylesoftware.htmlunit.html.HtmlPage 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.HtmlPage 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());
}
Aggregations