Author: dsvyatobatsko
Date: 2008-09-25 06:28:16 -0400 (Thu, 25 Sep 2008)
New Revision: 10551
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/GraphValidatorTest.java
Log:
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/GraphValidatorTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/GraphValidatorTest.java 2008-09-24
17:09:39 UTC (rev 10550)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/GraphValidatorTest.java 2008-09-25
10:28:16 UTC (rev 10551)
@@ -22,8 +22,8 @@
public void testGraphValidatorComponentWithComponentSubtree(Template template) {
renderPage(template);
- writeStatus("Check that components subtree confined by the component is
validated " +
- "with Hibernate Validator properly");
+ writeStatus("Check that components subtree confined by the component is
validated "
+ + "with Hibernate Validator properly");
String parentId = getParentId() + "_form:";
String tfNameId = parentId + NAME;
@@ -75,21 +75,32 @@
public void testGraphValidatorComponentWithValueBoundToBean(Template template) {
renderPage(template);
- writeStatus("Check that component validates a bean bound to component value
property. " +
- "After model is updated the bean must be validated again.");
+ writeStatus("Check that component validates a bean bound to component value
property. "
+ + "After model is updated the bean must be validated again.");
String parentId = getParentId() + "_form1:";
- String firstCompId = parentId + "table:0:time";
String firstCompErrMsg = parentId + "table:0:time" + ERR_MSG_POSTFIX;
String saveBtn = parentId + SAVE_BTN;
String allMessages = parentId + ALL_MSGS;
-// writeStatus("Try to save an input. Model validation cannot be
passed");
-// clickAjaxCommandAndWait(saveBtn);
-//
-// AssertTextEquals(allMessages, "Invalid values: Please fill at least one
entry");
-
+ writeStatus("Try to save an input. Model validation cannot be
passed");
+ clickAjaxCommandAndWait(saveBtn);
+
+ AssertTextEquals(allMessages, "Invalid values: Please fill at least one
entry");
+
+ writeStatus("Check bean properties are validated at validation phase. Type
time of sport activity greater than allowed");
+ spinnerManualInput("13");
+
+ clickAjaxCommandAndWait(saveBtn);
+ assertPresent(firstCompErrMsg);
+
+ writeStatus("Correct the input and save data again");
+ spinnerManualInput("11");
+ clickAjaxCommandAndWait(saveBtn);
+ assertNotPresent(firstCompErrMsg);
+
+ AssertTextEquals(allMessages, "Changes Stored Successfully");
}
private void assertPresent(String id) {
@@ -100,6 +111,10 @@
AssertTextEquals(id, "", "Message [" + id + "] must be
empty on the page");
}
+ private void spinnerManualInput(String value) {
+ type("xpath=//table[@id='" + getParentId() +
"_form1:table:0:time']/tbody/tr/td/input", value);
+ }
+
@Override
public String getTestUrl() {
return "pages/graphValidator/graphValidatorTest.xhtml";