示例#1
0
 @Test
 public void testConfigurationEffective() throws Exception {
   HtmlPage page = webClient.getPage(webUrl + "faces/spec566.xhtml");
   HtmlTextInput input1 = (HtmlTextInput) page.getHtmlElementById("input1");
   input1.setTextContent("3");
   HtmlTextInput input2 = (HtmlTextInput) page.getHtmlElementById("input2");
   input2.setTextContent("4");
   HtmlSubmitInput button = (HtmlSubmitInput) page.getHtmlElementById("reload");
   page = button.click();
   input1 = (HtmlTextInput) page.getHtmlElementById("input1");
   input1.setValueAttribute("");
   input2 = (HtmlTextInput) page.getHtmlElementById("input2");
   input2.setValueAttribute("abcd");
   button = (HtmlSubmitInput) page.getHtmlElementById("reload");
   page = button.click();
   HtmlElement message1 = page.getHtmlElementById("input1Message");
   assertTrue(!message1.getTextContent().contains("input1:"));
   HtmlElement message2 = page.getHtmlElementById("input2Message");
   assertTrue(message2.getTextContent().contains("input2:"));
   input1 = (HtmlTextInput) page.getElementById("input1");
   assertEquals(0, input1.getTextContent().length());
   input2 = (HtmlTextInput) page.getElementById("input2");
   assertEquals("abcd", input2.getValueAttribute());
 }