JBoss Rich Faces SVN: r15449 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: resources/org/jboss/richfaces/integrationTest/beanValidator and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-03 08:20:29 -0400 (Thu, 03 Sep 2009)
New Revision: 15449
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/beanValidator/BeanValidatorTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/beanValidator/locators.properties
Log:
- changed variables names in Bean Validator
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/beanValidator/BeanValidatorTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/beanValidator/BeanValidatorTestCase.java 2009-09-03 12:19:04 UTC (rev 15448)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/beanValidator/BeanValidatorTestCase.java 2009-09-03 12:20:29 UTC (rev 15449)
@@ -33,9 +33,9 @@
private String LOC_FIELDSET_HEADER = getLoc("FIELDSET_HEADER");
private String LOC_BUTTON_SUBMIT = getLoc("BUTTON_SUBMIT");
private String LOC_VALIDATION_MESSAGE_RELATIVE = getLoc("VALIDATION_MESSAGE_RELATIVE");
- private String LOC_INPUT_HIBERNATE_NAME = getLoc("INPUT_HIBERNATE_NAME");
- private String LOC_INPUT_HIBERNATE_AGE = getLoc("INPUT_HIBERNATE_AGE");
- private String LOC_INPUT_HIBERNATE_EMAIL = getLoc("INPUT_HIBERNATE_EMAIL");
+ private String LOC_INPUT_NAME = getLoc("INPUT_NAME");
+ private String LOC_INPUT_AGE = getLoc("INPUT_AGE");
+ private String LOC_INPUT_EMAIL = getLoc("INPUT_EMAIL");
private final String MSG_INPUT_VALUE_IS_LESS_THAN_MINIMUM = getMsg("INPUT_VALUE_IS_LESS_THAN_MINIMUM");
private final String MSG_INPUT_VALUE_IS_GREATER_THAN_MAXIMUM = getMsg("INPUT_VALUE_IS_GREATER_THAN_MAXIMUM");
@@ -62,9 +62,9 @@
*/
@Test
public void testNameValueRequired() {
- final String validationMessage = format(MSG_OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY, LOC_INPUT_HIBERNATE_NAME);
- typeAndSubmit(LOC_INPUT_HIBERNATE_NAME, "");
- waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_NAME), validationMessage);
+ final String validationMessage = format(MSG_OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY, LOC_INPUT_NAME);
+ typeAndSubmit(LOC_INPUT_NAME, "");
+ waitForTextEquals(getMessageFor(LOC_INPUT_NAME), validationMessage);
}
/**
@@ -73,8 +73,8 @@
*/
@Test
public void testNameMinimumLength() {
- typeAndSubmit(LOC_INPUT_HIBERNATE_NAME, MSG_INPUT_VALUE_IS_LESS_THAN_MINIMUM);
- waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_NAME), MSG_OUTPUT_LENGTH_MUST_BE_BETWEEN);
+ typeAndSubmit(LOC_INPUT_NAME, MSG_INPUT_VALUE_IS_LESS_THAN_MINIMUM);
+ waitForTextEquals(getMessageFor(LOC_INPUT_NAME), MSG_OUTPUT_LENGTH_MUST_BE_BETWEEN);
}
/**
@@ -83,8 +83,8 @@
*/
@Test
public void testNameMaximumLength() {
- typeAndSubmit(LOC_INPUT_HIBERNATE_NAME, MSG_INPUT_VALUE_IS_GREATER_THAN_MAXIMUM);
- waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_NAME), MSG_OUTPUT_LENGTH_MUST_BE_BETWEEN);
+ typeAndSubmit(LOC_INPUT_NAME, MSG_INPUT_VALUE_IS_GREATER_THAN_MAXIMUM);
+ waitForTextEquals(getMessageFor(LOC_INPUT_NAME), MSG_OUTPUT_LENGTH_MUST_BE_BETWEEN);
}
/**
@@ -93,8 +93,8 @@
*/
@Test
public void testNameOnlySpacesPattern() {
- typeAndSubmit(LOC_INPUT_HIBERNATE_NAME, " ");
- waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_NAME), MSG_OUTPUT_STRING_CONTAIN_ONLY_SPACES);
+ typeAndSubmit(LOC_INPUT_NAME, " ");
+ waitForTextEquals(getMessageFor(LOC_INPUT_NAME), MSG_OUTPUT_STRING_CONTAIN_ONLY_SPACES);
}
/**
@@ -106,8 +106,8 @@
// first violate validation error
testNameValueRequired();
// then try valid input
- typeAndSubmit(LOC_INPUT_HIBERNATE_NAME, MSG_INPUT_VALID_NAME);
- waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_NAME), "");
+ typeAndSubmit(LOC_INPUT_NAME, MSG_INPUT_VALID_NAME);
+ waitForTextEquals(getMessageFor(LOC_INPUT_NAME), "");
}
/**
@@ -116,8 +116,8 @@
*/
@Test
public void testAgeValueRequired() {
- typeAndSubmit(LOC_INPUT_HIBERNATE_AGE, "");
- waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_AGE), MSG_OUTPUT_MAY_NOT_BE_NULL);
+ typeAndSubmit(LOC_INPUT_AGE, "");
+ waitForTextEquals(getMessageFor(LOC_INPUT_AGE), MSG_OUTPUT_MAY_NOT_BE_NULL);
}
/**
@@ -126,8 +126,8 @@
*/
@Test
public void testAgeMinimumValue() {
- typeAndSubmit(LOC_INPUT_HIBERNATE_AGE, MSG_INPUT_MUST_BE_LESS_THAN_OR_EQUAL);
- waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_AGE), MSG_OUTPUT_MUST_BE_LESS_THAN_OR_EQUAL);
+ typeAndSubmit(LOC_INPUT_AGE, MSG_INPUT_MUST_BE_LESS_THAN_OR_EQUAL);
+ waitForTextEquals(getMessageFor(LOC_INPUT_AGE), MSG_OUTPUT_MUST_BE_LESS_THAN_OR_EQUAL);
}
/**
@@ -136,8 +136,8 @@
*/
@Test
public void testAgeMaximumValue() {
- typeAndSubmit(LOC_INPUT_HIBERNATE_AGE, MSG_INPUT_MUST_BE_GREATER_THAN_OR_EQUAL);
- waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_AGE), MSG_OUTPUT_MUST_BE_GREATER_THAN_OR_EQUAL);
+ typeAndSubmit(LOC_INPUT_AGE, MSG_INPUT_MUST_BE_GREATER_THAN_OR_EQUAL);
+ waitForTextEquals(getMessageFor(LOC_INPUT_AGE), MSG_OUTPUT_MUST_BE_GREATER_THAN_OR_EQUAL);
}
/**
@@ -146,9 +146,9 @@
*/
@Test
public void testAgeIntegerOnly() {
- final String validationMessage = format(MSG_OUTPUT_MUST_BE_A_NUMBER, LOC_INPUT_HIBERNATE_AGE);
- typeAndSubmit(LOC_INPUT_HIBERNATE_AGE, MSG_INPUT_IS_NOT_NUMBER);
- waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_AGE), validationMessage);
+ final String validationMessage = format(MSG_OUTPUT_MUST_BE_A_NUMBER, LOC_INPUT_AGE);
+ typeAndSubmit(LOC_INPUT_AGE, MSG_INPUT_IS_NOT_NUMBER);
+ waitForTextEquals(getMessageFor(LOC_INPUT_AGE), validationMessage);
}
/**
@@ -160,8 +160,8 @@
// first violate validation error
testAgeValueRequired();
// then try valid input
- typeAndSubmit(LOC_INPUT_HIBERNATE_AGE, MSG_INPUT_VALID_AGE);
- waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_AGE), "");
+ typeAndSubmit(LOC_INPUT_AGE, MSG_INPUT_VALID_AGE);
+ waitForTextEquals(getMessageFor(LOC_INPUT_AGE), "");
}
/**
@@ -170,8 +170,8 @@
*/
@Test
public void testEmailMayNotBeNullOrEmpty() {
- typeAndSubmit(LOC_INPUT_HIBERNATE_EMAIL, "");
- waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_EMAIL), MSG_OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY);
+ typeAndSubmit(LOC_INPUT_EMAIL, "");
+ waitForTextEquals(getMessageFor(LOC_INPUT_EMAIL), MSG_OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY);
}
/**
@@ -180,8 +180,8 @@
*/
@Test
public void testEmailOnlySpaces() {
- typeAndSubmit(LOC_INPUT_HIBERNATE_EMAIL, " ");
- waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_EMAIL), MSG_OUTPUT_NOT_WELL_FORMED_EMAIL);
+ typeAndSubmit(LOC_INPUT_EMAIL, " ");
+ waitForTextEquals(getMessageFor(LOC_INPUT_EMAIL), MSG_OUTPUT_NOT_WELL_FORMED_EMAIL);
}
/**
@@ -190,8 +190,8 @@
*/
@Test
public void testEmailBad1() {
- typeAndSubmit(LOC_INPUT_HIBERNATE_EMAIL, MSG_INPUT_NOT_WELL_FORMED_EMAIL_1);
- waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_EMAIL), MSG_OUTPUT_NOT_WELL_FORMED_EMAIL);
+ typeAndSubmit(LOC_INPUT_EMAIL, MSG_INPUT_NOT_WELL_FORMED_EMAIL_1);
+ waitForTextEquals(getMessageFor(LOC_INPUT_EMAIL), MSG_OUTPUT_NOT_WELL_FORMED_EMAIL);
}
/**
@@ -200,8 +200,8 @@
*/
@Test
public void testEmailBad2() {
- typeAndSubmit(LOC_INPUT_HIBERNATE_EMAIL, MSG_INPUT_NOT_WELL_FORMED_EMAIL_2);
- waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_EMAIL), MSG_OUTPUT_NOT_WELL_FORMED_EMAIL);
+ typeAndSubmit(LOC_INPUT_EMAIL, MSG_INPUT_NOT_WELL_FORMED_EMAIL_2);
+ waitForTextEquals(getMessageFor(LOC_INPUT_EMAIL), MSG_OUTPUT_NOT_WELL_FORMED_EMAIL);
}
/**
@@ -213,8 +213,8 @@
// first violate validation error
testEmailMayNotBeNullOrEmpty();
// then try valid input
- typeAndSubmit(LOC_INPUT_HIBERNATE_EMAIL, MSG_INPUT_WELL_FORMED_EMAIL);
- waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_EMAIL), "");
+ typeAndSubmit(LOC_INPUT_EMAIL, MSG_INPUT_WELL_FORMED_EMAIL);
+ waitForTextEquals(getMessageFor(LOC_INPUT_EMAIL), "");
}
private void typeAndSubmit(String locator, String value) {
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/beanValidator/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/beanValidator/locators.properties 2009-09-03 12:19:04 UTC (rev 15448)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/beanValidator/locators.properties 2009-09-03 12:20:29 UTC (rev 15449)
@@ -1,6 +1,6 @@
FIELDSET_HEADER=//legend[text()\='Title']
BUTTON_SUBMIT=//input[@type\='button' and @value\='Submit']
VALIDATION_MESSAGE_RELATIVE=//input[@id\='{0}']/../../td[3]/*[1][@class\='rich-message']
-INPUT_HIBERNATE_NAME=beanValidatorForm\:name
-INPUT_HIBERNATE_AGE=beanValidatorForm\:age
-INPUT_HIBERNATE_EMAIL=beanValidatorForm\:email
+INPUT_NAME=beanValidatorForm\:name
+INPUT_AGE=beanValidatorForm\:age
+INPUT_EMAIL=beanValidatorForm\:email
15 years, 3 months
JBoss Rich Faces SVN: r15448 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: resources/org/jboss/richfaces/integrationTest/graphValidator and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-03 08:19:04 -0400 (Thu, 03 Sep 2009)
New Revision: 15448
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorAfterModelUpdateTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/graphValidator/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/graphValidator/messages.properties
Log:
- refactored Graph Validator test cases to follow conventions
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorAfterModelUpdateTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorAfterModelUpdateTestCase.java 2009-09-03 11:46:29 UTC (rev 15447)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorAfterModelUpdateTestCase.java 2009-09-03 12:19:04 UTC (rev 15448)
@@ -1,103 +1,126 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This code 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 test suite; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.jboss.richfaces.integrationTest.graphValidator;
-import junit.framework.Assert;
+import static org.testng.Assert.*;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
import org.jboss.test.selenium.waiting.Condition;
import org.jboss.test.selenium.waiting.Wait;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class GraphValidatorAfterModelUpdateTestCase extends
- AbstractSeleniumRichfacesTestCase {
+public class GraphValidatorAfterModelUpdateTestCase extends AbstractSeleniumRichfacesTestCase {
+ private final String LOC_FIELDSET_HEADER_ACTIVITIES = getLoc("LOC_FIELDSET_HEADER_ACTIVITIES");
+ private final String LOC_BUTTON_SUBMIT_ACTIVITIES = getLoc("BUTTON_SUBMIT_ACTIVITIES");
+ private final String LOC_OUTPUT_VALIDATION_MESSAGE = getLoc("OUTPUT_VALIDATION_MESSAGE");
+ private final String LOC_CLASS_VALIDATION_MESSAGE = getLoc("CLASS_VALIDATION_MESSAGE");
+ private final String LOC_INPUT_ACTIVITY_HOURS_PREFORMATTED = getLoc("INPUT_ACTIVITY_HOURS_PREFORMATTED");
+
+ private final String MSG_CLASS_VALID = getMsg("CLASS_VALID");
+ private final String MSG_CLASS_INVALID = getMsg("CLASS_INVALID");
+ private final String MSG_INPUT_VALID = getMsg("INPUT_VALID");
+ private final String MSG_INPUT_INVALID_TOO_GREAT = getMsg("INPUT_INVALID_TOO_GREAT");
+ private final String MSG_INPUT_INVALID_SUM_TOO_GREAT = getMsg("INPUT_INVALID_SUM_TOO_GREAT");
+ private final String MSG_OUTPUT_PLEASE_FILL_AT_LEAST_ONE_ENTRY = getMsg("OUTPUT_PLEASE_FILL_AT_LEAST_ONE_ENTRY");
+ private final String MSG_OUTPUT_CHANGES_STORED_SUCCESSFULLY = getMsg("OUTPUT_CHANGES_STORED_SUCCESSFULLY");
+ private final String MSG_OUTPUT_INVALID_VALUES = getMsg("OUTPUT_INVALID_VALUES");
+ private final String MSG_OUTPUT_INVALID_SUM_TOO_GREAT = getMsg("OUTPUT_INVALID_SUM_TOO_GREAT");
+
/**
- * Opens specified page
+ * Do no changes to form and checks that validate message 'Please fill at
+ * least one entry' appear
*/
- public void openPage() {
- selenium.open(contextPath
- + "/richfaces/graphValidator.jsf?c=graphValidator&tab=usage");
- scrollIntoView(header, true);
- }
-
- private String header = getLoc("graph-validator--header2");
- private String buttonSubmit = getLoc("graph-validator--button--submit2");
- private String validationMessage = getLoc("graph-validator--output--validation-message");
- private String validationMessageClass = getLoc("graph-validator--attribute--validation-message-class");
- private String activityTimes = getLoc("graph-validator--input--activity-times");
- private String validMessageClass = getMess("graph-validator--attribute--class-valid");
- private String invalidMessageClass = getMess("graph-validator--attribute--class-invalid");
-
@Test
- public void noChangeIntoFormTest() {
- openPage();
-
+ public void testNoChangeIntoForm() {
submitAndWaitForMessageAppears();
- validateMessages(
- invalidMessageClass,
- getMess("graph-validator--message--please-fill-at-least-one-entry"));
+ validateMessages(MSG_CLASS_INVALID, MSG_OUTPUT_PLEASE_FILL_AT_LEAST_ONE_ENTRY);
}
+ /**
+ * Enter first input and checks that changes will store successfully
+ */
@Test
- public void changeStoredSuccessfullyTest() {
- openPage();
+ public void testChangeStoredSuccessfully() {
+ typeAndSubmit(format(LOC_INPUT_ACTIVITY_HOURS_PREFORMATTED, 1), MSG_INPUT_VALID);
- typeAndSubmit(format(activityTimes, 1),
- getMess("graph-validator--input--ok"));
-
- validateMessages(
- validMessageClass,
- getMess("graph-validator--message--changes-stored-successfully"));
+ validateMessages(MSG_CLASS_VALID, MSG_OUTPUT_CHANGES_STORED_SUCCESSFULLY);
}
+ /**
+ * Enter only one value that is too great and checks that validation message
+ * appear
+ */
@Test
- public void oneValueTooGreatTest() {
- openPage();
+ public void testOneValueTooGreat() {
+ typeAndSubmit(format(LOC_INPUT_ACTIVITY_HOURS_PREFORMATTED, 1), MSG_INPUT_INVALID_TOO_GREAT);
- typeAndSubmit(format(activityTimes, 1),
- getMess("graph-validator--input--too-great"));
-
- validateMessages(invalidMessageClass,
- getMess("graph-validator--message--invalid-values"));
+ validateMessages(MSG_CLASS_INVALID, MSG_OUTPUT_INVALID_VALUES);
}
+ /**
+ * Enter several values, which is in sum greater than allow maximum and
+ * checks that validation message appear.
+ */
@Test
- public void sumOfValuesTooGreatTest() {
- openPage();
-
+ public void testSumOfValuesTooGreat() {
for (int i = 1; i <= 3; i++) {
- selenium.type(format(activityTimes, i),
- getMess("graph-validator--input--sum-too-great"));
+ selenium.type(format(LOC_INPUT_ACTIVITY_HOURS_PREFORMATTED, i), MSG_INPUT_INVALID_SUM_TOO_GREAT);
}
submitAndWaitForMessageAppears();
- validateMessages(invalidMessageClass,
- getMess("graph-validator--message--sum-too-great"));
+ validateMessages(MSG_CLASS_INVALID, MSG_OUTPUT_INVALID_SUM_TOO_GREAT);
}
- /* HELP METHODS */
-
private void typeAndSubmit(String locator, String text) {
selenium.type(locator, text);
submitAndWaitForMessageAppears();
}
private void submitAndWaitForMessageAppears() {
- selenium.click(buttonSubmit);
+ selenium.click(LOC_BUTTON_SUBMIT_ACTIVITIES);
- Wait.until(new Condition() {
+ Wait.failWith("Validation message never appeared").until(new Condition() {
public boolean isTrue() {
- return selenium.isElementPresent(validationMessage);
+ return selenium.isElementPresent(LOC_OUTPUT_VALIDATION_MESSAGE);
}
});
}
private void validateMessages(String className, String text) {
- Assert.assertEquals(className, selenium
- .getAttribute(validationMessageClass));
- Assert.assertEquals(text, selenium.getText(validationMessage));
+ assertEquals(selenium.getAttribute(LOC_CLASS_VALIDATION_MESSAGE), className,
+ "Validation message's class is invalid");
+ assertEquals(selenium.getText(LOC_OUTPUT_VALIDATION_MESSAGE), text, "Given validation message isn't expected");
}
+
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Graph Validator");
+
+ scrollIntoView(LOC_FIELDSET_HEADER_ACTIVITIES, true);
+ }
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorTestCase.java 2009-09-03 11:46:29 UTC (rev 15447)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/graphValidator/GraphValidatorTestCase.java 2009-09-03 12:19:04 UTC (rev 15448)
@@ -1,6 +1,27 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This code 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 test suite; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.jboss.richfaces.integrationTest.graphValidator;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -8,144 +29,208 @@
* @version $Revision$
*/
public class GraphValidatorTestCase extends AbstractSeleniumRichfacesTestCase {
+
+ private String LOC_FIELDSET_HEADER_USEF_INFO = getLoc("FIELDSET_HEADER_USEF_INFO");
+ private String LOC_BUTTON_SUBMIT_USER_INFO = getLoc("BUTTON_SUBMIT_USER_INFO");
+ private String LOC_VALIDATION_MESSAGE_RELATIVE = getLoc("VALIDATION_MESSAGE_RELATIVE");
+ private String LOC_INPUT_NAME = getLoc("INPUT_NAME");
+ private String LOC_INPUT_AGE = getLoc("INPUT_AGE");
+ private String LOC_INPUT_EMAIL = getLoc("INPUT_EMAIL");
+
+ private final String MSG_INPUT_VALUE_IS_LESS_THAN_MINIMUM = getMsg("INPUT_VALUE_IS_LESS_THAN_MINIMUM");
+ private final String MSG_INPUT_VALUE_IS_GREATER_THAN_MAXIMUM = getMsg("INPUT_VALUE_IS_GREATER_THAN_MAXIMUM");
+ private final String MSG_INPUT_VALID_NAME = getMsg("INPUT_VALID_NAME");
+ private final String MSG_INPUT_MUST_BE_GREATER_THAN_OR_EQUAL = getMsg("INPUT_MUST_BE_GREATER_THAN_OR_EQUAL");
+ private final String MSG_INPUT_MUST_BE_LESS_THAN_OR_EQUAL = getMsg("INPUT_MUST_BE_LESS_THAN_OR_EQUAL");
+ private final String MSG_INPUT_IS_NOT_NUMBER = getMsg("INPUT_IS_NOT_NUMBER");
+ private final String MSG_INPUT_VALID_AGE = getMsg("INPUT_VALID_AGE");
+ private final String MSG_INPUT_NOT_WELL_FORMED_EMAIL_1 = getMsg("INPUT_NOT_WELL_FORMED_EMAIL_1");
+ private final String MSG_INPUT_NOT_WELL_FORMED_EMAIL_2 = getMsg("INPUT_NOT_WELL_FORMED_EMAIL_2");
+ private final String MSG_INPUT_WELL_FORMED_EMAIL = getMsg("INPUT_WELL_FORMED_EMAIL");
+ private final String MSG_OUTPUT_LENGTH_MUST_BE_BETWEEN = getMsg("OUTPUT_LENGTH_MUST_BE_BETWEEN");
+ private final String MSG_OUTPUT_STRING_CONTAIN_ONLY_SPACES = getMsg("OUTPUT_STRING_CONTAIN_ONLY_SPACES");
+ private final String MSG_OUTPUT_MAY_NOT_BE_NULL = getMsg("OUTPUT_MAY_NOT_BE_NULL");
+ private final String MSG_OUTPUT_MUST_BE_GREATER_THAN_OR_EQUAL = getMsg("OUTPUT_MUST_BE_GREATER_THAN_OR_EQUAL");
+ private final String MSG_OUTPUT_MUST_BE_LESS_THAN_OR_EQUAL = getMsg("OUTPUT_MUST_BE_LESS_THAN_OR_EQUAL");
+ private final String MSG_OUTPUT_MUST_BE_A_NUMBER = getMsg("OUTPUT_MUST_BE_A_NUMBER");
+ private final String MSG_OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY = getMsg("OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY");
+ private final String MSG_OUTPUT_NOT_WELL_FORMED_EMAIL = getMsg("OUTPUT_NOT_WELL_FORMED_EMAIL");
+
/**
- * Opens specified page
+ * Try type no chars in input name and checks that value required message
+ * will appear.
*/
- public void openPage() {
- selenium.open(contextPath
- + "/richfaces/graphValidator.jsf?c=graphValidator&tab=usage");
- scrollIntoView(header, true);
+ @Test
+ public void testNameValueRequired() {
+ final String validationMessage = format(MSG_OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY, LOC_INPUT_NAME);
+ typeAndSubmit(LOC_INPUT_NAME, "");
+ waitForTextEquals(getMessageFor(LOC_INPUT_NAME), validationMessage);
}
- private String header = getLoc("graph-validator--header1");
- private String buttonSubmit = getLoc("graph-validator--button--submit1");
- private String inputName = getLoc("graph-validator--input--name");
- private String inputEmail = getLoc("graph-validator--input--email");
- private String inputAge = getLoc("graph-validator--input--age");
- private String relativeValidationMessage = getLoc("graph-validator--relative--validation-message");
-
- private void typeAndSubmit(String locator, String value) {
- selenium.type(locator, value);
- selenium.click(buttonSubmit);
+ /**
+ * Try type string of length less than minimum length in name input and
+ * checks that validation message will appear.
+ */
+ @Test
+ public void testNameMinimumLength() {
+ typeAndSubmit(LOC_INPUT_NAME, MSG_INPUT_VALUE_IS_LESS_THAN_MINIMUM);
+ waitForTextEquals(getMessageFor(LOC_INPUT_NAME), MSG_OUTPUT_LENGTH_MUST_BE_BETWEEN);
}
- public String getMessageFor(String locator) {
- return format(relativeValidationMessage, locator);
+ /**
+ * Try type string of length greater than maximum length in name input and
+ * checks that validation message will appear.
+ */
+ @Test
+ public void testNameMaximumLength() {
+ typeAndSubmit(LOC_INPUT_NAME, MSG_INPUT_VALUE_IS_GREATER_THAN_MAXIMUM);
+ waitForTextEquals(getMessageFor(LOC_INPUT_NAME), MSG_OUTPUT_LENGTH_MUST_BE_BETWEEN);
}
+ /**
+ * Enter only one space to name input and checks that validation message
+ * will appear.
+ */
@Test
- public void nameValueRequired() {
- openPage();
- typeAndSubmit(inputName, "");
- waitForTextEquals(getMessageFor(inputName),
- getMess("may-not-be-null-or-empty"));
+ public void testNameOnlySpacesPattern() {
+ typeAndSubmit(LOC_INPUT_NAME, " ");
+ waitForTextEquals(getMessageFor(LOC_INPUT_NAME), MSG_OUTPUT_STRING_CONTAIN_ONLY_SPACES);
}
+ /**
+ * Try type the invalid name input and checks that after typing valid input
+ * will validation message disappear.
+ */
@Test
- public void nameMinimumLength() {
- openPage();
- typeAndSubmit(inputName, getMess("less-than-minimum--enter"));
- waitForTextEquals(getMessageFor(inputName),
- getMess("bean-name--length"));
+ public void testNameMessageDisappers() {
+ // first violate validation error
+ testNameValueRequired();
+ // then try valid input
+ typeAndSubmit(LOC_INPUT_NAME, MSG_INPUT_VALID_NAME);
+ waitForTextEquals(getMessageFor(LOC_INPUT_NAME), "");
}
+ /**
+ * Try type no chars in age input and checks that the validation message
+ * value required will appear.
+ */
@Test
- public void nameMaximumLength() {
- openPage();
- typeAndSubmit(inputName, getMess("greater-than-maximum--enter"));
- waitForTextEquals(getMessageFor(inputName),
- getMess("bean-name--length"));
+ public void testAgeValueRequired() {
+ typeAndSubmit(LOC_INPUT_AGE, "");
+ waitForTextEquals(getMessageFor(LOC_INPUT_AGE), MSG_OUTPUT_MAY_NOT_BE_NULL);
}
+ /**
+ * Try input age less than minimum and checks that the validation message
+ * will appear.
+ */
@Test
- public void nameOnlySpacesPattern() {
- openPage();
- typeAndSubmit(inputName, " ");
- waitForTextEquals(getMessageFor(inputName), formatMess(
- "less-than-minimum-of-2", selenium.getAttribute(format(
- "{0}/@id", inputName))));
+ public void testAgeMinimumValue() {
+ typeAndSubmit(LOC_INPUT_AGE, MSG_INPUT_MUST_BE_LESS_THAN_OR_EQUAL);
+ waitForTextEquals(getMessageFor(LOC_INPUT_AGE), MSG_OUTPUT_MUST_BE_LESS_THAN_OR_EQUAL);
}
+ /**
+ * Try input age greater than maximum and checks that the validation message
+ * will appear.
+ */
@Test
- public void nameMessageDisappers() {
- nameValueRequired();
- typeAndSubmit(inputName, getMess("bean-name--valid-input"));
- waitForTextEquals(getMessageFor(inputName), "");
+ public void testAgeMaximumValue() {
+ typeAndSubmit(LOC_INPUT_AGE, MSG_INPUT_MUST_BE_GREATER_THAN_OR_EQUAL);
+ waitForTextEquals(getMessageFor(LOC_INPUT_AGE), MSG_OUTPUT_MUST_BE_GREATER_THAN_OR_EQUAL);
}
+ /**
+ * Try input age as non-Integer (alphabetical chars) and checks that
+ * validation message will appear.
+ */
@Test
- public void ageValueRequired() {
- openPage();
- typeAndSubmit(inputAge, "");
- waitForTextEquals(getMessageFor(inputAge), getMess("may-not-be-null"));
+ public void testAgeIntegerOnly() {
+ final String validationMessage = format(MSG_OUTPUT_MUST_BE_A_NUMBER, LOC_INPUT_AGE);
+ typeAndSubmit(LOC_INPUT_AGE, MSG_INPUT_IS_NOT_NUMBER);
+ waitForTextEquals(getMessageFor(LOC_INPUT_AGE), validationMessage);
}
+ /**
+ * Try input no input first and wait for validation message appears and then
+ * type a valid input and checks that validation message will disappear.
+ */
@Test
- public void ageMinimumValue() {
- openPage();
- typeAndSubmit(inputAge, getMess("long-range--bellow"));
- waitForTextEquals(getMessageFor(inputAge), getMess("bean-age--min"));
+ public void testAgeMessageDisappers() {
+ // first violate validation error
+ testAgeValueRequired();
+ // then try valid input
+ typeAndSubmit(LOC_INPUT_AGE, MSG_INPUT_VALID_AGE);
+ waitForTextEquals(getMessageFor(LOC_INPUT_AGE), "");
}
+ /**
+ * Try to enter empty email address and checks that validation message
+ * appears.
+ */
@Test
- public void ageMaximumValue() {
- openPage();
- typeAndSubmit(inputAge, getMess("bean-age--max--enter"));
- waitForTextEquals(getMessageFor(inputAge), getMess("bean-age--max"));
+ public void testEmailMayNotBeNullOrEmpty() {
+ typeAndSubmit(LOC_INPUT_EMAIL, "");
+ waitForTextEquals(getMessageFor(LOC_INPUT_EMAIL), MSG_OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY);
}
+ /**
+ * Try to enter one space like a email address and checks that validation
+ * message appears.
+ */
@Test
- public void ageIntegerOnly() {
- openPage();
- typeAndSubmit(inputAge, formatMess("age-integer-only--enter", inputAge));
- waitForTextEquals(getMessageFor(inputAge), formatMess(
- "bean-age--integer-only", selenium.getAttribute(format(
- "{0}/@id", inputAge))));
+ public void testEmailOnlySpaces() {
+ typeAndSubmit(LOC_INPUT_EMAIL, " ");
+ waitForTextEquals(getMessageFor(LOC_INPUT_EMAIL), MSG_OUTPUT_NOT_WELL_FORMED_EMAIL);
}
+ /**
+ * Enter bad email address (only domain name suffix) and checks that
+ * validation message appears.
+ */
@Test
- public void ageMessageDisappers() {
- ageValueRequired();
- typeAndSubmit(inputAge, getMess("valid-age"));
- waitForTextEquals(getMessageFor(inputAge), "");
+ public void testEmailBad1() {
+ typeAndSubmit(LOC_INPUT_EMAIL, MSG_INPUT_NOT_WELL_FORMED_EMAIL_1);
+ waitForTextEquals(getMessageFor(LOC_INPUT_EMAIL), MSG_OUTPUT_NOT_WELL_FORMED_EMAIL);
}
+ /**
+ * Enter bad email address (only @ char with domain name suffix) and checks
+ * that testValidation message appears.
+ */
@Test
- public void emailMayNotBeNullOrEmpty() {
- openPage();
- typeAndSubmit(inputEmail, "");
- waitForTextEquals(getMessageFor(inputEmail),
- getMess("may-not-be-null-or-empty"));
+ public void testEmailBad2() {
+ typeAndSubmit(LOC_INPUT_EMAIL, MSG_INPUT_NOT_WELL_FORMED_EMAIL_2);
+ waitForTextEquals(getMessageFor(LOC_INPUT_EMAIL), MSG_OUTPUT_NOT_WELL_FORMED_EMAIL);
}
+ /**
+ * Enter bad email address, wait for validation message appear and then try
+ * to enter valid email address and checks that validation message appear.
+ */
@Test
- public void emailOnlySpaces() {
- openPage();
- typeAndSubmit(inputEmail, " ");
- waitForTextEquals(getMessageFor(inputEmail),
- getMess("not-well-formed-email"));
+ public void testEmailMessageDisappers() {
+ // first violate validation error
+ testEmailMayNotBeNullOrEmpty();
+ // then try valid input
+ typeAndSubmit(LOC_INPUT_EMAIL, MSG_INPUT_WELL_FORMED_EMAIL);
+ waitForTextEquals(getMessageFor(LOC_INPUT_EMAIL), "");
}
- @Test
- public void emailBad1() {
- openPage();
- typeAndSubmit(inputEmail, getMess("bad-email-1"));
- waitForTextEquals(getMessageFor(inputEmail),
- getMess("not-well-formed-email"));
+ private void typeAndSubmit(String locator, String value) {
+ selenium.type(locator, value);
+ selenium.click(LOC_BUTTON_SUBMIT_USER_INFO);
}
- @Test
- public void emailBad2() {
- openPage();
- typeAndSubmit(inputEmail, getMess("bad-email-2"));
- waitForTextEquals(getMessageFor(inputEmail),
- getMess("not-well-formed-email"));
+ private String getMessageFor(String locator) {
+ return format(LOC_VALIDATION_MESSAGE_RELATIVE, locator);
}
- @Test
- public void emailMessageDisappers() {
- emailMayNotBeNullOrEmpty();
- typeAndSubmit(inputEmail, getMess("well-formed-email"));
- waitForTextEquals(getMessageFor(inputEmail), "");
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Graph Validator");
+
+ scrollIntoView(LOC_FIELDSET_HEADER_USEF_INFO, true);
}
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/graphValidator/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/graphValidator/locators.properties 2009-09-03 11:46:29 UTC (rev 15447)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/graphValidator/locators.properties 2009-09-03 12:19:04 UTC (rev 15448)
@@ -1,11 +1,11 @@
-graph-validator--header1=//fieldset[1]//legend[text()\='Title']
-graph-validator--input--name=//input[@id\='graphValidatorForm\:name']
-graph-validator--input--email=//input[@id\='graphValidatorForm\:email']
-graph-validator--input--age=//input[@id\='graphValidatorForm\:age']
-graph-validator--relative--validation-message={0}/../../td[3]/*[1][@class\='rich-message']
-graph-validator--button--submit1=//input[@type\='button' and @value\='Store changes']
-graph-validator--header2=//fieldset[2]//legend[text()\='Title']
-graph-validator--button--submit2=//input[@type\='button' and @value\='Store my details']
-graph-validator--output--validation-message=//form[@name\="graphValidatorForm2"]//*[@class\="rich-messages-label"]
-graph-validator--attribute--validation-message-class=//form[@name\="graphValidatorForm2"]/*[@class\="rich-messages"]/*/@class
-graph-validator--input--activity-times=//form[@id\='graphValidatorForm2']/table/tbody/tr[{0}]//input[@type\='text']
+FIELDSET_HEADER_USEF_INFO=//fieldset[1]//legend[text()\='Title']
+BUTTON_SUBMIT_USER_INFO=//input[@type\='button' and @value\='Store changes']
+INPUT_NAME=graphValidatorForm\:name
+INPUT_AGE=graphValidatorForm\:age
+INPUT_EMAIL=graphValidatorForm\:email
+VALIDATION_MESSAGE_RELATIVE=//input[@id\='{0}']/../../td[3]/*[1][@class\='rich-message']
+LOC_FIELDSET_HEADER_ACTIVITIES=//fieldset[2]//legend[text()\='Title']
+BUTTON_SUBMIT_ACTIVITIES=//input[@type\='button' and @value\='Store my details']
+OUTPUT_VALIDATION_MESSAGE=//form[@name\="graphValidatorForm2"]//*[@class\="rich-messages-label"]
+CLASS_VALIDATION_MESSAGE=//form[@name\="graphValidatorForm2"]/*[@class\="rich-messages"]/*/@class
+INPUT_ACTIVITY_HOURS_PREFORMATTED=//form[@id\='graphValidatorForm2']/table/tbody/tr[{0}]//input[@type\='text']
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/graphValidator/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/graphValidator/messages.properties 2009-09-03 11:46:29 UTC (rev 15447)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/graphValidator/messages.properties 2009-09-03 12:19:04 UTC (rev 15448)
@@ -1,27 +1,27 @@
-graph-validator--attribute--class-valid=green
-graph-validator--attribute--class-invalid=red
-graph-validator--message--please-fill-at-least-one-entry=Invalid values\: Please feel at list one entry
-graph-validator--message--changes-stored-successfully=Changes Stored Successfully
-graph-validator--message--invalid-values=Invalid values\:
-graph-validator--message--sum-too-great=Invalid values\: Only 24h in a day\!
-graph-validator--input--ok=1
-graph-validator--input--too-great=13
-graph-validator--input--sum-too-great=9
-may-not-be-null-or-empty=may not be null or empty
-less-than-minimum--enter=12
-bean-name--length=length must be between 3 and 12
-greater-than-maximum--enter=1234567890123
-less-than-minimum-of-2={0}\: Validation Error\: Value is less than allowable minimum of '2'
-bean-name--valid-input=Sam Hawkings
-may-not-be-null=may not be null
-long-range--bellow=17
-bean-age--min=must be greater than or equal to 18
-bean-age--max--enter=101
-bean-age--max=must be less than or equal to 100
-age-integer-only--enter=abc
-bean-age--integer-only={0}\: 'abc' must be a number between -2147483648 and 2147483647 Example\: 9346
-valid-age=18
-not-well-formed-email=not a well-formed email address
-well-formed-email=email(a)corporation.com
-bad-email-1=corporation.com
-bad-email-2=(a)corporation.com
+CLASS_VALID=green
+CLASS_INVALID=red
+OUTPUT_PLEASE_FILL_AT_LEAST_ONE_ENTRY=Invalid values\: Please feel at list one entry
+OUTPUT_CHANGES_STORED_SUCCESSFULLY=Changes Stored Successfully
+OUTPUT_INVALID_VALUES=Invalid values\:
+OUTPUT_INVALID_SUM_TOO_GREAT=Invalid values\: Only 24h in a day\!
+INPUT_VALID=1
+INPUT_INVALID_TOO_GREAT=13
+INPUT_INVALID_SUM_TOO_GREAT=9
+INPUT_VALUE_IS_LESS_THAN_MINIMUM=12
+INPUT_VALUE_IS_GREATER_THAN_MAXIMUM=1234567890123
+INPUT_IS_NOT_NUMBER=abc
+INPUT_VALID_AGE=18
+INPUT_VALID_NAME=Sam Hawkings
+INPUT_NOT_WELL_FORMED_EMAIL_1=corporation.com
+INPUT_NOT_WELL_FORMED_EMAIL_2=(a)corporation.com
+INPUT_WELL_FORMED_EMAIL=email(a)corporation.com
+INPUT_MUST_BE_GREATER_THAN_OR_EQUAL=17
+INPUT_MUST_BE_LESS_THAN_OR_EQUAL=101
+OUTPUT_STRING_CONTAIN_ONLY_SPACES=This string contain only spaces
+OUTPUT_LENGTH_MUST_BE_BETWEEN=length must be between 3 and 12
+OUTPUT_MAY_NOT_BE_NULL=may not be null
+OUTPUT_MUST_BE_GREATER_THAN_OR_EQUAL=must be greater than or equal to 18
+OUTPUT_MUST_BE_LESS_THAN_OR_EQUAL=must be less than or equal to 100
+OUTPUT_MUST_BE_A_NUMBER={0}\: 'abc' must be a number between -2147483648 and 2147483647 Example\: 9346
+OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY=may not be null or empty
+OUTPUT_NOT_WELL_FORMED_EMAIL=not a well-formed email address
15 years, 3 months
JBoss Rich Faces SVN: r15447 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: ochikvina
Date: 2009-09-03 07:46:29 -0400 (Thu, 03 Sep 2009)
New Revision: 15447
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_layout.xml
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_layoutPanel.xml
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_page.xml
Log:
https://jira.jboss.org/jira/browse/RF-7757 - updating the component description;
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_layout.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_layout.xml 2009-09-03 11:15:21 UTC (rev 15446)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_layout.xml 2009-09-03 11:46:29 UTC (rev 15447)
@@ -90,7 +90,7 @@
<tbody>
<row>
<entry>component-type</entry>
- <entry>org.richfaces.layout</entry>
+ <entry>org.richfaces.Layout</entry>
</row>
<row>
<entry>component-class</entry>
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_layoutPanel.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_layoutPanel.xml 2009-09-03 11:15:21 UTC (rev 15446)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_layoutPanel.xml 2009-09-03 11:46:29 UTC (rev 15447)
@@ -124,7 +124,7 @@
<ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/layouts.jsf">On RichFaces Live Demo page </ulink> you can see an example of <emphasis role="bold">
<property><rich:layoutPanel></property>
</emphasis> usage and sources for the given example. </para>
- <para>The <link linkend="rich_layout">
+ <para>See also the <link linkend="rich_layout">
<emphasis role="bold">
<property><rich:layout></property>
</emphasis>
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_page.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_page.xml 2009-09-03 11:15:21 UTC (rev 15446)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_page.xml 2009-09-03 11:46:29 UTC (rev 15447)
@@ -83,10 +83,10 @@
<para>
The title of the page can be set with the <emphasis>
- <property>"pageTile"</property>
+ <property>"pageTitle"</property>
</emphasis> attribute.
- To place some other page parameters (like meta information, links to CSS style sheets etc.) in the <head> element of an HTML page use "pageHeader" facet.
-
+ To place some other page parameters (like meta information, links to CSS style sheets etc.) in the <head> element of an HTML page use
+ "pageHeader" facet.
</para>
<para>
<emphasis role="bold">Example:</emphasis>
@@ -152,7 +152,7 @@
<para>The theme defines the way the <emphasis role="bold">
<property><rich:page></property>
- </emphasis> is rendered. Default renderer(default theme) of the <emphasis role="bold">
+ </emphasis> is rendered. Default renderer (default theme) of the <emphasis role="bold">
<property><rich:page></property>
</emphasis> has no mappings to skin parameters and just provides CSS classes for the page part. However, the <property>simple</property> theme, which is an extension of the default theme, has mappings to skin parameters and adds the RichFaces skinning for the page elements. </para>
@@ -182,7 +182,7 @@
<tbody>
<row>
<entry>component-type</entry>
- <entry>org.richfaces.component.html.HtmlPage</entry>
+ <entry>org.richfaces.Page</entry>
</row>
<row>
<entry>component-class</entry>
15 years, 3 months
JBoss Rich Faces SVN: r15446 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: resources/org/jboss/richfaces/integrationTest/ajaxValidator and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-03 07:15:21 -0400 (Thu, 03 Sep 2009)
New Revision: 15446
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AbstractAjaxValidatorTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AjaxValidatorHibernatePartTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AjaxValidatorTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxValidator/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxValidator/messages.properties
Log:
- refactored Ajax Validator test cases to follow conventions
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AbstractAjaxValidatorTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AbstractAjaxValidatorTestCase.java 2009-09-03 11:13:01 UTC (rev 15445)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AbstractAjaxValidatorTestCase.java 2009-09-03 11:15:21 UTC (rev 15446)
@@ -1,21 +1,43 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This code 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 test suite; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.jboss.richfaces.integrationTest.ajaxValidator;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
-import org.testng.Assert;
+import org.jboss.test.selenium.dom.Event;
+import org.testng.annotations.BeforeMethod;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class AbstractAjaxValidatorTestCase extends
- AbstractSeleniumRichfacesTestCase {
+public class AbstractAjaxValidatorTestCase extends AbstractSeleniumRichfacesTestCase {
+ private final String LOC_VALIDATION_MESSAGE_RELATIVE = getLoc("VALIDATION_MESSAGE_RELATIVE");
+
/**
- * Opens specified page
+ * Opens specified component's page before each test method
*/
- public void openPage() {
- selenium.open(contextPath
- + "/richfaces/ajaxValidator.jsf?c=ajaxValidator&tab=usage");
+ @BeforeMethod
+ protected void loadPage() {
+ openComponent("Ajax Validator");
}
/**
@@ -27,9 +49,11 @@
* @param value
* the value which should be typed in "type input" action
*/
- public void typeAndBlur(String locator, String value) {
+ protected void typeAndBlur(String locator, String value) {
+ scrollIntoView(locator, true);
+
selenium.type(locator, value);
- selenium.fireEvent(locator, "blur");
+ selenium.fireEvent(locator, Event.BLUR);
}
/**
@@ -39,7 +63,9 @@
* for which element should be find message box
* @return locator of message box for element given by locator
*/
- public String getMessageFor(String locator) {
- return String.format(getLoc("relativeMessageLink"), locator);
+ protected String getMessageFor(String locator) {
+ scrollIntoView(locator, true);
+
+ return format(LOC_VALIDATION_MESSAGE_RELATIVE, locator);
}
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AjaxValidatorHibernatePartTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AjaxValidatorHibernatePartTestCase.java 2009-09-03 11:13:01 UTC (rev 15445)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AjaxValidatorHibernatePartTestCase.java 2009-09-03 11:15:21 UTC (rev 15446)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This code 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 test suite; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.jboss.richfaces.integrationTest.ajaxValidator;
import org.testng.annotations.Test;
@@ -6,125 +26,190 @@
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class AjaxValidatorHibernatePartTestCase extends
- AbstractAjaxValidatorTestCase {
+public class AjaxValidatorHibernatePartTestCase extends AbstractAjaxValidatorTestCase {
- /* COMPONENTS */
+ private final String LOC_INPUT_HIBERNATE_NAME = getLoc("INPUT_HIBERNATE_NAME");
+ private final String LOC_INPUT_HIBERNATE_AGE = getLoc("INPUT_HIBERNATE_AGE");
+ private final String LOC_INPUT_HIBERNATE_EMAIL = getLoc("INPUT_HIBERNATE_EMAIL");
- private final String name = getLoc("hibernateName");
- private final String age = getLoc("hibernateAge");
- private final String email = getLoc("hibernateEmail");
+ private final String MSG_INPUT_VALUE_IS_LESS_THAN_MINIMUM = getMsg("INPUT_VALUE_IS_LESS_THAN_MINIMUM");
+ private final String MSG_INPUT_VALUE_IS_GREATER_THAN_MAXIMUM = getMsg("INPUT_VALUE_IS_GREATER_THAN_MAXIMUM");
+ private final String MSG_INPUT_HIBERNATE_VALID_INPUT = getMsg("INPUT_HIBERNATE_VALID_INPUT");
+ private final String MSG_INPUT_MUST_BE_GREATER_THAN_OR_EQUAL = getMsg("INPUT_MUST_BE_GREATER_THAN_OR_EQUAL");
+ private final String MSG_INPUT_MUST_BE_LESS_THAN_OR_EQUAL = getMsg("INPUT_MUST_BE_LESS_THAN_OR_EQUAL");
+ private final String MSG_INPUT_IS_NOT_NUMBER = getMsg("INPUT_IS_NOT_NUMBER");
+ private final String MSG_INPUT_VALID_AGE = getMsg("INPUT_VALID_AGE");
+ private final String MSG_INPUT_NOT_WELL_FORMED_EMAIL_1 = getMsg("INPUT_NOT_WELL_FORMED_EMAIL_1");
+ private final String MSG_INPUT_NOT_WELL_FORMED_EMAIL_2 = getMsg("INPUT_NOT_WELL_FORMED_EMAIL_2");
+ private final String MSG_INPUT_WELL_FORMED_EMAIL = getMsg("INPUT_WELL_FORMED_EMAIL");
+ private final String MSG_OUTPUT_VALUE_REQUIRED_PREFORMATTED = getMsg("OUTPUT_VALUE_REQUIRED");
+ private final String MSG_OUTPUT_LENGTH_MUST_BE_BETWEEN = getMsg("OUTPUT_LENGTH_MUST_BE_BETWEEN");
+ private final String MSG_OUTPUT_STRING_CONTAIN_ONLY_SPACES = getMsg("OUTPUT_STRING_CONTAIN_ONLY_SPACES");
+ private final String MSG_OUTPUT_MAY_NOT_BE_NULL = getMsg("OUTPUT_MAY_NOT_BE_NULL");
+ private final String MSG_OUTPUT_MUST_BE_GREATER_THAN_OR_EQUAL = getMsg("OUTPUT_MUST_BE_GREATER_THAN_OR_EQUAL");
+ private final String MSG_OUTPUT_MUST_BE_LESS_THAN_OR_EQUAL = getMsg("OUTPUT_MUST_BE_LESS_THAN_OR_EQUAL");
+ private final String MSG_OUTPUT_MUST_BE_A_NUMBER = getMsg("OUTPUT_MUST_BE_A_NUMBER");
+ private final String MSG_OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY = getMsg("OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY");
+ private final String MSG_OUTPUT_NOT_WELL_FORMED_EMAIL = getMsg("OUTPUT_NOT_WELL_FORMED_EMAIL");
- /* TESTS */
-
+ /**
+ * Try type no chars in input name and checks that value required message
+ * will appear.
+ */
@Test
- public void nameValueRequired() {
- openPage();
- typeAndBlur(name, "");
- waitForTextEquals(getMessageFor(name), formatMess("value-required",
- name));
+ public void testNameValueRequired() {
+ final String validationMessage = format(MSG_OUTPUT_VALUE_REQUIRED_PREFORMATTED, LOC_INPUT_HIBERNATE_NAME);
+ typeAndBlur(LOC_INPUT_HIBERNATE_NAME, "");
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_NAME), validationMessage);
}
+ /**
+ * Try type string of length less than minimum length in name input and
+ * checks that validation message will appear.
+ */
@Test
- public void nameMinimumLength() {
- openPage();
- typeAndBlur(name, getMess("less-than-minimum--enter"));
- waitForTextEquals(getMessageFor(name), getMess("bean-name--length"));
+ public void testNameMinimumLength() {
+ typeAndBlur(LOC_INPUT_HIBERNATE_NAME, MSG_INPUT_VALUE_IS_LESS_THAN_MINIMUM);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_NAME), MSG_OUTPUT_LENGTH_MUST_BE_BETWEEN);
}
+ /**
+ * Try type string of length greater than maximum length in name input and
+ * checks that validation message will appear.
+ */
@Test
- public void nameMaximumLength() {
- openPage();
- typeAndBlur(name, getMess("greater-than-maximum--enter"));
- waitForTextEquals(getMessageFor(name), getMess("bean-name--length"));
+ public void testNameMaximumLength() {
+ typeAndBlur(LOC_INPUT_HIBERNATE_NAME, MSG_INPUT_VALUE_IS_GREATER_THAN_MAXIMUM);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_NAME), MSG_OUTPUT_LENGTH_MUST_BE_BETWEEN);
}
+ /**
+ * Enter only one space to name input and checks that validation message
+ * will appear.
+ */
@Test
- public void nameOnlySpacesPattern() {
- openPage();
- typeAndBlur(name, " ");
- waitForTextEquals(getMessageFor(name), getMess("bean-name--not-empty"));
+ public void testNameOnlySpacesPattern() {
+ typeAndBlur(LOC_INPUT_HIBERNATE_NAME, " ");
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_NAME), MSG_OUTPUT_STRING_CONTAIN_ONLY_SPACES);
}
+ /**
+ * Try type the invalid name input and checks that after typing valid input
+ * will validation message disappear.
+ */
@Test
- public void nameMessageDisappers() {
- nameValueRequired();
- typeAndBlur(name, getMess("bean-name--valid-input"));
- waitForTextEquals(getMessageFor(name), "");
+ public void testNameMessageDisappers() {
+ // first violate validation error
+ testNameValueRequired();
+ // then try valid input
+ typeAndBlur(LOC_INPUT_HIBERNATE_NAME, MSG_INPUT_HIBERNATE_VALID_INPUT);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_NAME), "");
}
+ /**
+ * Try type no chars in age input and checks that the validation message
+ * value required will appear.
+ */
@Test
- public void ageValueRequired() {
- openPage();
- typeAndBlur(age, "");
- waitForTextEquals(getMessageFor(age), getMess("may-not-be-null"));
+ public void testAgeValueRequired() {
+ typeAndBlur(LOC_INPUT_HIBERNATE_AGE, "");
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_AGE), MSG_OUTPUT_MAY_NOT_BE_NULL);
}
+ /**
+ * Try input age less than minimum and checks that the validation message
+ * will appear.
+ */
@Test
- public void ageMinimumValue() {
- openPage();
- typeAndBlur(age, getMess("long-range--bellow"));
- waitForTextEquals(getMessageFor(age), getMess("bean-age--min"));
+ public void testAgeMinimumValue() {
+ typeAndBlur(LOC_INPUT_HIBERNATE_AGE, MSG_INPUT_MUST_BE_LESS_THAN_OR_EQUAL);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_AGE), MSG_OUTPUT_MUST_BE_LESS_THAN_OR_EQUAL);
}
+ /**
+ * Try input age greater than maximum and checks that the validation message
+ * will appear.
+ */
@Test
- public void ageMaximumValue() {
- openPage();
- typeAndBlur(age, getMess("bean-age--max--enter"));
- waitForTextEquals(getMessageFor(age), getMess("bean-age--max"));
+ public void testAgeMaximumValue() {
+ typeAndBlur(LOC_INPUT_HIBERNATE_AGE, MSG_INPUT_MUST_BE_GREATER_THAN_OR_EQUAL);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_AGE), MSG_OUTPUT_MUST_BE_GREATER_THAN_OR_EQUAL);
}
+ /**
+ * Try input age as non-Integer (alphabetical chars) and checks that
+ * validation message will appear.
+ */
@Test
- public void ageIntegerOnly() {
- openPage();
- typeAndBlur(age, formatMess("age-integer-only--enter", age));
- waitForTextEquals(getMessageFor(age), formatMess(
- "bean-age--integer-only", age));
+ public void testAgeIntegerOnly() {
+ final String validationMessage = format(MSG_OUTPUT_MUST_BE_A_NUMBER, LOC_INPUT_HIBERNATE_AGE);
+ typeAndBlur(LOC_INPUT_HIBERNATE_AGE, MSG_INPUT_IS_NOT_NUMBER);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_AGE), validationMessage);
}
+ /**
+ * Try input no input first and wait for validation message appears and then
+ * type a valid input and checks that validation message will disappear.
+ */
@Test
- public void ageMessageDisappers() {
- ageValueRequired();
- typeAndBlur(age, getMess("valid-age"));
- waitForTextEquals(getMessageFor(age), "");
+ public void testAgeMessageDisappers() {
+ // first violate validation error
+ testAgeValueRequired();
+ // then try valid input
+ typeAndBlur(LOC_INPUT_HIBERNATE_AGE, MSG_INPUT_VALID_AGE);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_AGE), "");
}
+ /**
+ * Try to enter empty email address and checks that validation message
+ * appears.
+ */
@Test
- public void emailMayNotBeNullOrEmpty() {
- openPage();
- typeAndBlur(email, "");
- waitForTextEquals(getMessageFor(email),
- getMess("may-not-be-null-or-empty"));
+ public void testEmailMayNotBeNullOrEmpty() {
+ typeAndBlur(LOC_INPUT_HIBERNATE_EMAIL, "");
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_EMAIL), MSG_OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY);
}
+ /**
+ * Try to enter one space like a email address and checks that validation
+ * message appears.
+ */
@Test
- public void emailOnlySpaces() {
- openPage();
- typeAndBlur(email, " ");
- waitForTextEquals(getMessageFor(email),
- getMess("not-well-formed-email"));
+ public void testEmailOnlySpaces() {
+ typeAndBlur(LOC_INPUT_HIBERNATE_EMAIL, " ");
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_EMAIL), MSG_OUTPUT_NOT_WELL_FORMED_EMAIL);
}
+ /**
+ * Enter bad email address (only domain name suffix) and checks that
+ * validation message appears.
+ */
@Test
- public void emailBad1() {
- openPage();
- typeAndBlur(email, getMess("bad-email-1"));
- waitForTextEquals(getMessageFor(email),
- getMess("not-well-formed-email"));
+ public void testEmailBad1() {
+ typeAndBlur(LOC_INPUT_HIBERNATE_EMAIL, MSG_INPUT_NOT_WELL_FORMED_EMAIL_1);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_EMAIL), MSG_OUTPUT_NOT_WELL_FORMED_EMAIL);
}
+ /**
+ * Enter bad email address (only @ char with domain name suffix) and checks
+ * that testValidation message appears.
+ */
@Test
- public void emailBad2() {
- openPage();
- typeAndBlur(email, getMess("bad-email-2"));
- waitForTextEquals(getMessageFor(email),
- getMess("not-well-formed-email"));
+ public void testEmailBad2() {
+ typeAndBlur(LOC_INPUT_HIBERNATE_EMAIL, MSG_INPUT_NOT_WELL_FORMED_EMAIL_2);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_EMAIL), MSG_OUTPUT_NOT_WELL_FORMED_EMAIL);
}
+ /**
+ * Enter bad email address, wait for validation message appear and then try
+ * to enter valid email address and checks that validation message appear.
+ */
@Test
- public void emailMessageDisappers() {
- emailMayNotBeNullOrEmpty();
- typeAndBlur(email, getMess("well-formed-email"));
- waitForTextEquals(getMessageFor(email), "");
+ public void testEmailMessageDisappers() {
+ // first violate validation error
+ testEmailMayNotBeNullOrEmpty();
+ // then try valid input
+ typeAndBlur(LOC_INPUT_HIBERNATE_EMAIL, MSG_INPUT_WELL_FORMED_EMAIL);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_EMAIL), "");
}
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AjaxValidatorTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AjaxValidatorTestCase.java 2009-09-03 11:13:01 UTC (rev 15445)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/ajaxValidator/AjaxValidatorTestCase.java 2009-09-03 11:15:21 UTC (rev 15446)
@@ -1,86 +1,149 @@
+/**
+* License Agreement.
+*
+* JBoss RichFaces
+*
+* Copyright (C) 2009 Red Hat, Inc.
+*
+* This code is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License version 2.1 as published by the Free Software Foundation.
+*
+* This code 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 test suite; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
package org.jboss.richfaces.integrationTest.ajaxValidator;
-import java.text.MessageFormat;
-
import org.testng.annotations.Test;
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
+ * @version test$Revision$
*/
public class AjaxValidatorTestCase extends AbstractAjaxValidatorTestCase {
- /* COMPONENTS */
+ private final String LOC_INPUT_NAME = getLoc("INPUT_NAME");
+ private final String LOC_INPUT_AGE = getLoc("INPUT_AGE");
- private final String name = getLoc("name");
- private final String age = getLoc("age");
+ private final String MSG_INPUT_VALUE_IS_GREATER_THAN_MAXIMUM = getMsg("INPUT_VALUE_IS_GREATER_THAN_MAXIMUM");
+ private final String MSG_INPUT_VALUE_IS_LESS_THAN_MINIMUM = getMsg("INPUT_VALUE_IS_LESS_THAN_MINIMUM");
+ private final String MSG_INPUT_VALID_NAME = getMsg("INPUT_VALID_NAME");
+ private final String MSG_INPUT_NOT_BETWEEN_EXPECTED_VALUES_BELLOW = getMsg("INPUT_NOT_BETWEEN_EXPECTED_VALUES_BELLOW");
+ private final String MSG_INPUT_NOT_BETWEEN_EXPECTED_VALUES_ABOVE = getMsg("INPUT_NOT_BETWEEN_EXPECTED_VALUES_ABOVE");
+ private final String MSG_INPUT_IS_NOT_NUMBER = getMsg("INPUT_IS_NOT_NUMBER");
+ private final String MSG_INPUT_VALID_AGE = getMsg("INPUT_VALID_AGE");
+ private final String MSG_OUTPUT_VALUE_REQUIRED_PREFORMATTED = getMsg("OUTPUT_VALUE_REQUIRED");
+ private final String MSG_OUTPUT_VALUE_IS_LESS_THAN_MINIMUM = getMsg("OUTPUT_VALUE_IS_LESS_THAN_MINIMUM");
+ private final String MSG_OUTPUT_VALUE_IS_GREATER_THAN_MAXIMUM_PREFORMATTED = getMsg("OUTPUT_VALUE_IS_GREATER_THAN_MAXIMUM_PREFORMATTED");
+ private final String MSG_OUTPUT_IS_NOT_NUMBER_PREFORMATTED = getMsg("OUTPUT_IS_NOT_NUMBER_PREFORMATTED");
+ private final String MSG_OUTPUT_NOT_BETWEEN_EXPECTED_VALUES_PREFORMATTED = getMsg("OUTPUT_NOT_BETWEEN_EXPECTED_VALUES_PREFORMATTED");
- /* TESTS */
-
+ /**
+ * Try type no chars in input name and checks that value required message
+ * will appear.
+ */
@Test
- public void nameValueRequired() {
- openPage();
- typeAndBlur(name, "");
- waitForTextEquals(getMessageFor(name), formatMess("value-required",
- name));
+ public void testNameValueRequired() {
+ final String validationMessage = format(MSG_OUTPUT_VALUE_REQUIRED_PREFORMATTED, LOC_INPUT_NAME);
+ typeAndBlur(LOC_INPUT_NAME, "");
+ waitForTextEquals(getMessageFor(LOC_INPUT_NAME), validationMessage);
}
+ /**
+ * Try type string of length less than minimum length in name input and
+ * checks that validation message will appear.
+ */
@Test
- public void nameMinimumLength() {
- openPage();
- typeAndBlur(name, getMess("less-than-minimum--enter"));
- waitForTextEquals(getMessageFor(name), formatMess("less-than-minimum",
- name));
+ public void testNameMinimumLength() {
+ final String validationMessage = format(MSG_OUTPUT_VALUE_IS_LESS_THAN_MINIMUM, LOC_INPUT_NAME);
+ typeAndBlur(LOC_INPUT_NAME, MSG_INPUT_VALUE_IS_LESS_THAN_MINIMUM);
+ waitForTextEquals(getMessageFor(LOC_INPUT_NAME), validationMessage);
}
+ /**
+ * Try type string of length greater than maximum length in name input and
+ * checks that validation message will appear.
+ */
@Test
- public void nameMaximumLength() {
- openPage();
- typeAndBlur(name, getMess("greater-than-maximum--enter"));
- waitForTextEquals(getMessageFor(name), formatMess(
- "greater-than-maximum", name));
+ public void testNameMaximumLength() {
+ final String validationMessage = format(MSG_OUTPUT_VALUE_IS_GREATER_THAN_MAXIMUM_PREFORMATTED, LOC_INPUT_NAME);
+ typeAndBlur(LOC_INPUT_NAME, MSG_INPUT_VALUE_IS_GREATER_THAN_MAXIMUM);
+ waitForTextEquals(getMessageFor(LOC_INPUT_NAME), validationMessage);
}
+ /**
+ * Try type the invalid name input and checks that after typing valid input
+ * will validation message disappear.
+ */
@Test
- public void nameMessageDisappers() {
- nameValueRequired(); // violates validation message
- typeAndBlur(name, getMess("valid-name"));
- waitForTextEquals(getMessageFor(name), "");
+ public void testNameMessageDisappers() {
+ // first violate validation error
+ testNameValueRequired();
+ // then try valid input
+ typeAndBlur(LOC_INPUT_NAME, MSG_INPUT_VALID_NAME);
+ waitForTextEquals(getMessageFor(LOC_INPUT_NAME), "");
}
+ /**
+ * Try type no chars in age input and checks that the validation message
+ * value required will appear.
+ */
@Test
- public void ageValueRequired() {
- openPage();
- typeAndBlur(age, "");
- waitForTextEquals(getMessageFor(age), formatMess("value-required", age));
+ public void testAgeValueRequired() {
+ final String validationMessage = format(MSG_OUTPUT_VALUE_REQUIRED_PREFORMATTED, LOC_INPUT_AGE);
+ typeAndBlur(LOC_INPUT_AGE, "");
+ waitForTextEquals(getMessageFor(LOC_INPUT_AGE), validationMessage);
}
+ /**
+ * Try input age less than minimum and checks that the validation message
+ * will appear.
+ */
@Test
- public void ageMinimumValue() {
- openPage();
- typeAndBlur(age, getMess("long-range--bellow"));
- waitForTextEquals(getMessageFor(age), formatMess("long-range", age));
+ public void testAgeMinimumValue() {
+ final String validationMessage = format(MSG_OUTPUT_NOT_BETWEEN_EXPECTED_VALUES_PREFORMATTED, LOC_INPUT_AGE);
+ typeAndBlur(LOC_INPUT_AGE, MSG_INPUT_NOT_BETWEEN_EXPECTED_VALUES_BELLOW);
+ waitForTextEquals(getMessageFor(LOC_INPUT_AGE), validationMessage);
}
+ /**
+ * Try input age greater than maximum and checks that the validation message
+ * will appear.
+ */
@Test
- public void ageMaximumValue() {
- openPage();
- typeAndBlur(age, getMess("long-range--above"));
- waitForTextEquals(getMessageFor(age), formatMess("long-range", age));
+ public void testAgeMaximumValue() {
+ final String validationMessage = format(MSG_OUTPUT_NOT_BETWEEN_EXPECTED_VALUES_PREFORMATTED, LOC_INPUT_AGE);
+ typeAndBlur(LOC_INPUT_AGE, MSG_INPUT_NOT_BETWEEN_EXPECTED_VALUES_ABOVE);
+ waitForTextEquals(getMessageFor(LOC_INPUT_AGE), validationMessage);
}
+ /**
+ * Try input age as non-Integer (alphabetical chars) and checks that
+ * validation message will appear.
+ */
@Test
- public void ageIntegerOnly() {
- openPage();
- typeAndBlur(age, getMess("age-integer-only--enter"));
- waitForTextEquals(getMessageFor(age), formatMess("age-integer-only",
- age));
+ public void testAgeIntegerOnly() {
+ final String validationMessage = format(MSG_OUTPUT_IS_NOT_NUMBER_PREFORMATTED, LOC_INPUT_AGE);
+ typeAndBlur(LOC_INPUT_AGE, MSG_INPUT_IS_NOT_NUMBER);
+ waitForTextEquals(getMessageFor(LOC_INPUT_AGE), validationMessage);
}
+ /**
+ * Try input no input first and wait for validation message appears and then
+ * type a valid input and checks that validation message will disappear.
+ */
@Test
- public void ageMessageDisappers() {
- ageValueRequired();
- typeAndBlur(age, getMess("valid-age"));
- waitForTextEquals(getMessageFor(age), "");
+ public void testAgeMessageDisappers() {
+ // first violate validation error
+ testAgeValueRequired();
+ // then try valid input
+ typeAndBlur(LOC_INPUT_AGE, MSG_INPUT_VALID_AGE);
+ waitForTextEquals(getMessageFor(LOC_INPUT_AGE), "");
}
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxValidator/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxValidator/locators.properties 2009-09-03 11:13:01 UTC (rev 15445)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxValidator/locators.properties 2009-09-03 11:15:21 UTC (rev 15446)
@@ -1,6 +1,6 @@
-name=ajaxValidatorForm\:name
-age=ajaxValidatorForm\:age
-hibernateName=ajaxValidatorForm2\:name
-hibernateAge=ajaxValidatorForm2\:age
-hibernateEmail=ajaxValidatorForm2\:email
-relativeMessageLink=//input[@id\='%s']/../../td[3]/*[1][@class\='rich-message']
+VALIDATION_MESSAGE_RELATIVE=//input[@id\='{0}']/../../td[3]/*[1][@class\='rich-message']
+INPUT_NAME=ajaxValidatorForm\:name
+INPUT_AGE=ajaxValidatorForm\:age
+INPUT_HIBERNATE_NAME=ajaxValidatorForm2\:name
+INPUT_HIBERNATE_AGE=ajaxValidatorForm2\:age
+INPUT_HIBERNATE_EMAIL=ajaxValidatorForm2\:email
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxValidator/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxValidator/messages.properties 2009-09-03 11:13:01 UTC (rev 15445)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/ajaxValidator/messages.properties 2009-09-03 11:15:21 UTC (rev 15446)
@@ -1,25 +1,26 @@
-value-required={0}\: Validation Error\: Value is required.
-less-than-minimum={0}\: Validation Error\: Value is less than allowable minimum of '3'
-less-than-minimum--enter=12
-greater-than-maximum={0}\: Validation Error\: Value is greater than allowable maximum of '12'
-greater-than-maximum--enter=1234567890123
-valid-name=Sam
-long-range--bellow=17
-long-range--above=100
-long-range={0}\: Validation Error\: Specified attribute is not between the expected values of 18 and 99.
-valid-age=18
-bean-name--length=length must be between 3 and 12
-bad-email-1=corporation.com
-bad-email-2=(a)corporation.com
-well-formed-email=email(a)corporation.com
-bean-name--not-empty=This string contain only spaces
-bean-name--valid-input=Sam Hawkings
-bean-age--min=must be greater than or equal to 18
-bean-age--max--enter=101
-bean-age--max=must be less than or equal to 100
-age-integer-only--enter=abc
-age-integer-only={0}\: 'abc' is not a number. Example\: 99
-bean-age--integer-only={0}\: 'abc' must be a number between -2147483648 and 2147483647 Example\: 9346
-may-not-be-null-or-empty=may not be null or empty
-not-well-formed-email=not a well-formed email address
-may-not-be-null=may not be null
+INPUT_VALUE_IS_LESS_THAN_MINIMUM=12
+INPUT_VALUE_IS_GREATER_THAN_MAXIMUM=1234567890123
+INPUT_VALID_NAME=Sam
+INPUT_NOT_BETWEEN_EXPECTED_VALUES_BELLOW=17
+INPUT_NOT_BETWEEN_EXPECTED_VALUES_ABOVE=100
+INPUT_IS_NOT_NUMBER=abc
+INPUT_VALID_AGE=18
+OUTPUT_VALUE_REQUIRED={0}\: Validation Error\: Value is required.
+OUTPUT_VALUE_IS_LESS_THAN_MINIMUM={0}\: Validation Error\: Value is less than allowable minimum of '3'
+OUTPUT_VALUE_IS_GREATER_THAN_MAXIMUM_PREFORMATTED={0}\: Validation Error\: Value is greater than allowable maximum of '12'
+OUTPUT_NOT_BETWEEN_EXPECTED_VALUES_PREFORMATTED={0}\: Validation Error\: Specified attribute is not between the expected values of 18 and 99.
+OUTPUT_IS_NOT_NUMBER_PREFORMATTED={0}\: 'abc' is not a number. Example\: 99
+OUTPUT_LENGTH_MUST_BE_BETWEEN=length must be between 3 and 12
+OUTPUT_STRING_CONTAIN_ONLY_SPACES=This string contain only spaces
+INPUT_HIBERNATE_VALID_INPUT=Sam Hawkings
+INPUT_NOT_WELL_FORMED_EMAIL_1=corporation.com
+INPUT_NOT_WELL_FORMED_EMAIL_2=(a)corporation.com
+INPUT_WELL_FORMED_EMAIL=email(a)corporation.com
+INPUT_MUST_BE_GREATER_THAN_OR_EQUAL=17
+INPUT_MUST_BE_LESS_THAN_OR_EQUAL=101
+OUTPUT_MAY_NOT_BE_NULL=may not be null
+OUTPUT_MUST_BE_GREATER_THAN_OR_EQUAL=must be greater than or equal to 18
+OUTPUT_MUST_BE_LESS_THAN_OR_EQUAL=must be less than or equal to 100
+OUTPUT_MUST_BE_A_NUMBER={0}\: 'abc' must be a number between -2147483648 and 2147483647 Example\: 9346
+OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY=may not be null or empty
+OUTPUT_NOT_WELL_FORMED_EMAIL=not a well-formed email address
15 years, 3 months
JBoss Rich Faces SVN: r15445 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: resources/org/jboss/richfaces/integrationTest/beanValidator and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-03 07:13:01 -0400 (Thu, 03 Sep 2009)
New Revision: 15445
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/beanValidator/BeanValidatorTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/beanValidator/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/beanValidator/messages.properties
Log:
- refactored Bean Validator test cases to follow conventions
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/beanValidator/BeanValidatorTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/beanValidator/BeanValidatorTestCase.java 2009-09-03 06:45:41 UTC (rev 15444)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/beanValidator/BeanValidatorTestCase.java 2009-09-03 11:13:01 UTC (rev 15445)
@@ -1,6 +1,27 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This code 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 test suite; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.jboss.richfaces.integrationTest.beanValidator;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -8,143 +29,208 @@
* @version $Revision$
*/
public class BeanValidatorTestCase extends AbstractSeleniumRichfacesTestCase {
- /**
- * Opens specified page
- */
- public void openPage() {
- selenium.open(contextPath
- + "/richfaces/beanValidator.jsf?c=beanValidator&tab=usage");
- scrollIntoView(header, true);
- }
- private String header = getLoc("bean-validator--header");
- private String buttonSubmit = getLoc("bean-validator--button--submit");
- private String inputName = getLoc("bean-validator--input--name");
- private String inputEmail = getLoc("bean-validator--input--email");
- private String inputAge = getLoc("bean-validator--input--age");
- private String relativeValidationMessage = getLoc("bean-validator--relative--validation-message");
+ private String LOC_FIELDSET_HEADER = getLoc("FIELDSET_HEADER");
+ private String LOC_BUTTON_SUBMIT = getLoc("BUTTON_SUBMIT");
+ private String LOC_VALIDATION_MESSAGE_RELATIVE = getLoc("VALIDATION_MESSAGE_RELATIVE");
+ private String LOC_INPUT_HIBERNATE_NAME = getLoc("INPUT_HIBERNATE_NAME");
+ private String LOC_INPUT_HIBERNATE_AGE = getLoc("INPUT_HIBERNATE_AGE");
+ private String LOC_INPUT_HIBERNATE_EMAIL = getLoc("INPUT_HIBERNATE_EMAIL");
- private void typeAndSubmit(String locator, String value) {
- selenium.type(locator, value);
- selenium.click(buttonSubmit);
- }
+ private final String MSG_INPUT_VALUE_IS_LESS_THAN_MINIMUM = getMsg("INPUT_VALUE_IS_LESS_THAN_MINIMUM");
+ private final String MSG_INPUT_VALUE_IS_GREATER_THAN_MAXIMUM = getMsg("INPUT_VALUE_IS_GREATER_THAN_MAXIMUM");
+ private final String MSG_INPUT_VALID_NAME = getMsg("INPUT_VALID_NAME");
+ private final String MSG_INPUT_MUST_BE_GREATER_THAN_OR_EQUAL = getMsg("INPUT_MUST_BE_GREATER_THAN_OR_EQUAL");
+ private final String MSG_INPUT_MUST_BE_LESS_THAN_OR_EQUAL = getMsg("INPUT_MUST_BE_LESS_THAN_OR_EQUAL");
+ private final String MSG_INPUT_IS_NOT_NUMBER = getMsg("INPUT_IS_NOT_NUMBER");
+ private final String MSG_INPUT_VALID_AGE = getMsg("INPUT_VALID_AGE");
+ private final String MSG_INPUT_NOT_WELL_FORMED_EMAIL_1 = getMsg("INPUT_NOT_WELL_FORMED_EMAIL_1");
+ private final String MSG_INPUT_NOT_WELL_FORMED_EMAIL_2 = getMsg("INPUT_NOT_WELL_FORMED_EMAIL_2");
+ private final String MSG_INPUT_WELL_FORMED_EMAIL = getMsg("INPUT_WELL_FORMED_EMAIL");
+ private final String MSG_OUTPUT_LENGTH_MUST_BE_BETWEEN = getMsg("OUTPUT_LENGTH_MUST_BE_BETWEEN");
+ private final String MSG_OUTPUT_STRING_CONTAIN_ONLY_SPACES = getMsg("OUTPUT_STRING_CONTAIN_ONLY_SPACES");
+ private final String MSG_OUTPUT_MAY_NOT_BE_NULL = getMsg("OUTPUT_MAY_NOT_BE_NULL");
+ private final String MSG_OUTPUT_MUST_BE_GREATER_THAN_OR_EQUAL = getMsg("OUTPUT_MUST_BE_GREATER_THAN_OR_EQUAL");
+ private final String MSG_OUTPUT_MUST_BE_LESS_THAN_OR_EQUAL = getMsg("OUTPUT_MUST_BE_LESS_THAN_OR_EQUAL");
+ private final String MSG_OUTPUT_MUST_BE_A_NUMBER = getMsg("OUTPUT_MUST_BE_A_NUMBER");
+ private final String MSG_OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY = getMsg("OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY");
+ private final String MSG_OUTPUT_NOT_WELL_FORMED_EMAIL = getMsg("OUTPUT_NOT_WELL_FORMED_EMAIL");
- public String getMessageFor(String locator) {
- return format(relativeValidationMessage, locator);
+ /**
+ * Try type no chars in input name and checks that value required message
+ * will appear.
+ */
+ @Test
+ public void testNameValueRequired() {
+ final String validationMessage = format(MSG_OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY, LOC_INPUT_HIBERNATE_NAME);
+ typeAndSubmit(LOC_INPUT_HIBERNATE_NAME, "");
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_NAME), validationMessage);
}
+ /**
+ * Try type string of length less than minimum length in name input and
+ * checks that validation message will appear.
+ */
@Test
- public void nameValueRequired() {
- openPage();
- typeAndSubmit(inputName, "");
- waitForTextEquals(getMessageFor(inputName),
- getMess("may-not-be-null-or-empty"));
+ public void testNameMinimumLength() {
+ typeAndSubmit(LOC_INPUT_HIBERNATE_NAME, MSG_INPUT_VALUE_IS_LESS_THAN_MINIMUM);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_NAME), MSG_OUTPUT_LENGTH_MUST_BE_BETWEEN);
}
+ /**
+ * Try type string of length greater than maximum length in name input and
+ * checks that validation message will appear.
+ */
@Test
- public void nameMinimumLength() {
- openPage();
- typeAndSubmit(inputName, getMess("less-than-minimum--enter"));
- waitForTextEquals(getMessageFor(inputName),
- getMess("bean-name--length"));
+ public void testNameMaximumLength() {
+ typeAndSubmit(LOC_INPUT_HIBERNATE_NAME, MSG_INPUT_VALUE_IS_GREATER_THAN_MAXIMUM);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_NAME), MSG_OUTPUT_LENGTH_MUST_BE_BETWEEN);
}
+ /**
+ * Enter only one space to name input and checks that validation message
+ * will appear.
+ */
@Test
- public void nameMaximumLength() {
- openPage();
- typeAndSubmit(inputName, getMess("greater-than-maximum--enter"));
- waitForTextEquals(getMessageFor(inputName),
- getMess("bean-name--length"));
+ public void testNameOnlySpacesPattern() {
+ typeAndSubmit(LOC_INPUT_HIBERNATE_NAME, " ");
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_NAME), MSG_OUTPUT_STRING_CONTAIN_ONLY_SPACES);
}
+ /**
+ * Try type the invalid name input and checks that after typing valid input
+ * will validation message disappear.
+ */
@Test
- public void nameOnlySpacesPattern() {
- openPage();
- typeAndSubmit(inputName, " ");
- waitForTextEquals(getMessageFor(inputName),
- getMess("bean-name--not-empty"));
+ public void testNameMessageDisappers() {
+ // first violate validation error
+ testNameValueRequired();
+ // then try valid input
+ typeAndSubmit(LOC_INPUT_HIBERNATE_NAME, MSG_INPUT_VALID_NAME);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_NAME), "");
}
+ /**
+ * Try type no chars in age input and checks that the validation message
+ * value required will appear.
+ */
@Test
- public void nameMessageDisappers() {
- nameValueRequired();
- typeAndSubmit(inputName, getMess("bean-name--valid-input"));
- waitForTextEquals(getMessageFor(inputName), "");
+ public void testAgeValueRequired() {
+ typeAndSubmit(LOC_INPUT_HIBERNATE_AGE, "");
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_AGE), MSG_OUTPUT_MAY_NOT_BE_NULL);
}
+ /**
+ * Try input age less than minimum and checks that the validation message
+ * will appear.
+ */
@Test
- public void ageValueRequired() {
- openPage();
- typeAndSubmit(inputAge, "");
- waitForTextEquals(getMessageFor(inputAge), getMess("may-not-be-null"));
+ public void testAgeMinimumValue() {
+ typeAndSubmit(LOC_INPUT_HIBERNATE_AGE, MSG_INPUT_MUST_BE_LESS_THAN_OR_EQUAL);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_AGE), MSG_OUTPUT_MUST_BE_LESS_THAN_OR_EQUAL);
}
+ /**
+ * Try input age greater than maximum and checks that the validation message
+ * will appear.
+ */
@Test
- public void ageMinimumValue() {
- openPage();
- typeAndSubmit(inputAge, getMess("long-range--bellow"));
- waitForTextEquals(getMessageFor(inputAge), getMess("bean-age--min"));
+ public void testAgeMaximumValue() {
+ typeAndSubmit(LOC_INPUT_HIBERNATE_AGE, MSG_INPUT_MUST_BE_GREATER_THAN_OR_EQUAL);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_AGE), MSG_OUTPUT_MUST_BE_GREATER_THAN_OR_EQUAL);
}
+ /**
+ * Try input age as non-Integer (alphabetical chars) and checks that
+ * validation message will appear.
+ */
@Test
- public void ageMaximumValue() {
- openPage();
- typeAndSubmit(inputAge, getMess("bean-age--max--enter"));
- waitForTextEquals(getMessageFor(inputAge), getMess("bean-age--max"));
+ public void testAgeIntegerOnly() {
+ final String validationMessage = format(MSG_OUTPUT_MUST_BE_A_NUMBER, LOC_INPUT_HIBERNATE_AGE);
+ typeAndSubmit(LOC_INPUT_HIBERNATE_AGE, MSG_INPUT_IS_NOT_NUMBER);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_AGE), validationMessage);
}
+ /**
+ * Try input no input first and wait for validation message appears and then
+ * type a valid input and checks that validation message will disappear.
+ */
@Test
- public void ageIntegerOnly() {
- openPage();
- typeAndSubmit(inputAge, formatMess("age-integer-only--enter", inputAge));
- waitForTextEquals(getMessageFor(inputAge), formatMess(
- "bean-age--integer-only", selenium.getAttribute(format(
- "{0}/@id", inputAge))));
+ public void testAgeMessageDisappers() {
+ // first violate validation error
+ testAgeValueRequired();
+ // then try valid input
+ typeAndSubmit(LOC_INPUT_HIBERNATE_AGE, MSG_INPUT_VALID_AGE);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_AGE), "");
}
+ /**
+ * Try to enter empty email address and checks that validation message
+ * appears.
+ */
@Test
- public void ageMessageDisappers() {
- ageValueRequired();
- typeAndSubmit(inputAge, getMess("valid-age"));
- waitForTextEquals(getMessageFor(inputAge), "");
+ public void testEmailMayNotBeNullOrEmpty() {
+ typeAndSubmit(LOC_INPUT_HIBERNATE_EMAIL, "");
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_EMAIL), MSG_OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY);
}
+ /**
+ * Try to enter one space like a email address and checks that validation
+ * message appears.
+ */
@Test
- public void emailMayNotBeNullOrEmpty() {
- openPage();
- typeAndSubmit(inputEmail, "");
- waitForTextEquals(getMessageFor(inputEmail),
- getMess("may-not-be-null-or-empty"));
+ public void testEmailOnlySpaces() {
+ typeAndSubmit(LOC_INPUT_HIBERNATE_EMAIL, " ");
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_EMAIL), MSG_OUTPUT_NOT_WELL_FORMED_EMAIL);
}
+ /**
+ * Enter bad email address (only domain name suffix) and checks that
+ * validation message appears.
+ */
@Test
- public void emailOnlySpaces() {
- openPage();
- typeAndSubmit(inputEmail, " ");
- waitForTextEquals(getMessageFor(inputEmail),
- getMess("not-well-formed-email"));
+ public void testEmailBad1() {
+ typeAndSubmit(LOC_INPUT_HIBERNATE_EMAIL, MSG_INPUT_NOT_WELL_FORMED_EMAIL_1);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_EMAIL), MSG_OUTPUT_NOT_WELL_FORMED_EMAIL);
}
+ /**
+ * Enter bad email address (only @ char with domain name suffix) and checks
+ * that testValidation message appears.
+ */
@Test
- public void emailBad1() {
- openPage();
- typeAndSubmit(inputEmail, getMess("bad-email-1"));
- waitForTextEquals(getMessageFor(inputEmail),
- getMess("not-well-formed-email"));
+ public void testEmailBad2() {
+ typeAndSubmit(LOC_INPUT_HIBERNATE_EMAIL, MSG_INPUT_NOT_WELL_FORMED_EMAIL_2);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_EMAIL), MSG_OUTPUT_NOT_WELL_FORMED_EMAIL);
}
+ /**
+ * Enter bad email address, wait for validation message appear and then try
+ * to enter valid email address and checks that validation message appear.
+ */
@Test
- public void emailBad2() {
- openPage();
- typeAndSubmit(inputEmail, getMess("bad-email-2"));
- waitForTextEquals(getMessageFor(inputEmail),
- getMess("not-well-formed-email"));
+ public void testEmailMessageDisappers() {
+ // first violate validation error
+ testEmailMayNotBeNullOrEmpty();
+ // then try valid input
+ typeAndSubmit(LOC_INPUT_HIBERNATE_EMAIL, MSG_INPUT_WELL_FORMED_EMAIL);
+ waitForTextEquals(getMessageFor(LOC_INPUT_HIBERNATE_EMAIL), "");
}
+
+ private void typeAndSubmit(String locator, String value) {
+ selenium.type(locator, value);
+ selenium.click(LOC_BUTTON_SUBMIT);
+ }
- @Test
- public void emailMessageDisappers() {
- emailMayNotBeNullOrEmpty();
- typeAndSubmit(inputEmail, getMess("well-formed-email"));
- waitForTextEquals(getMessageFor(inputEmail), "");
+ private String getMessageFor(String locator) {
+ return format(LOC_VALIDATION_MESSAGE_RELATIVE, locator);
}
+
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Bean Validator");
+
+ scrollIntoView(LOC_FIELDSET_HEADER, true);
+ }
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/beanValidator/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/beanValidator/locators.properties 2009-09-03 06:45:41 UTC (rev 15444)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/beanValidator/locators.properties 2009-09-03 11:13:01 UTC (rev 15445)
@@ -1,6 +1,6 @@
-bean-validator--header=//legend[text()\='Title']
-bean-validator--input--name=//input[@id\='beanValidatorForm\:name']
-bean-validator--input--email=//input[@id\='beanValidatorForm\:email']
-bean-validator--input--age=//input[@id\='beanValidatorForm\:age']
-bean-validator--relative--validation-message={0}/../../td[3]/*[1][@class\='rich-message']
-bean-validator--button--submit=//input[@type\='button' and @value\='Submit']
\ No newline at end of file
+FIELDSET_HEADER=//legend[text()\='Title']
+BUTTON_SUBMIT=//input[@type\='button' and @value\='Submit']
+VALIDATION_MESSAGE_RELATIVE=//input[@id\='{0}']/../../td[3]/*[1][@class\='rich-message']
+INPUT_HIBERNATE_NAME=beanValidatorForm\:name
+INPUT_HIBERNATE_AGE=beanValidatorForm\:age
+INPUT_HIBERNATE_EMAIL=beanValidatorForm\:email
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/beanValidator/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/beanValidator/messages.properties 2009-09-03 06:45:41 UTC (rev 15444)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/beanValidator/messages.properties 2009-09-03 11:13:01 UTC (rev 15445)
@@ -1,18 +1,18 @@
-may-not-be-null-or-empty=may not be null or empty
-less-than-minimum--enter=12
-bean-name--length=length must be between 3 and 12
-greater-than-maximum--enter=1234567890123
-bean-name--not-empty=This string contain only spaces
-bean-name--valid-input=Sam Hawkings
-may-not-be-null=may not be null
-long-range--bellow=17
-bean-age--min=must be greater than or equal to 18
-bean-age--max--enter=101
-bean-age--max=must be less than or equal to 100
-age-integer-only--enter=abc
-bean-age--integer-only={0}\: 'abc' must be a number between -2147483648 and 2147483647 Example\: 9346
-valid-age=18
-bad-email-1=corporation.com
-bad-email-2=(a)corporation.com
-well-formed-email=email(a)corporation.com
-not-well-formed-email=not a well-formed email address
+INPUT_VALUE_IS_LESS_THAN_MINIMUM=12
+INPUT_VALUE_IS_GREATER_THAN_MAXIMUM=1234567890123
+INPUT_IS_NOT_NUMBER=abc
+INPUT_VALID_AGE=18
+INPUT_VALID_NAME=Sam Hawkings
+INPUT_NOT_WELL_FORMED_EMAIL_1=corporation.com
+INPUT_NOT_WELL_FORMED_EMAIL_2=(a)corporation.com
+INPUT_WELL_FORMED_EMAIL=email(a)corporation.com
+INPUT_MUST_BE_GREATER_THAN_OR_EQUAL=17
+INPUT_MUST_BE_LESS_THAN_OR_EQUAL=101
+OUTPUT_STRING_CONTAIN_ONLY_SPACES=This string contain only spaces
+OUTPUT_LENGTH_MUST_BE_BETWEEN=length must be between 3 and 12
+OUTPUT_MAY_NOT_BE_NULL=may not be null
+OUTPUT_MUST_BE_GREATER_THAN_OR_EQUAL=must be greater than or equal to 18
+OUTPUT_MUST_BE_LESS_THAN_OR_EQUAL=must be less than or equal to 100
+OUTPUT_MUST_BE_A_NUMBER={0}\: 'abc' must be a number between -2147483648 and 2147483647 Example\: 9346
+OUTPUT_MAY_NOT_BE_NULL_OR_EMPTY=may not be null or empty
+OUTPUT_NOT_WELL_FORMED_EMAIL=not a well-formed email address
15 years, 3 months
JBoss Rich Faces SVN: r15444 - in branches/community/3.3.X/ui: scrollableDataTable/src/main/javascript/ClientUI/common/box and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-09-03 02:45:41 -0400 (Thu, 03 Sep 2009)
New Revision: 15444
Modified:
branches/community/3.3.X/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js
branches/community/3.3.X/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js
branches/community/3.3.X/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js
Log:
ExtendedDataTable in modal panel - undefined this.selectionManger
https://jira.jboss.org/jira/browse/RF-6439
Modified: branches/community/3.3.X/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js
===================================================================
--- branches/community/3.3.X/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js 2009-09-02 15:42:08 UTC (rev 15443)
+++ branches/community/3.3.X/ui/extendedDataTable/src/main/javascript/ClientUI/controls/datatable/ExtendedDataTable.js 2009-09-03 06:45:41 UTC (rev 15444)
@@ -32,10 +32,7 @@
var grid = this;
- Utils.execOnLoad(
- function(){
- grid.update(true);
- },
+ this.updateTimerId = Utils.execOnLoad( function(){ grid.update(true); },
Utils.Condition.ElementPresent(id+':od'), 100);
},
@@ -52,6 +49,11 @@
Utils.DOM.Event.removeListeners(this.groupRows[i]);
}
}
+
+ if (this.updateTimerId) {
+ clearInterval(this.updateTimerId)
+ }
+
//null all references to DOM elements
delete this.selectionManager;
delete this.header;
Modified: branches/community/3.3.X/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js
===================================================================
--- branches/community/3.3.X/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js 2009-09-02 15:42:08 UTC (rev 15443)
+++ branches/community/3.3.X/ui/scrollableDataTable/src/main/javascript/ClientUI/common/box/Box.js 2009-09-03 06:45:41 UTC (rev 15444)
@@ -72,7 +72,7 @@
getHeight: function() {
var el = this.getElement();
if(el.tagName.toLowerCase() != "body") {
- var h = el.getHeight(); // offsetHeight;
+ var h = el.offsetHeight;
return h>0 ? h : (this.element.boxHeight ? parseInt(this.element.boxHeight) : 0);
}
Modified: branches/community/3.3.X/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js
===================================================================
--- branches/community/3.3.X/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js 2009-09-02 15:42:08 UTC (rev 15443)
+++ branches/community/3.3.X/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js 2009-09-03 06:45:41 UTC (rev 15444)
@@ -286,17 +286,21 @@
};
*/
Utils.execOnLoad = function(func, condition, timeout) {
-
if (condition()) {
func();
} else {
- window.setTimeout(
+ var intervalId = setInterval(
function() {
- Utils.execOnLoad(func, condition, timeout);
+ if (condition()) {
+ func();
+ clearInterval(intervalId);
+ }
},
timeout
);
}
+
+ return intervalId;
};
Utils.Condition = {
ElementPresent : function(element) {
15 years, 3 months
JBoss Rich Faces SVN: r15443 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2009-09-02 11:42:08 -0400 (Wed, 02 Sep 2009)
New Revision: 15443
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_message.xml
Log:
RF-7756: Rich Miscellaneous component group description review --> rich:message
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_message.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_message.xml 2009-09-02 15:01:21 UTC (rev 15442)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_message.xml 2009-09-02 15:42:08 UTC (rev 15443)
@@ -1,13 +1,8 @@
<section role="NotInToc" id="rich_message">
<title>
- <
- rich:message
- >
- <emphasis role="since">
- <superscript> available since <emphasis role="version">3.1.0</emphasis>
- </superscript>
- </emphasis>
+ <rich:message> <emphasis role="since"><superscript> available since <emphasis role="version">3.1.0</emphasis></superscript></emphasis>
</title>
+
<section>
<title>Description</title>
<para>The component is used for rendering a single message for a specific component. </para>
@@ -62,45 +57,9 @@
</listitem>
</itemizedlist>
</para>
- <para> A set of facets which can be used for marker defining: <itemizedlist>
- <listitem>
- <para>
- <emphasis>
- <property>"passedMarker"</property>
- </emphasis>. This facet is provided to allow setting a marker to display if
- there is no message</para>
- </listitem>
- <listitem>
- <para>
- <emphasis>
- <property>"errorMarker"</property>
- </emphasis>. This facet is provided to allow setting a marker to display if there
- is a message with a severity class of "ERROR"</para>
- </listitem>
- <listitem>
- <para>
- <emphasis>
- <property>"fatalMarker"</property>
- </emphasis>. This facet is provided to allow setting a marker to display if there
- is a message with a severity class of "FATAL"</para>
- </listitem>
- <listitem>
- <para>
- <emphasis>
- <property>"infoMarker"</property>
- </emphasis>. This facet is provided to allow setting a marker to display if there
- is a message with a severity class of "INFO"</para>
- </listitem>
- <listitem>
- <para>
- <emphasis>
- <property>"warnMarker"</property>
- </emphasis>. This facet is provided to allow setting a marker to display if there
- is a message with a severity class of "WARN"</para>
- </listitem>
- </itemizedlist>
- </para>
+
+
<para> The following example shows different variants for component customization. The
attribute <emphasis>
<property>"passedLabel"</property>
@@ -173,38 +132,42 @@
</tgroup>
</table>
<table>
- <title>Facets</title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>Facet</entry>
- <entry>Description</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>errorMarker</entry>
- <entry>Redefines the content for the marker if there is message with a severity class of "ERROR"</entry>
- </row>
- <row>
- <entry>fatalError</entry>
- <entry>Redefines the content for the marker if there is message with a severity class of "FATAL"</entry>
- </row>
- <row>
- <entry>infoError</entry>
- <entry>Redefines the content for the marker if there is message with a severity class of "INFO"</entry>
- </row>
- <row>
- <entry>warnError</entry>
- <entry>Redefines the content for the marker if there is message with a severity class of "WARN"</entry>
- </row>
- <row>
- <entry>passedError</entry>
- <entry>Redefines the content for the marker if there is no message</entry>
- </row>
- </tbody>
- </tgroup>
+
+ <title>Facets</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Facet</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>errorMarker</entry>
+ <entry>Defines pictogram for message with <property>error</property> severity class</entry>
+ </row>
+ <row>
+ <entry>fatalMarker</entry>
+ <entry>Defines pictogram for message with <property>fatal</property> severity class</entry>
+ </row>
+ <row>
+ <entry>infoMarker</entry>
+ <entry>Defines pictogram for message with <property>info</property> severity class</entry>
+ </row>
+ <row>
+ <entry>passedMarker</entry>
+ <entry>Defines pictogram if there is no <property>fatal</property>, <property>error</property>, <property>warn</property> or <property>info</property> message</entry>
+ </row>
+ <row>
+ <entry>warnMarker</entry>
+ <entry>Defines pictogram for message with <property>warn</property> severity class</entry>
+ </row>
+ </tbody>
+ </tgroup>
</table>
+
+
+
<table id="mC">
<title>Classes names that define a component appearance</title>
15 years, 3 months
JBoss Rich Faces SVN: r15442 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: resources/org/jboss/richfaces/integrationTest/style and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-02 11:01:21 -0400 (Wed, 02 Sep 2009)
New Revision: 15442
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/style/StyleTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/style/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/style/messages.properties
Log:
- refactored Style test cases to follow conventions
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/style/StyleTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/style/StyleTestCase.java 2009-09-02 14:44:59 UTC (rev 15441)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/style/StyleTestCase.java 2009-09-02 15:01:21 UTC (rev 15442)
@@ -1,3 +1,23 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This code 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 test suite; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.jboss.richfaces.integrationTest.style;
import java.util.LinkedHashMap;
@@ -3,8 +23,9 @@
import java.util.Map;
-import junit.framework.Assert;
+import static org.testng.Assert.*;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
import org.jboss.test.selenium.waiting.Wait;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -14,44 +35,50 @@
* @version $Revision$
*/
public class StyleTestCase extends AbstractSeleniumRichfacesTestCase {
- /**
- * Opens specified page
- */
- private void openPage() {
- selenium.open(contextPath
- + "/richfaces/style.jsf?c=loadStyle&tab=usage");
- scrollIntoView(header, true);
- }
- private String header = getLoc("style--header");
- private String linkDeepMarine = getLoc("style--link--deep-marine");
- private String linkBlueSky = getLoc("style--link--blue-sky");
- private String linkJapanCherry = getLoc("style--link--japan-cherry");
- private String tableOutput = getLoc("style--table--output");
- private String colorDeepMarine = getMess("style--color--deep-marine");
- private String colorBlueSky = getMess("style--color--blue-sky");
- private String colorJapanCherry = getMess("style--color--japan-cherry");
+ private String LOC_FIELDSET_HEADER = getLoc("FIELDSET_HEADER");
+ private String LOC_LINK_DEEP_MARINE = getLoc("LINK_DEEP_MARINE");
+ private String LOC_LINK_BLUE_SKY = getLoc("LINK_BLUE_SKY");
+ private String LOC_LINK_JAPAN_CHERRY = getLoc("LINK_JAPAN_CHERRY");
+ private String LOC_PANEL = getLoc("PANEL");
+ private String MSG_COLOR_DEEP_MARINE = getMsg("COLOR_DEEP_MARINE");
+ private String MSG_COLOR_BLUE_SKY = getMsg("COLOR_BLUE_SKY");
+ private String MSG_COLOR_JAPAN_CHERRY = getMsg("COLOR_JAPAN_CHERRY");
+
Map<String, String> relation = new LinkedHashMap<String, String>() {
+ private static final long serialVersionUID = 1576758688687867261L;
{
- put(linkDeepMarine, colorDeepMarine);
- put(linkBlueSky, colorBlueSky);
- put(linkJapanCherry, colorJapanCherry);
+ put(LOC_LINK_DEEP_MARINE, MSG_COLOR_DEEP_MARINE);
+ put(LOC_LINK_BLUE_SKY, MSG_COLOR_BLUE_SKY);
+ put(LOC_LINK_JAPAN_CHERRY, MSG_COLOR_JAPAN_CHERRY);
}
};
+ /**
+ * Clicks on the skin names and waits for background-color changes
+ * appropriately.
+ */
@Test
public void testBackgroundColor() {
- openPage();
+ for (final String locLink : relation.keySet()) {
+ final String msgColor = relation.get(locLink);
- for (final String link : relation.keySet()) {
- final String color = relation.get(link);
-
- selenium.click(link);
+ selenium.click(locLink);
selenium.waitForPageToLoad(Long.toString(Wait.DEFAULT_TIMEOUT));
- scrollIntoView(header, true);
- Assert.assertEquals(color, getStyle(tableOutput, "background-color"));
+ scrollIntoView(LOC_FIELDSET_HEADER, true);
+
+ assertEquals(msgColor, getStyle(LOC_PANEL, "background-color"), format(
+ "background-color for '{0}' skin does not match", selenium.getText(locLink)));
}
}
+
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Style");
+
+ scrollIntoView(LOC_FIELDSET_HEADER, true);
+ }
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/style/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/style/locators.properties 2009-09-02 14:44:59 UTC (rev 15441)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/style/locators.properties 2009-09-02 15:01:21 UTC (rev 15442)
@@ -1,5 +1,5 @@
-style--header=//legend[text()\='Style demo']
-style--link--deep-marine=//a[text()\='DeepMarine']
-style--link--blue-sky=//a[text()\='BlueSky']
-style--link--japan-cherry=//a[text()\='JapanCherry']
-style--table--output=//table[@class\='rsPanel']
\ No newline at end of file
+FIELDSET_HEADER=//legend[text()\='Style demo']
+LINK_DEEP_MARINE=//a[text()\='DeepMarine']
+LINK_BLUE_SKY=//a[text()\='BlueSky']
+LINK_JAPAN_CHERRY=//a[text()\='JapanCherry']
+PANEL=//table[@class\='rsPanel']
\ No newline at end of file
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/style/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/style/messages.properties 2009-09-02 14:44:59 UTC (rev 15441)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/style/messages.properties 2009-09-02 15:01:21 UTC (rev 15442)
@@ -1,3 +1,3 @@
-style--color--deep-marine=rgb(0, 136, 148)
-style--color--blue-sky=rgb(190, 214, 248)
-style--color--japan-cherry=rgb(232, 189, 189)
+COLOR_DEEP_MARINE=rgb(0, 136, 148)
+COLOR_BLUE_SKY=rgb(190, 214, 248)
+COLOR_JAPAN_CHERRY=rgb(232, 189, 189)
15 years, 3 months
JBoss Rich Faces SVN: r15441 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: resources/org/jboss/richfaces/integrationTest/script and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-02 10:44:59 -0400 (Wed, 02 Sep 2009)
New Revision: 15441
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/script/ScriptTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/script/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/script/messages.properties
Log:
- refactored Script test cases to follow conventions
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/script/ScriptTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/script/ScriptTestCase.java 2009-09-02 14:44:39 UTC (rev 15440)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/script/ScriptTestCase.java 2009-09-02 14:44:59 UTC (rev 15441)
@@ -1,10 +1,30 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This code 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 test suite; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
package org.jboss.richfaces.integrationTest.script;
-import junit.framework.Assert;
+import static org.testng.Assert.*;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
-import org.jboss.test.selenium.waiting.Condition;
-import org.jboss.test.selenium.waiting.Wait;
+import org.jboss.test.selenium.waiting.*;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -12,56 +32,59 @@
* @version $Revision$
*/
public class ScriptTestCase extends AbstractSeleniumRichfacesTestCase {
+
+ private String LOC_FIELDSET_HEADER = getLoc("FIELDSET_HEADER");
+ private String LOC_BUTTON_HIDE = getLoc("BUTTON_HIDE");
+ private String LOC_BUTTON_SHOW = getLoc("BUTTON_SHOW");
+ private String LOC_INPUT_NAME = getLoc("INPUT_NAME");
+ private String LOC_INPUT_JOB = getLoc("INPUT_JOB");
+ private String LOC_BUTTON_SUBMIT = getLoc("BUTTON_SUBMIT");
+ private String LOC_OUTPUT_NAME = getLoc("OUTPUT_NAME");
+ private String LOC_OUTPUT_JOB = getLoc("OUTPUT_JOB");
+ private String LOC_PANEL_HIDABLE = getLoc("PANEL_HIDABLE");
+
+ private String MSG_INPUT_NAME = getMsg("INPUT_NAME");
+ private String MSG_INPUT_JOB = getMsg("INPUT_JOB");
+ private String MSG_REGEXP_PREFIX_NAME = getMsg("REGEXP_PREFIX_NAME");
+ private String MSG_REGEXP_PREFIX_JOB = getMsg("REGEXP_PREFIX_JOB");
+
/**
- * Opens specified page
+ * Simply click to hide button and checks that panel disappears
*/
- private void openPage() {
- selenium.open(contextPath
- + "/richfaces/script.jsf?c=loadScript&tab=usage");
- scrollIntoView(header, true);
- }
-
- private String header = getLoc("script--header");
- private String buttonHide = getLoc("script--button--hide");
- private String buttonShow = getLoc("script--button--show");
- private String inputName = getLoc("script--input--name");
- private String inputJob = getLoc("script--input--job");
- private String buttonSubmit = getLoc("script--button--submit");
- private String outputName = getLoc("script--output--name");
- private String outputJob = getLoc("script--output--job");
- private String panelMyPanel = getLoc("script--panel--mypanel");
- private String messName = getMess("script--input--name");
- private String messJob = getMess("script--input--job");
- private String prefixName = getMess("script--regexp--name-prefix");
- private String prefixJob = getMess("script--regexp--job-prefix");
-
@Test
public void testHide() {
- openPage();
-
hide();
}
+ /**
+ * Simply hide panel and next click to show button and checks that panel
+ * appears again
+ */
@Test
public void testHideAndShow() {
- openPage();
-
hide();
show();
}
+ /**
+ * Fill name and job in and checks that after submit the output will be
+ * changed right.
+ */
@Test
public void testFillIn() {
- openPage();
-
fillIn();
submit();
validateOutput();
}
+ /**
+ * Fill name and job in, submit, hide and show the panel again and next
+ * checks, that output is valid. Then submit again and again check output.
+ */
@Test
public void testFillInHideAndShow() {
- testFillIn();
+ fillIn();
+ submit();
hide();
show();
validateOutput();
@@ -70,8 +93,8 @@
}
private void fillIn() {
- selenium.type(inputName, messName);
- selenium.type(inputJob, messJob);
+ selenium.type(LOC_INPUT_NAME, MSG_INPUT_NAME);
+ selenium.type(LOC_INPUT_JOB, MSG_INPUT_JOB);
}
private void submit() {
@@ -80,7 +103,7 @@
final String job = getJob();
// click on Submit
- selenium.click(buttonSubmit);
+ selenium.click(LOC_BUTTON_SUBMIT);
// wait until output changes or 5 sec
Wait.dontFail().timeout(5000).until(new Condition() {
@@ -92,35 +115,43 @@
}
private void validateOutput() {
- Assert.assertEquals(messName, getName());
- Assert.assertEquals(messJob, getJob());
+ assertEquals(MSG_INPUT_NAME, getName(), "Output name isn't right");
+ assertEquals(MSG_INPUT_JOB, getJob(), "Output job isn't right");
}
private String getName() {
- return selenium.getText(outputName).replaceFirst(prefixName, "");
+ return selenium.getText(LOC_OUTPUT_NAME).replaceFirst(MSG_REGEXP_PREFIX_NAME, "");
}
private String getJob() {
- return selenium.getText(outputJob).replaceFirst(prefixJob, "");
+ return selenium.getText(LOC_OUTPUT_JOB).replaceFirst(MSG_REGEXP_PREFIX_JOB, "");
}
private void hide() {
- selenium.click(buttonHide);
+ selenium.click(LOC_BUTTON_HIDE);
- Wait.until(new Condition() {
+ Wait.failWith("Hidable panel never hides").until(new Condition() {
public boolean isTrue() {
- return "none".equals(getStyle(panelMyPanel, "display"));
+ return "none".equals(getStyle(LOC_PANEL_HIDABLE, "display"));
}
});
}
private void show() {
- selenium.click(buttonShow);
+ selenium.click(LOC_BUTTON_SHOW);
- Wait.until(new Condition() {
+ Wait.failWith("Hidable panel never shows again").until(new Condition() {
public boolean isTrue() {
- return "block".equals(getStyle(panelMyPanel, "display"));
+ return "block".equals(getStyle(LOC_PANEL_HIDABLE, "display"));
}
});
}
+
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Script");
+
+ scrollIntoView(LOC_FIELDSET_HEADER, true);
+ }
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/script/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/script/locators.properties 2009-09-02 14:44:39 UTC (rev 15440)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/script/locators.properties 2009-09-02 14:44:59 UTC (rev 15441)
@@ -1,9 +1,9 @@
-script--header=//legend[text()\='Script demo']
-script--button--hide=//*[@type\='submit' and @value\='Hide']
-script--button--show=//*[@type\='submit' and @value\='Show']
-script--button--submit=//*[@type\='submit' and @value\='Submit']
-script--input--name=//span[text()\='Name\:']/../../td[2]/input[@type\='text']
-script--input--job=//span[text()\='Job\:']/../../td[2]/input[@type\='text']
-script--output--name=//*[@id\='out']//*[starts-with(text(), 'Name\:')]
-script--output--job=//*[@id\='out']//*[starts-with(text(), 'Job\:')]
-script--panel--mypanel=//div[@id\='mypanel']
+FIELDSET_HEADER=//legend[text()\='Script demo']
+BUTTON_HIDE=//*[@type\='submit' and @value\='Hide']
+BUTTON_SHOW=//*[@type\='submit' and @value\='Show']
+BUTTON_SUBMIT=//*[@type\='submit' and @value\='Submit']
+INPUT_NAME=//span[text()\='Name\:']/../../td[2]/input[@type\='text']
+INPUT_JOB=//span[text()\='Job\:']/../../td[2]/input[@type\='text']
+OUTPUT_NAME=//*[@id\='out']//*[starts-with(text(), 'Name\:')]
+OUTPUT_JOB=//*[@id\='out']//*[starts-with(text(), 'Job\:')]
+PANEL_HIDABLE=//div[@id\='mypanel']
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/script/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/script/messages.properties 2009-09-02 14:44:39 UTC (rev 15440)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/script/messages.properties 2009-09-02 14:44:59 UTC (rev 15441)
@@ -1,4 +1,4 @@
-script--input--name=abc
-script--input--job=def
-script--regexp--name-prefix=Name\:\\s*
-script--regexp--job-prefix=Job\:\\s*
+INPUT_NAME=abc
+INPUT_JOB=def
+REGEXP_PREFIX_NAME=Name\:\\s*
+REGEXP_PREFIX_JOB=Job\:\\s*
15 years, 3 months
JBoss Rich Faces SVN: r15440 - branches/community/3.3.X/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2009-09-02 10:44:39 -0400 (Wed, 02 Sep 2009)
New Revision: 15440
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/resources/images/message_init.png
Log:
RF-7756: Rich Miscellaneous component group description review --> rich:message
Modified: branches/community/3.3.X/docs/userguide/en/src/main/resources/images/message_init.png
===================================================================
(Binary files differ)
15 years, 3 months