Author: jjamrich
Date: 2011-06-06 08:47:11 -0400 (Mon, 06 Jun 2011)
New Revision: 22525
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/AbstractValidatorsTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestValidators.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestValidatorsCSV.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestValidatorsJSR303.java
Log:
Add selenium tests for validators
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/AbstractValidatorsTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/AbstractValidatorsTest.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/AbstractValidatorsTest.java 2011-06-06
12:47:11 UTC (rev 22525)
@@ -0,0 +1,405 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richValidator;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.testng.annotations.BeforeClass;
+
+/**
+ * Abstract class with selenium test for validators
+ *
+ * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
+ * @version $Revision$
+ */
+public abstract class AbstractValidatorsTest extends AbstractMetamerTest {
+
+
+ private enum ID {
+ /** Boolean, true */ assertTrue,
+ /** Boolean false */ assertFalse,
+ /** Decimal from 2.5 to 9.688 */ decimalMinMax,
+ /** Decimal 3 digits and 4 fract */ digits ,
+ /** Integer max 10 */ max,
+ /** Integer min 2 */ min,
+ /** Integer from 2 to 10 */ minMax,
+ /** Text, not empty */ notEmpty,
+ /** Text, not null */ notNull,
+ /** Text, pattern '[a-z].*' */ pattern,
+ /** custom validator */ custom,
+ /** custom regExp validator */ regexp,
+ /** date past */ past,
+ /** date future */ future,
+ /** String size from 2 to 4 */ stringSize,
+ /** Selection size */ size
+ }
+
+ private Map<ID, String> messages = new HashMap<AbstractValidatorsTest.ID,
String>();
+
+ private Map<ID, Object> wrongValue = new HashMap<AbstractValidatorsTest.ID,
Object>();
+
+ private JQueryLocator inputFormat = pjq("input[id$=:{0}]");
+
+ private JQueryLocator setWrongBtn =
pjq("input[id$=setWrongValuesButton]");
+ private JQueryLocator setCorrectBtn =
pjq("input[id$=setCorrectValuesButton]");
+
+ private JQueryLocator hCommandBtn = pjq("input[id$=hButton]");
+ private JQueryLocator a4jCommandBtn = pjq("input[id$=a4jButton]");
+
+ private JQueryLocator selectionItem = pjq("table[id$=:size] tr > td >
input[value={0}]");
+
+ private JQueryLocator msgFormat = pjq("span[id$={0}Msg] span.rf-msg-det");
+
+ @BeforeClass
+ public void init() {
+ messages.put(ID.assertTrue, "must be true");
+ messages.put(ID.assertFalse, "must be false");
+ messages.put(ID.decimalMinMax, "must be less than or equal to 9.688");
+ messages.put(ID.digits, "numeric value out of bounds (<3 digits>.<4
digits> expected)");
+ messages.put(ID.max, "must be less than or equal to 10");
+ messages.put(ID.min, "must be greater than or equal to 2");
+ messages.put(ID.minMax, "must be greater than or equal to 2");
+ messages.put(ID.notEmpty, "may not be empty");
+ messages.put(ID.notNull, "may not be null");
+ messages.put(ID.pattern, "must match \"[a-z].*\"");
+ messages.put(ID.custom, "string is not \"RichFaces\"");
+ messages.put(ID.regexp, "Regex pattern of '\\d{3}' not
matched");
+ messages.put(ID.past, "must be in the past");
+ messages.put(ID.future, "must be in the future");
+ messages.put(ID.stringSize, "size must be between 2 and 4");
+ messages.put(ID.size, "???????"); // RF-11035
+
+ wrongValue.put(ID.assertTrue, Boolean.FALSE);
+ wrongValue.put(ID.assertFalse, Boolean.TRUE);
+ wrongValue.put(ID.decimalMinMax, "10.688");
+ wrongValue.put(ID.digits, "15.627123");
+ wrongValue.put(ID.max, "122");
+ wrongValue.put(ID.min, "-544");
+ wrongValue.put(ID.minMax, "-5");
+ wrongValue.put(ID.notEmpty, "");
+ wrongValue.put(ID.notNull, null);
+ wrongValue.put(ID.pattern, "@@@");
+ wrongValue.put(ID.custom, "@@@");
+ wrongValue.put(ID.regexp, "@@@");
+
+ SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy");
+ long offset = 24 * 60 * 60 * 1000; // more than 24 hours to get correct past
date
+ wrongValue.put(ID.past, sdf.format(new Date(System.currentTimeMillis() +
offset)));
+ wrongValue.put(ID.future, sdf.format(new Date(System.currentTimeMillis() -
offset)));
+
+ wrongValue.put(ID.stringSize, "JSF 2");
+ wrongValue.put(ID.size, "F"); // RF-11035
+ }
+
+ public void verifyAllWrongWithAjaxSubmit() {
+ selenium.click(setWrongBtn);
+
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.assertTrue)).text(messages.get(ID.assertTrue)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.assertFalse)).text(messages.get(ID.assertFalse)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.decimalMinMax)).text(messages.get(ID.decimalMinMax)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.digits)).text(messages.get(ID.digits)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.max)).text(messages.get(ID.max)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.min)).text(messages.get(ID.min)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.minMax)).text(messages.get(ID.minMax)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.notEmpty)).text(messages.get(ID.notEmpty)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.notNull)).text(messages.get(ID.notNull)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.pattern)).text(messages.get(ID.pattern)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.custom)).text(messages.get(ID.custom)));
+
+ if (selenium.isElementPresent(inputFormat.format(ID.regexp))) {
+ // regExp validator isn't present in JSR303 validation
+
waitGui.until(textEquals.locator(msgFormat.format(ID.regexp)).text(messages.get(ID.regexp)));
+ }
+
waitGui.until(textEquals.locator(msgFormat.format(ID.past)).text(messages.get(ID.past)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.future)).text(messages.get(ID.future)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.stringSize)).text(messages.get(ID.stringSize)));
+ // TODO JJa 2011-06-06: remove comment when fixed issue with manyCheckbox
validation
+ //
waitGui.until(textEquals.locator(msgFormat.format(ID.size)).text(messages.get(ID.size)));
+ }
+
+ @IssueTracking(value = "https://issues.jboss.org/browse/RF-11035")
+ public void verifyAllWrongWithJSFSubmit() {
+ selenium.click(setCorrectBtn);
+
+ selenium.click(hCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.assertTrue)).text(messages.get(ID.assertTrue)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.assertFalse)).text(messages.get(ID.assertFalse)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.decimalMinMax)).text(messages.get(ID.decimalMinMax)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.digits)).text(messages.get(ID.digits)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.max)).text(messages.get(ID.max)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.min)).text(messages.get(ID.min)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.minMax)).text(messages.get(ID.minMax)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.notEmpty)).text(messages.get(ID.notEmpty)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.notNull)).text(messages.get(ID.notNull)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.pattern)).text(messages.get(ID.pattern)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.custom)).text(messages.get(ID.custom)));
+
+ if (selenium.isElementPresent(inputFormat.format(ID.regexp))) {
+ // regExp validator isn't present in JSR303 validation
+
waitGui.until(textEquals.locator(msgFormat.format(ID.regexp)).text(messages.get(ID.regexp)));
+ }
+
waitGui.until(textEquals.locator(msgFormat.format(ID.past)).text(messages.get(ID.past)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.future)).text(messages.get(ID.future)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.stringSize)).text(messages.get(ID.stringSize)));
+
waitGui.until(textEquals.locator(msgFormat.format(ID.size)).text(messages.get(ID.size)));
+ }
+
+ /**
+ * Boolean input, verify true
+ */
+ public void verifyBooleanTrue() {
+
+ selenium.click(setCorrectBtn);
+
+ // checkBoolean to true
+ selenium.check(inputFormat.format(ID.assertTrue), (Boolean)
wrongValue.get(ID.assertTrue));
+
+ // guardNoRequest(selenium).click(a4jCommandBtn);
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.assertTrue)).text(messages.get(ID.assertTrue)));
+ }
+
+ /**
+ * Boolean input, verify false
+ */
+ public void verifyBooleanFalse() {
+
+ selenium.click(setCorrectBtn);
+
+ // checkBoolean to false
+ selenium.check(inputFormat.format(ID.assertFalse), (Boolean)
wrongValue.get(ID.assertFalse));
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.assertFalse)).text(messages.get(ID.assertFalse)));
+ }
+
+ /**
+ * Decimal input, verify from 2.5 to 9.688
+ */
+ protected void verifyDecimalMinMax() {
+
+ selenium.click(setCorrectBtn);
+
+ // Decimal input
+ selenium.type(inputFormat.format(ID.decimalMinMax),
wrongValue.get(ID.decimalMinMax).toString());
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.decimalMinMax)).text(messages.get(ID.decimalMinMax)));
+ }
+
+ /**
+ * Decimal input, verify digits
+ */
+ protected void verifyDecimalDigits() {
+
+ selenium.click(setCorrectBtn);
+
+ // decimal input digits
+ selenium.type(inputFormat.format(ID.digits),
wrongValue.get(ID.digits).toString());
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.decimalMinMax)).text(messages.get(ID.decimalMinMax)));
+ }
+
+ /**
+ * Integer input, verify max
+ */
+ protected void verifyMax() {
+
+ selenium.click(setCorrectBtn);
+
+ // integer input max
+ selenium.type(inputFormat.format(ID.max), wrongValue.get(ID.max).toString());
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.max)).text(messages.get(ID.max)));
+ }
+
+ /**
+ * Integer input, verify min
+ */
+ protected void verifyMin() {
+
+ selenium.click(setCorrectBtn);
+
+ // integer input min
+ selenium.type(inputFormat.format(ID.min), wrongValue.get(ID.min).toString());
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.min)).text(messages.get(ID.min)));
+ }
+
+ /**
+ * Integer input, verify min max
+ */
+ protected void verifyMinMax() {
+
+ selenium.click(setCorrectBtn);
+
+ // integer input min and max
+ selenium.type(inputFormat.format(ID.minMax),
wrongValue.get(ID.minMax).toString());
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.minMax)).text(messages.get(ID.minMax)));
+ }
+
+ /**
+ * Integer input, verify not empty
+ */
+ protected void verifyNotEmpty() {
+
+ selenium.click(setCorrectBtn);
+
+ // string input not empty
+ selenium.type(inputFormat.format(ID.notEmpty),
wrongValue.get(ID.notEmpty).toString());
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.notEmpty)).text(messages.get(ID.notEmpty)));
+ }
+
+ /**
+ * Integer input, verify not null
+ */
+ protected void verifyNotNull() {
+
+ selenium.click(setCorrectBtn);
+
+ // string input not null
+ selenium.type(inputFormat.format(ID.notNull), "");
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.notNull)).text(messages.get(ID.notNull)));
+ }
+
+ /**
+ * Integer input, verify string pattern
+ */
+ protected void verifyPattern() {
+
+ selenium.click(setCorrectBtn);
+
+ // string input custom pattern
+ selenium.type(inputFormat.format(ID.pattern),
wrongValue.get(ID.pattern).toString());
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.pattern)).text(messages.get(ID.pattern)));
+ }
+
+ /**
+ * Integer input, verify custom string
+ */
+ protected void verifyCustom() {
+
+ selenium.click(setCorrectBtn);
+
+ // string input custom string
+ selenium.type(inputFormat.format(ID.custom),
wrongValue.get(ID.custom).toString());
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.custom)).text(messages.get(ID.custom)));
+ }
+
+ /**
+ * Integer input, verify regExp
+ */
+ protected void verifyRegExp() {
+
+ selenium.click(setCorrectBtn);
+
+ // string input regExp pattern
+ selenium.type(inputFormat.format(ID.regexp),
wrongValue.get(ID.regexp).toString());
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.regexp)).text(messages.get(ID.regexp)));
+ }
+
+ /**
+ * Integer input, verify date in past
+ */
+ protected void verifyDatePast() {
+
+ selenium.click(setCorrectBtn);
+
+ // date input past
+ selenium.type(inputFormat.format(ID.past), wrongValue.get(ID.past).toString());
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.past)).text(messages.get(ID.past)));
+ }
+
+ /**
+ * Integer input, verify date in future
+ */
+ protected void verifyDateFuture() {
+
+ selenium.click(setCorrectBtn);
+
+ // date input future
+ selenium.type(inputFormat.format(ID.future),
wrongValue.get(ID.future).toString());
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.future)).text(messages.get(ID.future)));
+ }
+
+ /**
+ * Integer input, verify string size
+ */
+ protected void verifyStringSize() {
+
+ selenium.click(setCorrectBtn);
+
+ // string input string size
+ selenium.type(inputFormat.format(ID.stringSize),
wrongValue.get(ID.stringSize).toString());
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.stringSize)).text(messages.get(ID.stringSize)));
+ }
+
+ /**
+ * Integer input, verify selection size
+ */
+ @IssueTracking(value = "https://issues.jboss.org/browse/RF-11035")
+ protected void verifySelectionSize() {
+
+ selenium.click(setCorrectBtn);
+ selenium.click(setWrongBtn);
+
+ // many checkBox input selection size
+ // selenium.type(inputFormat.format(ID.size),
wrongValue.get(ID.size).toString());
+ selenium.check(selectionItem.format(wrongValue.get(ID.size)), true);
+
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.size)).text(messages.get(ID.size)));
+ }
+
+}
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestValidators.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestValidators.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestValidators.java 2011-06-06
12:47:11 UTC (rev 22525)
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richValidator;
+
+import static
org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.utils.URLUtils;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * Selenium test for page faces/components/richValidator/csv.xhtml
+ *
+ * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
+ * @version $Revision$
+ */
+public class TestValidators extends AbstractMetamerTest {
+
+
+ private enum ID {
+ /** Boolean, true */ assertTrue,
+ /** Boolean false */ assertFalse,
+ /** Decimal from 2.5 to 9.688 */ decimalMinMax,
+ /** Decimal 3 digits and 4 fract */ digits ,
+ /** Integer max 10 */ max,
+ /** Integer min 2 */ min,
+ /** Integer from 2 to 10 */ minMax,
+ /** Text, not empty */ notEmpty,
+ /** Text, not null */ notNull,
+ /** Text, pattern '[a-z].*' */ pattern,
+ /** custom validator */ custom,
+ /** custom regExp validator */ regexp,
+ /** date past */ past,
+ /** date future */ future,
+ /** String size from 2 to 4 */ stringSize,
+ /** Selection size */ size
+ }
+
+ private Map<ID, String> messages = new HashMap<TestValidators.ID,
String>();
+
+ private JQueryLocator inputFormat = pjq("input[id$=:{0}]");
+
+ private JQueryLocator setWrongBtn =
pjq("input[id$=setWrongValuesButton]");
+ private JQueryLocator setCorrectBtn =
pjq("input[id$=setCorrectValuesButton]");
+
+ private JQueryLocator hCommandBtn = pjq("input[id$=hButton]");
+ private JQueryLocator a4jCommandBtn = pjq("input[id$=a4jButton]");
+
+ private JQueryLocator selectionItem = inputFormat.format(ID.size)
+ .getDescendant(jq("tr > td > input[id$=:size:{0}]"));
+
+ private JQueryLocator msgFormat = pjq("span[id$={0}Msg] span.rf-msg-det");
+
+ @BeforeClass
+ private void init() {
+ messages.put(ID.assertTrue, "must be true");
+ messages.put(ID.assertFalse, "must be false");
+ messages.put(ID.decimalMinMax, "must be less than or equal to 9.688");
+ messages.put(ID.digits, "numeric value out of bounds (<3 digits>.<4
digits> expected)");
+ messages.put(ID.max, "must be less than or equal to 10");
+ messages.put(ID.min, "must be greater than or equal to 2");
+ messages.put(ID.minMax, "must be greater than or equal to 2");
+ messages.put(ID.notEmpty, "may not be empty");
+ messages.put(ID.notNull, "may not be null");
+ messages.put(ID.pattern, "must match \"[a-z].*\"");
+ messages.put(ID.custom, "string is not \"RichFaces\"");
+ messages.put(ID.regexp, "Regex pattern of '\\d{3}' not
matched");
+ messages.put(ID.past, "must be in the past");
+ messages.put(ID.future, "must be in the future");
+ messages.put(ID.stringSize, "size must be between 2 and 4");
+ messages.put(ID.size, "???????"); // RF-11035
+ }
+
+ @Override
+ public URL getTestUrl() {
+ return URLUtils.buildUrl(contextPath,
"faces/components/richValidator/csv.xhtml");
+ }
+
+ @Test
+ public void testAllWrongWithAjaxSubmit() {
+ selenium.click(setCorrectBtn);
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.assertTrue)).text(messages.get(ID.assertTrue)));
+ }
+
+ @Test
+ @IssueTracking(value = "https://issues.jboss.org/browse/RF-11035")
+ public void testAllWrongWithJSFSubmit() {
+ selenium.click(setCorrectBtn);
+ selenium.click(hCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.assertTrue)).text(messages.get(ID.assertTrue)));
+ }
+
+ @Test
+ public void testBooleanTrue() {
+
+ selenium.click(setCorrectBtn);
+
+ // checkBoolean to true
+ selenium.check(inputFormat.format(ID.assertTrue), false);
+
+ guardNoRequest(selenium).click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.assertTrue)).text(messages.get(ID.assertTrue)));
+ }
+
+ @Test
+ public void testBooleanFalse() {
+
+ selenium.click(setCorrectBtn);
+
+ // checkBoolean to false
+ selenium.check(inputFormat.format(ID.assertFalse), true);
+ selenium.click(a4jCommandBtn);
+
+
waitGui.until(textEquals.locator(msgFormat.format(ID.assertFalse)).text(messages.get(ID.assertFalse)));
+ }
+
+}
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestValidatorsCSV.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestValidatorsCSV.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestValidatorsCSV.java 2011-06-06
12:47:11 UTC (rev 22525)
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richValidator;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.utils.URLUtils;
+import org.testng.annotations.Test;
+
+/**
+ * Selenium tests for page faces/components/richValidator/csv.xhtml
+ *
+ * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
+ * @version $Revision$
+ */
+public class TestValidatorsCSV extends AbstractValidatorsTest {
+
+ @Override
+ public URL getTestUrl() {
+ return URLUtils.buildUrl(contextPath,
"faces/components/richValidator/csv.xhtml");
+ }
+
+ @Test
+ public void testAllWrong() {
+ verifyAllWrongWithAjaxSubmit();
+ }
+
+ @Test
+ public void testAllWrongJSF() {
+ verifyAllWrongWithJSFSubmit();
+ }
+
+ @Test
+ public void testBooleanTrue() {
+ verifyBooleanTrue();
+ }
+
+ @Test
+ public void testBooleanFalse() {
+ verifyBooleanFalse();
+ }
+
+ @Test
+ public void testDecimalMinMax() {
+ verifyDecimalMinMax();
+ }
+
+ @Test
+ public void testIntegerMax() {
+ verifyMax();
+ }
+
+ @Test
+ public void testIntegerMin() {
+ verifyMin();
+ }
+
+ @Test
+ public void testIntegerMinMax() {
+ verifyMinMax();
+ }
+
+ @Test
+ public void testTextNotEmpty() {
+ verifyNotEmpty();
+ }
+
+ @Test
+ public void testTextNotNull() {
+ verifyNotNull();
+ }
+
+ @Test
+ public void testTextPattern() {
+ verifyPattern();
+ }
+
+ @Test
+ public void testTextCustomPattern() {
+ verifyCustom();
+ }
+
+ @Test
+ public void testTextRegExp() {
+ verifyRegExp();
+ }
+
+ @Test
+ public void testDatePast() {
+ verifyDatePast();
+ }
+
+ @Test
+ public void testDateFuture() {
+ verifyDateFuture();
+ }
+
+ @Test
+ public void testStringSize() {
+ verifyStringSize();
+ }
+
+ @Test
+ public void testSelectionSize() {
+ verifySelectionSize();
+ }
+
+}
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestValidatorsJSR303.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestValidatorsJSR303.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richValidator/TestValidatorsJSR303.java 2011-06-06
12:47:11 UTC (rev 22525)
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richValidator;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.utils.URLUtils;
+import org.testng.annotations.Test;
+
+/**
+ * Selenium tests for page faces/components/richValidator/jsr303.xhtml
+ *
+ * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
+ * @version $Revision$
+ */
+public class TestValidatorsJSR303 extends AbstractValidatorsTest {
+
+ @Override
+ public URL getTestUrl() {
+ return URLUtils.buildUrl(contextPath,
"faces/components/richValidator/jsr303.xhtml");
+ }
+
+ @Test
+ public void testAllWrong() {
+ verifyAllWrongWithAjaxSubmit();
+ }
+
+ @Test
+ public void testAllWrongJSF() {
+ verifyAllWrongWithJSFSubmit();
+ }
+
+ @Test
+ public void testBooleanTrue() {
+ verifyBooleanTrue();
+ }
+
+ @Test
+ public void testBooleanFalse() {
+ verifyBooleanFalse();
+ }
+
+ @Test
+ public void testDecimalMinMax() {
+ verifyDecimalMinMax();
+ }
+
+ @Test
+ public void testIntegerMax() {
+ verifyMax();
+ }
+
+ @Test
+ public void testIntegerMin() {
+ verifyMin();
+ }
+
+ @Test
+ public void testIntegerMinMax() {
+ verifyMinMax();
+ }
+
+ @Test
+ public void testTextNotEmpty() {
+ verifyNotEmpty();
+ }
+
+ @Test
+ public void testTextNotNull() {
+ verifyNotNull();
+ }
+
+ @Test
+ public void testTextPattern() {
+ verifyPattern();
+ }
+
+ @Test
+ public void testTextCustomPattern() {
+ verifyCustom();
+ }
+
+ @Test
+ public void testDatePast() {
+ verifyDatePast();
+ }
+
+ @Test
+ public void testDateFuture() {
+ verifyDateFuture();
+ }
+
+ @Test
+ public void testStringSize() {
+ verifyStringSize();
+ }
+
+ @Test
+ public void testSelectionSize() {
+ verifySelectionSize();
+ }
+
+}