Author: jjamrich
Date: 2011-05-17 19:42:01 -0400 (Tue, 17 May 2011)
New Revision: 22497
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richGraphValidator/all.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richGraphValidator/RichGraphValidatorTest.java
Log:
Fix summary attribute test
Side by test fix, add id into relevant components in Metamer
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richGraphValidator/all.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richGraphValidator/all.xhtml 2011-05-16
15:17:29 UTC (rev 22496)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richGraphValidator/all.xhtml 2011-05-17
23:42:01 UTC (rev 22497)
@@ -59,8 +59,8 @@
type="#{richGraphValidatorBean.attributes['type'].value}"
rendered="#{richGraphValidatorBean.attributes['rendered'].value}"
>
<rich:panel id="gv1h" header="Many rich components within
rich:graphValidator" style="width:800px">
- <rich:messages id="messages4gv1" for="gv1" />
- <rich:messages id="globalMessages" globalOnly="true" />
+ <rich:messages for="gv1" />
+ <rich:messages id="gv1_globalMessages" globalOnly="true"
/>
<h:panelGrid columns="6">
<h:outputText for="inplaceSelect" value="Inplace Select"
/>
<rich:inplaceSelect id="inplaceSelect"
value="#{richGraphValidatorBean.inplaceSelect}" >
@@ -104,7 +104,8 @@
<rich:message for="inputSecret" />
<h:outputText for="calendar" value="Calendar" />
- <rich:calendar id="calendar"
value="#{richGraphValidatorBean.calendar}" enableManualInput="true"
/>
+ <rich:calendar id="calendar"
value="#{richGraphValidatorBean.calendar}"
+ enableManualInput="true" />
<rich:message for="calendar" />
<h:column/>
@@ -168,9 +169,9 @@
rendered="#{richGraphValidatorBean.attributes['rendered'].value}"
summary="#{richGraphValidatorBean.attributes['summary'].value}"
type="#{richGraphValidatorBean.attributes['type'].value}"
>
- <rich:panel header="Change password" style="width:500px">
+ <rich:panel id="gv2h" header="Many rich components within
rich:graphValidator" style="width:800px">
<rich:messages for="gv2" />
- <rich:messages globalOnly="true" />
+ <rich:messages id="gv2_globalMessages" globalOnly="true"
/>
<h:panelGrid columns="6">
<h:outputText for="gv2_inplaceSelect" value="Inplace
Select" />
<rich:inplaceSelect id="gv2_inplaceSelect"
value="#{richGraphValidatorBean.inplaceSelect}" >
@@ -214,7 +215,8 @@
<rich:message for="gv2_inputSecret" />
<h:outputText for="gv2_calendar" value="Calendar" />
- <rich:calendar id="gv2_calendar"
value="#{richGraphValidatorBean.calendar}" enableManualInput="true"
/>
+ <rich:calendar id="gv2_calendar"
value="#{richGraphValidatorBean.calendar}"
+ enableManualInput="true" />
<rich:message for="gv2_calendar" />
<h:column/>
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richGraphValidator/RichGraphValidatorTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richGraphValidator/RichGraphValidatorTest.java 2011-05-16
15:17:29 UTC (rev 22496)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richGraphValidator/RichGraphValidatorTest.java 2011-05-17
23:42:01 UTC (rev 22497)
@@ -25,6 +25,8 @@
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Date;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.locator.option.OptionValueLocator;
@@ -40,13 +42,17 @@
public class RichGraphValidatorTest extends AbstractMetamerTest {
private static final String SMILE = ":-)";
- private static final GraphValidatorAttributes attributes = new
GraphValidatorAttributes();
- private static final String[] groups = {"",
"javax.validation.groups.Default",
+ private static final String[] GROUPS = {"",
"javax.validation.groups.Default",
"org.richfaces.tests.metamer.validation.groups.ValidationGroupAllComponents",
"org.richfaces.tests.metamer.validation.groups.ValidationGroupBooleanInputs",
"org.richfaces.tests.metamer.validation.groups.ValidationGroupNumericInputs"};
+ private static final int BOOLEAN_INPUTS_GROUP = 3;
+ private static final int NUMERIC_INPUTS_GROUP = 4;
+
+ private GraphValidatorAttributes attributes = new GraphValidatorAttributes();
+
private JQueryLocator autocomplete = pjq("input[id$=autocompleteInput]");
private JQueryLocator inputSecret = pjq("input[id$=inputSecret]");
private JQueryLocator inputText = pjq("input[id$=inputText]");
@@ -61,7 +67,8 @@
private JQueryLocator inputNumberSliderInput = pjq("span[id$=inputNumberSlider]
input.rf-insl-inp");
private JQueryLocator inputNumberSpinnerInput =
pjq("span[id$=inputNumberSpinner] input.rf-insp-inp");
- private JQueryLocator globalMessagesContainer =
pjq("span[id$=globalMessages]");
+ private JQueryLocator globalMessagesContainer =
pjq("span[id$=_globalMessages]");
+ private JQueryLocator errorMessagesContainer = pjq("span.rf-msgs");
private JQueryLocator header = pjq("div.rf-p-hdr[id$=gv1h_header]");
private OptionValueLocator optionSmile = new OptionValueLocator(SMILE);
@@ -75,16 +82,16 @@
@Test
public void testGroups() {
- for (int i=0; i<groups.length; ++i) {
- attributes.setGroups(groups[i]);
+ for (int i=0; i<GROUPS.length; ++i) {
+ attributes.setGroups(GROUPS[i]);
setAllValidatedFields();
- if (i==3) {
+ if (i == BOOLEAN_INPUTS_GROUP) {
// only Boolean inputs validated
allFieldsSetToWrong();
selenium.check(selectBooleanCheckbox, true);
- } else if (i==4) {
+ } else if (i == NUMERIC_INPUTS_GROUP) {
// only numeric inputs validated
allFieldsSetToWrong();
selenium.type(inputNumberSliderInput, "10");
@@ -97,14 +104,23 @@
// wait for success validation
waitGui.until(textEquals
.locator(globalMessagesContainer.getDescendant(jq("span.rf-msgs-sum")))
- .text("Action sucessfully done!"));
+ .text("Action sucessfully done!"));
}
}
@Test
public void testSummary() {
+ String msg = "My own validation message!";
+ attributes.setSummary(msg);
+
setAllValidatedFields();
- // !!! Seems that there is bug - no content rendered when set summary attr
+ allFieldsSetToWrong();
+
+ selenium.click(applyChangesBtn);
+
+ waitGui.until(textEquals
+
.locator(errorMessagesContainer.getDescendant(jq("span.rf-msgs-sum")))
+ .text(msg));
}
@Test
@@ -120,7 +136,7 @@
// wait for success validation
waitGui.until(textEquals
.locator(globalMessagesContainer.getDescendant(jq("span.rf-msgs-sum")))
- .text("Action sucessfully done!"));
+ .text("Action sucessfully done!"));
}
@Test
@@ -132,7 +148,7 @@
waitGui.until(isNotDisplayed.locator(header));
}
- private void setAllValidatedFields(){
+ private void setAllValidatedFields() {
// inputSecret don't keed entered value after submit
selenium.type(inputSecret, SMILE);
@@ -143,17 +159,21 @@
}
private void allFieldsSetToWrong() {
- selenium.type(inplaceSelect, "---");
- selenium.type(inplaceInput, "---");
+ String wrongString = "---";
+ SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy");
+ String wrongDate = sdf.format(new Date(System.currentTimeMillis() +
24*60*60*1000));
+
+ selenium.type(inplaceSelect, wrongString);
+ selenium.type(inplaceInput, wrongString);
selenium.type(inputNumberSpinnerInput, "10");
selenium.check(selectBooleanCheckbox, false);
- selenium.type(inputSecret, "---");
+ selenium.type(inputSecret, wrongString);
selenium.type(inputNumberSliderInput, "15");
selenium.type(inputNumberSpinnerInput, "15");
- selenium.type(autocomplete, "---");
- selenium.type(inputText, "---");
- selenium.type(calendar, "");
- selenium.type(inputTextArea, "---");
+ selenium.type(autocomplete, wrongString);
+ selenium.type(inputText, wrongString);
+ selenium.type(calendar, wrongDate);
+ selenium.type(inputTextArea, wrongString);
}
}