Search in sources :

Example 11 with HtmlParagraph

use of com.gargoylesoftware.htmlunit.html.HtmlParagraph in project faces by jakartaee.

the class Spec1IT method testSimpleValidFieldsInvalidBean.

/**
 * @see com.sun.faces.ext.component.UIValidateWholeBean
 * @see https://github.com/jakartaee/faces/issues/1
 */
@Test
public void testSimpleValidFieldsInvalidBean() throws Exception {
    HtmlPage page = webClient.getPage(webUrl);
    HtmlTextInput password1 = page.getHtmlElementById("password1");
    password1.setValueAttribute("foofoofoo");
    HtmlTextInput password2 = page.getHtmlElementById("password2");
    password2.setValueAttribute("barbarbar");
    HtmlSubmitInput button = page.getHtmlElementById("submit");
    page = button.click();
    String pageText = page.asXml();
    assertTrue(!pageText.contains("[foofoofoo]"));
    assertTrue(!pageText.contains("[barbarbar]"));
    assertTrue(pageText.contains("Password fields must match"));
    HtmlParagraph password1Value = page.getHtmlElementById("password1Value");
    assertTrue(password1Value.asNormalizedText().isEmpty());
    HtmlParagraph password2Value = page.getHtmlElementById("password2Value");
    assertTrue(password2Value.asNormalizedText().isEmpty());
}
Also used : HtmlTextInput(com.gargoylesoftware.htmlunit.html.HtmlTextInput) HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) HtmlSubmitInput(com.gargoylesoftware.htmlunit.html.HtmlSubmitInput) HtmlParagraph(com.gargoylesoftware.htmlunit.html.HtmlParagraph) Test(org.junit.Test)

Aggregations

HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)11 HtmlParagraph (com.gargoylesoftware.htmlunit.html.HtmlParagraph)11 HtmlAnchor (com.gargoylesoftware.htmlunit.html.HtmlAnchor)7 HtmlDivision (com.gargoylesoftware.htmlunit.html.HtmlDivision)7 HtmlElement (com.gargoylesoftware.htmlunit.html.HtmlElement)7 HtmlHeading2 (com.gargoylesoftware.htmlunit.html.HtmlHeading2)7 HtmlSection (com.gargoylesoftware.htmlunit.html.HtmlSection)7 HtmlSubmitInput (com.gargoylesoftware.htmlunit.html.HtmlSubmitInput)4 HtmlTextInput (com.gargoylesoftware.htmlunit.html.HtmlTextInput)4 Test (org.junit.Test)4 HtmlHeading3 (com.gargoylesoftware.htmlunit.html.HtmlHeading3)3 HtmlListItem (com.gargoylesoftware.htmlunit.html.HtmlListItem)3 HtmlPreformattedText (com.gargoylesoftware.htmlunit.html.HtmlPreformattedText)3 HtmlBold (com.gargoylesoftware.htmlunit.html.HtmlBold)2 HtmlDefinitionDescription (com.gargoylesoftware.htmlunit.html.HtmlDefinitionDescription)2 HtmlDefinitionList (com.gargoylesoftware.htmlunit.html.HtmlDefinitionList)2 HtmlDefinitionTerm (com.gargoylesoftware.htmlunit.html.HtmlDefinitionTerm)2 HtmlHeading4 (com.gargoylesoftware.htmlunit.html.HtmlHeading4)2 HtmlItalic (com.gargoylesoftware.htmlunit.html.HtmlItalic)2 HtmlOrderedList (com.gargoylesoftware.htmlunit.html.HtmlOrderedList)2