Author: jjamrich
Date: 2011-10-21 08:25:11 -0400 (Fri, 21 Oct 2011)
New Revision: 22838
Added:
modules/tests/metamer/trunk/ftest-pomxml.diff
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestWrappingValidatorSingle.java
Log:
RF-11139: fix test: add test strategy according to way how to invoke validation
There are 2 ways: submit form (where is XHR request fired even validation failed, and just
blur event fired on input with rich:validator, which is able to not send any request if
CSV failed
Added: modules/tests/metamer/trunk/ftest-pomxml.diff
===================================================================
--- modules/tests/metamer/trunk/ftest-pomxml.diff (rev 0)
+++ modules/tests/metamer/trunk/ftest-pomxml.diff 2011-10-21 12:25:11 UTC (rev 22838)
@@ -0,0 +1,114 @@
+diff --git a/ftest/pom.xml b/ftest/pom.xml
+index f3dbab0..4bc4f9a 100644
+--- a/ftest/pom.xml
++++ b/ftest/pom.xml
+@@ -152,7 +152,7 @@
+ <id>container-deploy-artifact</id>
+ <activation>
+ <property>
+- <name>containerId</name>
++ <name>containerId-XYZ</name>
+ </property>
+ </activation>
+ <build>
+@@ -469,7 +469,7 @@
+ <type>war</type>
+
<classifier>${deployable.classifier}</classifier>
+ <overWrite>true</overWrite>
+-
<outputDirectory>target/metamer</outputDirectory>
++
<outputDirectory>target/metamer-modified</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+
<overWriteReleases>true</overWriteReleases>
+@@ -487,7 +487,7 @@
+ <id>org.richfaces.resourceMapping.enabled</id>
+ <activation>
+ <property>
+- <name>org.richfaces.resourceMapping.enabled</name>
++ <name>org.richfaces.resourceMapping.enabledXYZ</name>
+ </property>
+ </activation>
+ <build>
+@@ -496,22 +496,27 @@
+
<groupId>com.google.code.maven-replacer-plugin</groupId>
+ <artifactId>maven-replacer-plugin</artifactId>
+ <version>1.3.9</version>
+- <executions>
+-
++ <executions>
+ <execution>
+
<id>replacer-org.richfaces.resourceMapping.enabled</id>
+- <phase>process-test-resources</phase>
++ <phase>process-resources</phase>
+ <goals>
+ <goal>replace</goal>
+ </goals>
+ <configuration>
+-
<file>target/metamer/WEB-INF/web.xml</file>
+- <regex>false</regex>
+-
<token><param-name>org.richfaces.resourceMapping.enabled</param-name>\s*<param-value>false</param-value>></token>
+-
<value><param-name>org.richfaces.resourceMapping.enabled</param-name>\n\t<param-value>true</param-value>></value>
++
<file>target/metamer-modified/WEB-INF/web.xml</file>
++ <regex>true</regex>
++ <regexFlags>
++ <regexFlag>MULTILINE</regexFlag>
++ </regexFlags>
++ <replacements>
++ <replacement>
++
<token><param-name>org.richfaces.resourceMapping.enabled</param-name>\s*<param-value>false</param-value></token>
++
<value><param-name>org.richfaces.resourceMapping.enabled</param-name><param-value>true</param-value></value>
++ </replacement>
++ </replacements>
+ </configuration>
+- </execution>
+-
++ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+@@ -535,12 +540,12 @@
+ <executions>
+ <execution>
+
<id>replacer-org.richfaces.resourceMapping.compressedStages</id>
+- <phase>generate-test-resources</phase>
++ <phase>process-resources</phase>
+ <goals>
+ <goal>replace</goal>
+ </goals>
+ <configuration>
+-
<file>target/metamer/WEB-INF/web.xml</file>
++
<file>target/metamer-modified/WEB-INF/web.xml</file>
+ <regex>true</regex>
+ <regexFlags>
+ <regexFlag>MULTILINE</regexFlag>
+@@ -572,12 +577,12 @@
+ <executions>
+ <execution>
+
<id>replacer-org.richfaces.resourceMapping.packedStages</id>
+- <phase>generate-test-resources</phase>
++ <phase>process-resources</phase>
+ <goals>
+ <goal>replace</goal>
+ </goals>
+ <configuration>
+-
<file>target/metamer/WEB-INF/web.xml</file>
++
<file>target/metamer-modified/WEB-INF/web.xml</file>
+ <regex>true</regex>
+ <regexFlags>
+ <regexFlag>MULTILINE</regexFlag>
+@@ -607,13 +612,13 @@
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+
<classifier>${deployable.classifier}</classifier>
+-
<webappDirectory>target/metamer</webappDirectory>
++
<warSourceDirectory>target/metamer-modified</warSourceDirectory>
+ <warName>metamer-updated</warName>
+ </configuration>
+ <executions>
+ <execution>
+ <id>repack-metamer-back-to-war</id>
+- <phase>generate-test-resources</phase>
++ <phase>process-resources</phase><!--
process-test-resources -->
+ <goals>
+ <goal>war</goal>
+ </goals>
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestWrappingValidatorSingle.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestWrappingValidatorSingle.java 2011-10-21
12:24:54 UTC (rev 22837)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestWrappingValidatorSingle.java 2011-10-21
12:25:11 UTC (rev 22838)
@@ -22,9 +22,12 @@
package org.richfaces.tests.metamer.ftest.richValidator;
import static
org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
import java.net.URL;
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.utils.URLUtils;
import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.testng.annotations.Test;
@@ -40,6 +43,11 @@
* @version $Revision$
*/
public class TestWrappingValidatorSingle extends AbstractValidatorsTest {
+
+ private JQueryLocator input = pjq("input[id$=:min]");
+ private JQueryLocator setCorrectValBtn =
pjq("input[id$=setCorrectValuesButton]");
+ private JQueryLocator a4jSubmitBtn = pjq("input[id$=a4jButton]");
+ private JQueryLocator msg = pjq("span[id$=minMsg] span.rf-msg-err");
/** component page locator */
@Override
@@ -48,16 +56,32 @@
}
@Test
- @IssueTracking("https://issues.jboss.org/browse/RF-11139")
+ @IssueTracking("https://issues.jboss.org/browse/RF-11576")
public void testIntegerMin() {
- selenium.click(pjq("input[id$=setCorrectValuesButton]"));
+ selenium.click(setCorrectValBtn);
// integer input min
- selenium.type(pjq("input[id$=:min]"), "-544");
- guardNoRequest(selenium).click(pjq("input[id$=a4jButton]"));
+ selenium.type(input, "1");
+ guardNoRequest(selenium).click(a4jSubmitBtn);
- waitGui.until(textEquals.locator(pjq("span[id$=minMsg]
span.rf-msg-det"))
- .text("must be greater than or equal to 2"));
+ waitGui.until(textEquals.locator(msg).text("must be greater than or equal to
2"));
}
+ /**
+ * Check validation on input after blur event fired and no XHR request as well
+ *
+ */
+ @Test
+ public void testValidateOnBlur() {
+ selenium.click(setCorrectValBtn);
+
+ // integer input min
+ selenium.type(input , "1");
+
+ // no request (HTTP neither XHR) should be sent if validation fails
+ guardNoRequest(selenium).fireEvent(input, Event.BLUR);
+
+ waitModel.until(textEquals.locator(msg).text("must be greater than or equal
to 2"));
+ }
+
}