Author: ppitonak(a)redhat.com
Date: 2009-09-08 10:54:18 -0400 (Tue, 08 Sep 2009)
New Revision: 15495
Added:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/messages.properties
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/simpleTogglePanel/SimpleTogglePanelTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spinner/SpinnerTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tabPanel/TabPanelTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/messages.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/messages.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/messages.properties
Log:
* SpinnerTestCase, SimpleTogglePanelTestCase, SuggestionBoxTestCase and TabPanelTestCase
refactored
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/simpleTogglePanel/SimpleTogglePanelTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/simpleTogglePanel/SimpleTogglePanelTestCase.java 2009-09-08
14:43:30 UTC (rev 15494)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/simpleTogglePanel/SimpleTogglePanelTestCase.java 2009-09-08
14:54:18 UTC (rev 15495)
@@ -1,3 +1,21 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
package org.jboss.richfaces.integrationTest.simpleTogglePanel;
import static org.testng.Assert.assertFalse;
@@ -13,176 +31,158 @@
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
-public class SimpleTogglePanelTestCase extends
- AbstractSeleniumRichfacesTestCase {
+public class SimpleTogglePanelTestCase extends AbstractSeleniumRichfacesTestCase {
- // messages
- private final String MSG_COMPONENT_DESCRIPTION =
getMess("COMPONENT_DESCRIPTION");
- private final String MSG_PANEL_HEADER = getMess("PANEL_HEADER");
- private final String MSG_LEFT_ARROWS_SHOULD_BE_VISIBLE =
getMess("LEFT_ARROWS_SHOULD_BE_VISIBLE");
- private final String MSG_LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE =
getMess("LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE");
- private final String MSG_RIGHT_ARROWS_SHOULD_BE_VISIBLE =
getMess("RIGHT_ARROWS_SHOULD_BE_VISIBLE");
- private final String MSG_RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE =
getMess("RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE");
- private final String MSG_BODY_SHOULD_BE_VISIBLE =
getMess("BODY_SHOULD_BE_VISIBLE");
- private final String MSG_BODY_SHOULD_NOT_BE_VISIBLE =
getMess("BODY_SHOULD_NOT_BE_VISIBLE");
+ // messages
+ private final String MSG_PANEL_HEADER = getMsg("PANEL_HEADER");
+ private final String MSG_LEFT_ARROWS_SHOULD_BE_VISIBLE =
getMsg("LEFT_ARROWS_SHOULD_BE_VISIBLE");
+ private final String MSG_LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE =
getMsg("LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE");
+ private final String MSG_RIGHT_ARROWS_SHOULD_BE_VISIBLE =
getMsg("RIGHT_ARROWS_SHOULD_BE_VISIBLE");
+ private final String MSG_RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE =
getMsg("RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE");
+ private final String MSG_BODY_SHOULD_BE_VISIBLE =
getMsg("BODY_SHOULD_BE_VISIBLE");
+ private final String MSG_BODY_SHOULD_NOT_BE_VISIBLE =
getMsg("BODY_SHOULD_NOT_BE_VISIBLE");
- // locators
- private final String LOC_EXAMPLE_1_HEADER = getLoc("EXAMPLE_1_HEADER");
- private final String LOC_EXAMPLE_2_HEADER = getLoc("EXAMPLE_2_HEADER");
- private final String LOC_FIRST_EXAMPLE_HEADER =
getLoc("FIRST_EXAMPLE_HEADER");
- private final String LOC_FIRST_EXAMPLE_ARROWS_LEFT =
formatLoc("FIRST_EXAMPLE_ARROWS_LEFT_RELATIVE_TO_HEADER",
LOC_FIRST_EXAMPLE_HEADER);
- private final String LOC_FIRST_EXAMPLE_ARROWS_RIGHT =
formatLoc("FIRST_EXAMPLE_ARROWS_RIGHT_RELATIVE_TO_HEADER",
LOC_FIRST_EXAMPLE_HEADER);
- private final String LOC_FIRST_EXAMPLE_BODY = getLoc("FIRST_EXAMPLE_BODY");
- private final String LOC_SECOND_EXAMPLE_N_HEADER =
getLoc("SECOND_EXAMPLE_N_HEADER");
- private final String LOC_SECOND_EXAMPLE_N_ARROWS_LEFT =
formatLoc("SECOND_EXAMPLE_N_ARROWS_LEFT_RELATIVE_TO_HEADER",
LOC_SECOND_EXAMPLE_N_HEADER);
- private final String LOC_SECOND_EXAMPLE_N_ARROWS_RIGHT =
formatLoc("SECOND_EXAMPLE_N_ARROWS_RIGHT_RELATIVE_TO_HEADER",
LOC_SECOND_EXAMPLE_N_HEADER);
- private final String LOC_SECOND_EXAMPLE_N_BODY =
getLoc("SECOND_EXAMPLE_N_BODY");
+ // locators
+ private final String LOC_EXAMPLE_1_HEADER = getLoc("EXAMPLE_1_HEADER");
+ private final String LOC_EXAMPLE_2_HEADER = getLoc("EXAMPLE_2_HEADER");
+ private final String LOC_FIRST_EXAMPLE_HEADER =
getLoc("FIRST_EXAMPLE_HEADER");
+ private final String LOC_FIRST_EXAMPLE_ARROWS_LEFT =
getLoc("FIRST_EXAMPLE_ARROWS_LEFT");
+ private final String LOC_FIRST_EXAMPLE_ARROWS_RIGHT =
getLoc("FIRST_EXAMPLE_ARROWS_RIGHT");
+ private final String LOC_FIRST_EXAMPLE_BODY =
getLoc("FIRST_EXAMPLE_BODY");
+ private final String LOC_SECOND_EXAMPLE_N_HEADER =
getLoc("SECOND_EXAMPLE_N_HEADER");
+ private final String LOC_SECOND_EXAMPLE_N_ARROWS_LEFT =
getLoc("SECOND_EXAMPLE_N_ARROWS_LEFT");
+ private final String LOC_SECOND_EXAMPLE_N_ARROWS_RIGHT =
getLoc("SECOND_EXAMPLE_N_ARROWS_RIGHT");
+ private final String LOC_SECOND_EXAMPLE_N_BODY =
getLoc("SECOND_EXAMPLE_N_BODY");
- /**
- * Tests the first example. It verifies header's text and checks that there
- * are right arrows displayed in the right side. Then it checks that the
- * panel's content is displayed and clicks header to toggle panel. Then it
- * checks again arrows and verifies that the content is hidden.
- */
- @Test
- public void testFirstExample() {
- scrollIntoView(LOC_EXAMPLE_1_HEADER, true);
- String header = "Add AJAX capability to existing JSF applications";
+ /**
+ * Tests the first example. It verifies header's text and checks that there
+ * are right arrows displayed in the right side. Then it checks that the
+ * panel's content is displayed and clicks header to toggle panel. Then it
+ * checks again arrows and verifies that the content is hidden.
+ */
+ @Test
+ public void testFirstExample() {
+ scrollIntoView(LOC_EXAMPLE_1_HEADER, true);
+ String header = "Add AJAX capability to existing JSF applications";
- String text = selenium.getText(LOC_FIRST_EXAMPLE_HEADER);
- assertTrue(text.contains(header), String.format(MSG_PANEL_HEADER,
- header));
+ String text = selenium.getText(LOC_FIRST_EXAMPLE_HEADER);
+ assertTrue(text.contains(header), format(MSG_PANEL_HEADER, header));
- assertTrue(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_LEFT),
- MSG_LEFT_ARROWS_SHOULD_BE_VISIBLE);
- assertFalse(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_RIGHT),
- MSG_RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE);
- assertTrue(isDisplayed(LOC_FIRST_EXAMPLE_BODY),
- MSG_BODY_SHOULD_BE_VISIBLE);
+ assertTrue(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_LEFT),
MSG_LEFT_ARROWS_SHOULD_BE_VISIBLE);
+ assertFalse(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_RIGHT),
MSG_RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE);
+ assertTrue(isDisplayed(LOC_FIRST_EXAMPLE_BODY), MSG_BODY_SHOULD_BE_VISIBLE);
- selenium.click(LOC_FIRST_EXAMPLE_HEADER);
+ selenium.click(LOC_FIRST_EXAMPLE_HEADER);
- assertFalse(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_LEFT),
- MSG_LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE);
- assertTrue(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_RIGHT),
- MSG_RIGHT_ARROWS_SHOULD_BE_VISIBLE);
- assertFalse(isDisplayed(LOC_FIRST_EXAMPLE_BODY),
- MSG_BODY_SHOULD_NOT_BE_VISIBLE);
- }
+ assertFalse(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_LEFT),
MSG_LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE);
+ assertTrue(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_RIGHT),
MSG_RIGHT_ARROWS_SHOULD_BE_VISIBLE);
+ assertFalse(isDisplayed(LOC_FIRST_EXAMPLE_BODY),
MSG_BODY_SHOULD_NOT_BE_VISIBLE);
+ }
- /**
- * Tests the second example -- server switch type. It verifies header's text
- * and checks that there are right arrows displayed in the right side. Then
- * it checks that the panel's content is displayed and clicks header to
- * toggle panel. Then it checks again arrows and verifies that the content
- * is hidden.
- */
- @Test
- public void testSecondExampleServerSwitch() {
- abstractTestPanelInSecondExample(1, "Server Switch Type");
- }
+ /**
+ * Tests the second example -- server switch type. It verifies header's text
+ * and checks that there are right arrows displayed in the right side. Then
+ * it checks that the panel's content is displayed and clicks header to
+ * toggle panel. Then it checks again arrows and verifies that the content
+ * is hidden.
+ */
+ @Test
+ public void testSecondExampleServerSwitch() {
+ abstractTestPanelInSecondExample(1, "Server Switch Type");
+ }
- /**
- * Tests the second example -- ajax switch type. It verifies header's text
- * and checks that there are right arrows displayed in the right side. Then
- * it checks that the panel's content is displayed and clicks header to
- * toggle panel. Then it checks again arrows and verifies that the content
- * is hidden.
- */
- @Test
- public void testSecondExampleAjaxSwitch() {
- abstractTestPanelInSecondExample(2, "Ajax Switch Type");
- }
+ /**
+ * Tests the second example -- ajax switch type. It verifies header's text
+ * and checks that there are right arrows displayed in the right side. Then
+ * it checks that the panel's content is displayed and clicks header to
+ * toggle panel. Then it checks again arrows and verifies that the content
+ * is hidden.
+ */
+ @Test
+ public void testSecondExampleAjaxSwitch() {
+ abstractTestPanelInSecondExample(2, "Ajax Switch Type");
+ }
- /**
- * Tests the second example -- client switch type. It verifies header's text
- * and checks that there are right arrows displayed in the right side. Then
- * it checks that the panel's content is displayed and clicks header to
- * toggle panel. Then it checks again arrows and verifies that the content
- * is hidden.
- */
- @Test
- public void testSecondExampleClientSwitch() {
- abstractTestPanelInSecondExample(3, "Client Switch Type");
- }
+ /**
+ * Tests the second example -- client switch type. It verifies header's text
+ * and checks that there are right arrows displayed in the right side. Then
+ * it checks that the panel's content is displayed and clicks header to
+ * toggle panel. Then it checks again arrows and verifies that the content
+ * is hidden.
+ */
+ @Test
+ public void testSecondExampleClientSwitch() {
+ abstractTestPanelInSecondExample(3, "Client Switch Type");
+ }
- /**
- * Tests the "View Source" in the first example. It checks that the source
- * code is not visible, clicks on the link, and checks 5 lines of source
- * code.
- */
- @Test
- public void testFirstExampleSource() {
- String[] strings = new String[] {
- "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
- "<rich:simpleTogglePanel switchType=\"client\" label=\"Add
AJAX capability to existing JSF applications\">",
- "The framework is implemented by using a component library. The library",
- "</rich:simpleTogglePanel>", "</ui:composition>", };
+ /**
+ * Tests the "View Source" in the first example. It checks that the source
+ * code is not visible, clicks on the link, and checks 5 lines of source
+ * code.
+ */
+ @Test
+ public void testFirstExampleSource() {
+ String[] strings = new String[] {
+ "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<rich:simpleTogglePanel switchType=\"client\"
label=\"Add AJAX capability to existing JSF applications\">",
+ "The framework is implemented by using a component library. The
library", "</rich:simpleTogglePanel>",
+ "</ui:composition>", };
- abstractTestSource(1, "View Source", strings);
- }
+ abstractTestSource(1, "View Source", strings);
+ }
- /**
- * Tests the "View Source" in the second example. It checks that the source
- * code is not visible, clicks on the link, and checks 7 lines of source
- * code.
- */
- @Test
- public void testSecondExampleSource() {
- String[] strings = new String[] {
- "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
- "<h:form>",
- "<h:panelGrid columns=\"3\" width=\"100%\"
columnClasses=\"tpanels,tpanels,tpanels\">",
- "<rich:simpleTogglePanel switchType=\"server\" label=\"Server
Switch Type\" height=\"90px\">",
- "<rich:simpleTogglePanel switchType=\"ajax\" label=\"Ajax
Switch Type\" height=\"90px\">",
- "<rich:simpleTogglePanel switchType=\"client\" label=\"Client
Switch Type\" height=\"90px\">",
- "</rich:simpleTogglePanel>", };
+ /**
+ * Tests the "View Source" in the second example. It checks that the
source
+ * code is not visible, clicks on the link, and checks 7 lines of source
+ * code.
+ */
+ @Test
+ public void testSecondExampleSource() {
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"", "<h:form>",
+ "<h:panelGrid columns=\"3\" width=\"100%\"
columnClasses=\"tpanels,tpanels,tpanels\">",
+ "<rich:simpleTogglePanel switchType=\"server\"
label=\"Server Switch Type\" height=\"90px\">",
+ "<rich:simpleTogglePanel switchType=\"ajax\"
label=\"Ajax Switch Type\" height=\"90px\">",
+ "<rich:simpleTogglePanel switchType=\"client\"
label=\"Client Switch Type\" height=\"90px\">",
+ "</rich:simpleTogglePanel>", };
- abstractTestSource(2, "View Source", strings);
- }
+ abstractTestSource(2, "View Source", strings);
+ }
- /**
- * Abstract method that is parametrized in tests.
- *
- * @param index
- * which panel should be tested
- * @param header
- * a string appearing in panel's header
- */
- private void abstractTestPanelInSecondExample(int index, String header) {
- scrollIntoView(LOC_EXAMPLE_2_HEADER, true);
+ /**
+ * Abstract method that is parametrized in tests.
+ *
+ * @param index
+ * which panel should be tested
+ * @param header
+ * a string appearing in panel's header
+ */
+ private void abstractTestPanelInSecondExample(int index, String header) {
+ scrollIntoView(LOC_EXAMPLE_2_HEADER, true);
- String text = selenium.getText(String.format(
- LOC_SECOND_EXAMPLE_N_HEADER, index));
- assertTrue(text.contains(header), String.format(MSG_PANEL_HEADER,
- header));
+ String text = selenium.getText(format(LOC_SECOND_EXAMPLE_N_HEADER, index));
+ assertTrue(text.contains(header), format(MSG_PANEL_HEADER, header));
- assertTrue(isDisplayed(String.format(LOC_SECOND_EXAMPLE_N_ARROWS_LEFT,
- index)), MSG_LEFT_ARROWS_SHOULD_BE_VISIBLE);
- assertFalse(isDisplayed(String.format(
- LOC_SECOND_EXAMPLE_N_ARROWS_RIGHT, index)),
- MSG_RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE);
- // client type is a bit different
- assertTrue(isDisplayed(String.format(LOC_SECOND_EXAMPLE_N_BODY, index,
- index == 3 ? 3 : 2)), MSG_BODY_SHOULD_BE_VISIBLE);
+ assertTrue(isDisplayed(format(LOC_SECOND_EXAMPLE_N_ARROWS_LEFT, index)),
MSG_LEFT_ARROWS_SHOULD_BE_VISIBLE);
+ assertFalse(isDisplayed(format(LOC_SECOND_EXAMPLE_N_ARROWS_RIGHT, index)),
+ MSG_RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE);
+ // client type is a bit different
+ assertTrue(isDisplayed(format(LOC_SECOND_EXAMPLE_N_BODY, index)),
MSG_BODY_SHOULD_BE_VISIBLE);
- selenium.click(String.format(LOC_SECOND_EXAMPLE_N_HEADER, index));
- waitFor(2000);
+ selenium.click(format(LOC_SECOND_EXAMPLE_N_HEADER, index));
+ waitFor(2000);
- assertFalse(isDisplayed(String.format(LOC_SECOND_EXAMPLE_N_ARROWS_LEFT,
- index)), MSG_LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE);
- assertTrue(isDisplayed(String.format(LOC_SECOND_EXAMPLE_N_ARROWS_RIGHT,
- index)), MSG_RIGHT_ARROWS_SHOULD_BE_VISIBLE);
- // client type is a bit different
- assertFalse(isDisplayed(String.format(LOC_SECOND_EXAMPLE_N_BODY, index,
- index == 3 ? 3 : 2)), MSG_BODY_SHOULD_NOT_BE_VISIBLE);
- }
+ assertFalse(isDisplayed(format(LOC_SECOND_EXAMPLE_N_ARROWS_LEFT, index)),
MSG_LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE);
+ assertTrue(isDisplayed(format(LOC_SECOND_EXAMPLE_N_ARROWS_RIGHT, index)),
MSG_RIGHT_ARROWS_SHOULD_BE_VISIBLE);
+ // client type is a bit different
+ assertFalse(isDisplayed(format(LOC_SECOND_EXAMPLE_N_BODY, index)),
MSG_BODY_SHOULD_NOT_BE_VISIBLE);
+ }
- /**
- * Loads the page containing the component.
- */
- @BeforeMethod
- private void loadPage() {
- super.loadPage("richOutputs", 8, 1, MSG_COMPONENT_DESCRIPTION);
- }
+ /**
+ * Loads the page containing the component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Simple Toggle Panel");
+ }
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spinner/SpinnerTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spinner/SpinnerTestCase.java 2009-09-08
14:43:30 UTC (rev 15494)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spinner/SpinnerTestCase.java 2009-09-08
14:54:18 UTC (rev 15495)
@@ -1,3 +1,21 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
package org.jboss.richfaces.integrationTest.spinner;
import static org.testng.Assert.assertEquals;
@@ -13,244 +31,277 @@
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
-public class SpinnerTestCase extends
- AbstractSeleniumRichfacesTestCase {
+public class SpinnerTestCase extends AbstractSeleniumRichfacesTestCase {
- // upper spinner
- private final String upperInput =
"//fieldset[1]/div/form/table[1]/tbody/tr/td[1]/input";
- private final String upperUpArrow =
"//fieldset[1]/div/form/table[1]/tbody/tr/td[2]/table/tbody/tr[1]/td/input";
- private final String upperDownArrow =
"//fieldset[1]/div/form/table[1]/tbody/tr/td[2]/table/tbody/tr[2]/td/input";
+ // locators
+ private final String LOC_EXAMPLE_HEADER = getLoc("EXAMPLE_HEADER");
+ private final String LOC_UPPER_SPINNER_INPUT =
getLoc("UPPER_SPINNER_INPUT");
+ private final String LOC_UPPER_SPINNER_UP = getLoc("UPPER_SPINNER_UP");
+ private final String LOC_UPPER_SPINNER_DOWN =
getLoc("UPPER_SPINNER_DOWN");
+ private final String LOC_LOWER_SPINNER_INPUT =
getLoc("LOWER_SPINNER_INPUT");
+ private final String LOC_LOWER_SPINNER_UP = getLoc("LOWER_SPINNER_UP");
+ private final String LOC_LOWER_SPINNER_DOWN =
getLoc("LOWER_SPINNER_DOWN");
- // lower spinner
- private final String lowerInput =
"//fieldset[1]/div/form/table[2]/tbody/tr/td[1]/input";
- private final String lowerUpArrow =
"//fieldset[1]/div/form/table[2]/tbody/tr/td[2]/table/tbody/tr[1]/td/input";
- private final String lowerDownArrow =
"//fieldset[1]/div/form/table[2]/tbody/tr/td[2]/table/tbody/tr[2]/td/input";
+ // messages
+ private final int MSG_INITIAL_STATE_UPPER =
Integer.parseInt(getMsg("INITIAL_STATE_UPPER"));
+ private final int MSG_INITIAL_STATE_LOWER =
Integer.parseInt(getMsg("INITIAL_STATE_LOWER"));
- /**
- * Tests the initial state of both spinners. Both should be set to 50.
- */
- @Test
- public void testInitialState() {
- assertTrue(selenium.isElementPresent(upperInput),
- "Upper input field is not present.");
- assertTrue(selenium.isElementPresent(upperUpArrow),
- "Upper arrow up is not present.");
- assertTrue(selenium.isElementPresent(upperDownArrow),
- "Upper arrow down is not present.");
- assertTrue(selenium.isElementPresent(lowerInput),
- "Lower input field is not present.");
- assertTrue(selenium.isElementPresent(lowerUpArrow),
- "Lower arrow up is not present.");
- assertTrue(selenium.isElementPresent(lowerDownArrow),
- "Lower arrow down is not present.");
+ private final String MSG_TYPE_TO_UPPER_FIRST_TYPED =
getMsg("TYPE_TO_UPPER_FIRST_TYPED");
+ private final int MSG_TYPE_TO_UPPER_FIRST_EXPECTED =
Integer.parseInt(getMsg("TYPE_TO_UPPER_FIRST_EXPECTED"));
+ private final String MSG_TYPE_TO_UPPER_SECOND_TYPED =
getMsg("TYPE_TO_UPPER_SECOND_TYPED");
+ private final int MSG_TYPE_TO_UPPER_SECOND_EXPECTED =
Integer.parseInt(getMsg("TYPE_TO_UPPER_SECOND_EXPECTED"));
+ private final String MSG_TYPE_TO_UPPER_THIRD_TYPED =
getMsg("TYPE_TO_UPPER_THIRD_TYPED");
+ private final int MSG_TYPE_TO_UPPER_THIRD_EXPECTED =
Integer.parseInt(getMsg("TYPE_TO_UPPER_THIRD_EXPECTED"));
+ private final String MSG_TYPE_TO_UPPER_FOURTH_TYPED =
getMsg("TYPE_TO_UPPER_FOURTH_TYPED");
+ private final double MSG_TYPE_TO_UPPER_FOURTH_EXPECTED = Double
+ .parseDouble(getMsg("TYPE_TO_UPPER_FOURTH_EXPECTED"));
+ private final String MSG_TYPE_TO_UPPER_FIFTH_TYPED =
getMsg("TYPE_TO_UPPER_FIFTH_TYPED");
+ private final double MSG_TYPE_TO_UPPER_FIFTH_EXPECTED =
Double.parseDouble(getMsg("TYPE_TO_UPPER_FIFTH_EXPECTED"));
- int number = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(number, 50, "Content of upper spinner.");
+ private final String MSG_TYPE_TO_LOWER_FIRST_TYPED =
getMsg("TYPE_TO_LOWER_FIRST_TYPED");
+ private final int MSG_TYPE_TO_LOWER_FIRST_EXPECTED =
Integer.parseInt(getMsg("TYPE_TO_LOWER_FIRST_EXPECTED"));
+ private final String MSG_TYPE_TO_LOWER_SECOND_TYPED =
getMsg("TYPE_TO_LOWER_SECOND_TYPED");
+ private final int MSG_TYPE_TO_LOWER_SECOND_EXPECTED =
Integer.parseInt(getMsg("TYPE_TO_LOWER_SECOND_EXPECTED"));
+ private final String MSG_TYPE_TO_LOWER_THIRD_TYPED =
getMsg("TYPE_TO_LOWER_THIRD_TYPED");
+ private final int MSG_TYPE_TO_LOWER_THIRD_EXPECTED =
Integer.parseInt(getMsg("TYPE_TO_LOWER_THIRD_EXPECTED"));
+ private final String MSG_TYPE_TO_LOWER_FOURTH_TYPED =
getMsg("TYPE_TO_LOWER_FOURTH_TYPED");
+ private final double MSG_TYPE_TO_LOWER_FOURTH_EXPECTED = Double
+ .parseDouble(getMsg("TYPE_TO_LOWER_FOURTH_EXPECTED"));
+ private final String MSG_TYPE_TO_LOWER_FIFTH_TYPED =
getMsg("TYPE_TO_LOWER_FIFTH_TYPED");
+ private final double MSG_TYPE_TO_LOWER_FIFTH_EXPECTED =
Double.parseDouble(getMsg("TYPE_TO_LOWER_FIFTH_EXPECTED"));
- number = Integer.parseInt(selenium.getValue(lowerInput));
- assertEquals(number, 50, "Content of lower spinner.");
- }
+ private final int MSG_OVERFLOW_UPPER =
Integer.parseInt(getMsg("OVERFLOW_UPPER"));
+ private final int MSG_OVERFLOW_LOWER =
Integer.parseInt(getMsg("OVERFLOW_LOWER"));
+ private final int MSG_UNDERFLOW_UPPER =
Integer.parseInt(getMsg("UNDERFLOW_UPPER"));
+ private final int MSG_UNDERFLOW_LOWER =
Integer.parseInt(getMsg("UNDERFLOW_LOWER"));
- /**
- * Tests clicking on the up arrow of the upper spinner.
- */
- @Test
- public void testUpperClickUp() {
- int oldValue = Integer.parseInt(selenium.getValue(upperInput));
+ /**
+ * Tests the initial state of both spinners. Both should be set to 50.
+ */
+ @Test
+ public void testInitialState() {
+ assertTrue(selenium.isElementPresent(LOC_UPPER_SPINNER_INPUT), "Upper input
field is not present.");
+ assertTrue(selenium.isElementPresent(LOC_UPPER_SPINNER_UP), "Upper arrow up
is not present.");
+ assertTrue(selenium.isElementPresent(LOC_UPPER_SPINNER_DOWN), "Upper arrow
down is not present.");
+ assertTrue(selenium.isElementPresent(LOC_LOWER_SPINNER_INPUT), "Lower input
field is not present.");
+ assertTrue(selenium.isElementPresent(LOC_LOWER_SPINNER_UP), "Lower arrow up
is not present.");
+ assertTrue(selenium.isElementPresent(LOC_LOWER_SPINNER_DOWN), "Lower arrow
down is not present.");
- selenium.clickAt(upperUpArrow, "0,0");
+ int number = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(number, MSG_INITIAL_STATE_UPPER, "Content of upper
spinner.");
- int newValue = Integer.parseInt(selenium.getValue(upperInput));
+ number = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(number, MSG_INITIAL_STATE_LOWER, "Content of lower
spinner.");
+ }
- assertEquals(newValue, oldValue + 1,
- "The value should increase by 1 after clicking on up arrow.");
- }
+ /**
+ * Tests clicking on the up arrow of the upper spinner.
+ */
+ @Test
+ public void testUpperClickUp() {
+ int oldValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
- /**
- * Tests clicking on the down arrow of the upper spinner.
- */
- @Test
- public void testUpperClickDown() {
- int oldValue = Integer.parseInt(selenium.getValue(upperInput));
+ selenium.clickAt(LOC_UPPER_SPINNER_UP, "0,0");
- selenium.clickAt(upperDownArrow, "0,0");
+ int newValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, oldValue + 1, "The value should increase by 1 after
clicking on up arrow.");
+ }
- int newValue = Integer.parseInt(selenium.getValue(upperInput));
+ /**
+ * Tests clicking on the down arrow of the upper spinner.
+ */
+ @Test
+ public void testUpperClickDown() {
+ int oldValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
- assertEquals(newValue, oldValue - 1,
- "The value should decrease by 1 after clicking on down arrow.");
+ selenium.clickAt(LOC_UPPER_SPINNER_DOWN, "0,0");
- }
+ int newValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, oldValue - 1, "The value should decrease by 1 after
clicking on down arrow.");
- /**
- * Tests clicking on the up arrow of the lower spinner.
- */
- @Test
- public void testLowerClickUp() {
- int oldValue = Integer.parseInt(selenium.getValue(lowerInput));
+ }
- selenium.clickAt(lowerUpArrow, "0,0");
+ /**
+ * Tests clicking on the up arrow of the lower spinner.
+ */
+ @Test
+ public void testLowerClickUp() {
+ int oldValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
- int newValue = Integer.parseInt(selenium.getValue(lowerInput));
+ selenium.clickAt(LOC_LOWER_SPINNER_UP, "0,0");
- assertEquals(newValue, oldValue + 10,
- "The value should increase by 10 after clicking on up arrow.");
- }
+ int newValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, oldValue + 10, "The value should increase by 10 after
clicking on up arrow.");
+ }
- /**
- * Tests clicking on the down arrow of the lower spinner.
- */
- @Test
- public void testLowerClickDown() {
- int oldValue = Integer.parseInt(selenium.getValue(lowerInput));
+ /**
+ * Tests clicking on the down arrow of the lower spinner.
+ */
+ @Test
+ public void testLowerClickDown() {
+ int oldValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
- selenium.clickAt(lowerDownArrow, "0,0");
+ selenium.clickAt(LOC_LOWER_SPINNER_DOWN, "0,0");
- int newValue = Integer.parseInt(selenium.getValue(lowerInput));
+ int newValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, oldValue - 10, "The value should decrease by 10 after
clicking on down arrow.");
+ }
- assertEquals(newValue, oldValue - 10,
- "The value should decrease by 10 after clicking on down arrow.");
- }
+ /**
+ * Tests typing into the upper spinner. In the beginning it tries valid
+ * value (20), then a value bigger than maximum (2000), a value lower than
+ * minimum (-23), a decimal value (34.5), and a string ("aaa").
+ */
+ @Test
+ public void testTypeToUpper() {
+ selenium.type(LOC_UPPER_SPINNER_INPUT, MSG_TYPE_TO_UPPER_FIRST_TYPED);
+ Number newValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_LOWER_FIRST_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.",
MSG_TYPE_TO_UPPER_FIRST_EXPECTED,
+ MSG_TYPE_TO_UPPER_FIRST_TYPED));
- /**
- * Tests typing into the upper spinner. In the beginning it tries valid
- * value (20), then a value bigger than maximum (2000), a value lower than
- * minimum (-23), a decimal value (34.5), and a string ("aaa").
- */
- @Test
- public void testTypeToUpper() {
- selenium.type(upperInput, "20");
- Number newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 20, "Value in the input field did not change.");
+ selenium.type(LOC_UPPER_SPINNER_INPUT, MSG_TYPE_TO_UPPER_SECOND_TYPED);
+ newValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_UPPER_SECOND_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.",
MSG_TYPE_TO_UPPER_SECOND_EXPECTED,
+ MSG_TYPE_TO_UPPER_SECOND_TYPED));
- selenium.type(upperInput, "2000");
- newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 100,
- "Input field should contain 100 after 2000 was typed.");
+ selenium.type(LOC_UPPER_SPINNER_INPUT, MSG_TYPE_TO_UPPER_THIRD_TYPED);
+ newValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_UPPER_THIRD_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.",
MSG_TYPE_TO_UPPER_THIRD_EXPECTED,
+ MSG_TYPE_TO_UPPER_THIRD_TYPED));
- selenium.type(upperInput, "-23");
- newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 0,
- "Input field should contain 0 after -23 was typed.");
+ selenium.type(LOC_UPPER_SPINNER_INPUT, MSG_TYPE_TO_UPPER_FOURTH_TYPED);
+ newValue = Double.parseDouble(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_UPPER_FOURTH_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.",
MSG_TYPE_TO_UPPER_FOURTH_EXPECTED,
+ MSG_TYPE_TO_UPPER_FOURTH_TYPED));
- selenium.type(upperInput, "34.5");
- newValue = Double.parseDouble(selenium.getValue(upperInput));
- assertEquals(newValue, 34.5,
- "Input field should contain 34.5 after 34.5 was typed.");
+ selenium.type(LOC_UPPER_SPINNER_INPUT, MSG_TYPE_TO_UPPER_FIFTH_TYPED);
+ newValue = Double.parseDouble(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_UPPER_FIFTH_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.",
MSG_TYPE_TO_UPPER_FIFTH_EXPECTED,
+ MSG_TYPE_TO_UPPER_FIFTH_TYPED));
+ }
- Number oldValue = Double.parseDouble(selenium.getValue(upperInput));
- selenium.type(upperInput, "aaa");
- newValue = Double.parseDouble(selenium.getValue(upperInput));
- assertEquals(newValue, oldValue, "Input field should contain "
- + oldValue + " after 'aaa' was typed.");
- }
+ /**
+ * Tests typing into the lower spinner. In the beginning it tries valid
+ * value (20), then a value bigger than maximum (2000), a value lower than
+ * minimum (-23), a decimal value (34.5), and a string ("aaa").
+ */
+ @Test
+ public void testTypeToLower() {
+ selenium.type(LOC_LOWER_SPINNER_INPUT, MSG_TYPE_TO_LOWER_FIRST_TYPED);
+ Number newValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_LOWER_FIRST_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.",
MSG_TYPE_TO_LOWER_FIRST_EXPECTED,
+ MSG_TYPE_TO_LOWER_FIRST_TYPED));
- /**
- * Tests typing into the lower spinner. In the beginning it tries valid
- * value (20), then a value bigger than maximum (2000), a value lower than
- * minimum (-23), a decimal value (34.5), and a string ("aaa").
- */
- @Test
- public void testTypeToLower() {
- selenium.type(upperInput, "20");
- Number newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 20, "Value in the input field did not change.");
+ selenium.type(LOC_LOWER_SPINNER_INPUT, MSG_TYPE_TO_LOWER_SECOND_TYPED);
+ newValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_LOWER_SECOND_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.",
MSG_TYPE_TO_LOWER_SECOND_EXPECTED,
+ MSG_TYPE_TO_LOWER_SECOND_TYPED));
- selenium.type(upperInput, "2000");
- newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 100,
- "Input field should contain 100 after 2000 was typed.");
+ selenium.type(LOC_LOWER_SPINNER_INPUT, MSG_TYPE_TO_LOWER_THIRD_TYPED);
+ newValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_LOWER_THIRD_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.",
MSG_TYPE_TO_LOWER_THIRD_EXPECTED,
+ MSG_TYPE_TO_LOWER_THIRD_TYPED));
- selenium.type(upperInput, "-23");
- newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 0,
- "Input field should contain 0 after -23 was typed.");
+ selenium.type(LOC_LOWER_SPINNER_INPUT, MSG_TYPE_TO_LOWER_FOURTH_TYPED);
+ newValue = Double.parseDouble(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_LOWER_FOURTH_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.",
MSG_TYPE_TO_LOWER_FOURTH_EXPECTED,
+ MSG_TYPE_TO_LOWER_FOURTH_TYPED));
- selenium.type(upperInput, "34.5");
- newValue = Double.parseDouble(selenium.getValue(upperInput));
- assertEquals(newValue, 34.5,
- "Input field should contain 34.5 after 34.5 was typed.");
+ selenium.type(LOC_LOWER_SPINNER_INPUT, MSG_TYPE_TO_LOWER_FIFTH_TYPED);
+ newValue = Double.parseDouble(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_LOWER_FIFTH_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.",
MSG_TYPE_TO_LOWER_FIFTH_EXPECTED,
+ MSG_TYPE_TO_LOWER_FIFTH_TYPED));
+ }
- Number oldValue = Double.parseDouble(selenium.getValue(upperInput));
- selenium.type(upperInput, "aaa");
- newValue = Double.parseDouble(selenium.getValue(upperInput));
- assertEquals(newValue, oldValue, "Input field should contain "
- + oldValue + " after 'aaa' was typed.");
- }
+ /**
+ * Tests value overflow. It clicks 51 times on the up button of the upper
+ * spinner and verifies that the value changed to 0. Then it clicks 6 times
+ * on the up button of the lower spinner and checks that the value changed
+ * to 0.
+ */
+ @Test
+ public void testOverflow() {
+ // it starts at 50, maximum is 100, increment 1, it will try to click 51
+ // times
+ for (int i = 0; i < 51; i++) {
+ selenium.clickAt(LOC_UPPER_SPINNER_UP, "0,0");
+ }
- /**
- * Tests value overflow. It clicks 51 times on the up button of the upper
- * spinner and verifies that the value changed to 0. Then it clicks 6 times
- * on the up button of the lower spinner and checks that the value changed
- * to 0.
- */
- @Test
- public void testOverflow() {
- // it starts at 50, maximum is 100, increment 1, it will try to click 51
- // times
- for (int i = 0; i < 51; i++) {
- selenium.clickAt(upperUpArrow, "0,0");
- }
+ int newValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_OVERFLOW_UPPER, format("The value should change
to {0} at overflow.",
+ MSG_OVERFLOW_UPPER));
- int newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 0, "The value should change to 0 at overflow.");
+ // it starts at 50, maximum is 100, increment 10, it will try to click 6
+ // times
+ for (int i = 0; i < 6; i++) {
+ selenium.clickAt(LOC_LOWER_SPINNER_UP, "0,0");
+ }
- // it starts at 50, maximum is 100, increment 10, it will try to click 6
- // times
- for (int i = 0; i < 6; i++) {
- selenium.clickAt(lowerUpArrow, "0,0");
- }
+ newValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_OVERFLOW_LOWER, format("The value should change
to {0} at overflow.",
+ MSG_OVERFLOW_LOWER));
+ }
- newValue = Integer.parseInt(selenium.getValue(lowerInput));
- assertEquals(newValue, 0, "The value should change to 0 at overflow.");
- }
+ /**
+ * Tests value underflow. It clicks 51 times on the down button of the lower
+ * spinner and verifies that the value changed to 100. Then it clicks 6
+ * times on the down button of the lower spinner and checks that the value
+ * changed to 100.
+ */
+ @Test
+ public void testUnderflow() {
+ // it starts at 50, minimum is 0, increment 1, it will try to click 51
+ // times
+ for (int i = 0; i < 51; i++) {
+ selenium.clickAt(LOC_UPPER_SPINNER_DOWN, "0,0");
+ }
- /**
- * Tests value underflow. It clicks 51 times on the down button of the lower
- * spinner and verifies that the value changed to 100. Then it clicks 6
- * times on the down button of the lower spinner and checks that the value
- * changed to 100.
- */
- @Test
- public void testUnderflow() {
- // it starts at 50, minimum is 0, increment 1, it will try to click 51
- // times
- for (int i = 0; i < 51; i++) {
- selenium.clickAt(upperDownArrow, "0,0");
- }
+ int newValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_UNDERFLOW_UPPER, format("The value should change
to {0} at underflow.",
+ MSG_UNDERFLOW_UPPER));
- int newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 100,
- "The value should change to 100 at underflow.");
+ // it starts at 50, minimum is 0, increment 10, it will try to click 6
+ // times
+ for (int i = 0; i < 6; i++) {
+ selenium.clickAt(LOC_LOWER_SPINNER_DOWN, "0,0");
+ }
- // it starts at 50, minimum is 0, increment 10, it will try to click 6
- // times
- for (int i = 0; i < 6; i++) {
- selenium.clickAt(lowerDownArrow, "0,0");
- }
+ newValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_UNDERFLOW_LOWER, format("The value should change
to {0} at underflow.",
+ MSG_UNDERFLOW_LOWER));
+ }
- newValue = Integer.parseInt(selenium.getValue(lowerInput));
- assertEquals(newValue, 100,
- "The value should change to 100 at underflow.");
- }
+ /**
+ * Tests the "View Source". It checks that the source code is not visible,
+ * clicks on the link, and checks 5 lines of source code.
+ */
+ @Test
+ public void testSpinnerSource() {
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<a4j:form ajaxSubmit=\"true\">", "Here is
an example of default inputNumberSpinner:",
+ "<rich:inputNumberSpinner value=\"50\"/>",
"<rich:inputNumberSpinner value=\"50\" step=\"10\"/>",
};
- /**
- * Tests the "View Source". It checks that the source code is not visible,
- * clicks on the link, and checks the first 2 components of source code,
- * i.e. that the source code begins with "<ui:composition".
- */
- @Test
- public void testSpinnerSource() {
- abstractTestSource(1, 1, "<", "ui:composition");
- }
+ abstractTestSource(1, "View Source", strings);
+ }
- /**
- * Loads the page containing the calendar component.
- */
- @BeforeMethod
- private void loadPage() {
- super.loadPage("richInputs", 9,
- "InputNumberSpinner is a highly customizable component");
- }
+ /**
+ * Loads the page containing the calendar component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Input Number Spinner");
+ scrollIntoView(LOC_EXAMPLE_HEADER, true);
+ }
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java 2009-09-08
14:43:30 UTC (rev 15494)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java 2009-09-08
14:54:18 UTC (rev 15495)
@@ -1,3 +1,21 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
package org.jboss.richfaces.integrationTest.suggestionBox;
import static org.testng.Assert.assertEquals;
@@ -14,403 +32,385 @@
*/
public class SuggestionBoxTestCase extends AbstractSeleniumRichfacesTestCase {
- // messages
- private final String MSG_COMPONENT_DESCRIPTION =
getMsg("COMPONENT_DESCRIPTION");
- private final String MSG_TABLE_M_N = getMsg("TABLE_M_N");
- private final String MSG_NO_CAPITALS_FOUND = getMsg("NO_CAPITALS_FOUND");
- private final String MSG_SUGGESTION_BOX_BORDER =
getMsg("SUGGESTION_BOX_BORDER");
- private final String MSG_SUGGESTION_BOX_WIDTH =
getMsg("SUGGESTION_BOX_WIDTH");
- private final String MSG_SUGGESTION_BOX_HEIGHT =
getMsg("SUGGESTION_BOX_HEIGHT");
- private final String MSG_SUGGESTION_BOX_SHADOW_DEPTH =
getMsg("SUGGESTION_BOX_SHADOW_DEPTH");
- private final String MSG_SUGGESTION_BOX_SHADOW_OPACITY =
getMsg("SUGGESTION_BOX_SHADOW_OPACITY");
- private final String MSG_SUGGESTION_BOX_CELLPADDING =
getMsg("SUGGESTION_BOX_CELLPADDING");
- private final String MSG_COUNT_OF_ALL_SUGGESTIONS =
getMsg("COUNT_OF_ALL_SUGGESTIONS");
- private final String MSG_AUGUSTA_MAINE = getMsg("AUGUSTA_MAINE");
- private final String MSG_AUGUSTA_MADISON_MAINE_WISCONSIN =
getMsg("AUGUSTA_MADISON_MAINE_WISCONSIN");
+ // messages
+ private final String MSG_TABLE_PREFORMATTED =
getMsg("TABLE_PREFORMATTED");
+ private final String MSG_PREFORMATTEDO_CAPITALS_FOUND =
getMsg("NO_CAPITALS_FOUND");
+ private final String MSG_SUGGESTION_BOX_BORDER_PREFORMATTED =
getMsg("SUGGESTION_BOX_BORDER_PREFORMATTED");
+ private final String MSG_SUGGESTION_BOX_WIDTH_PREFORMATTED =
getMsg("SUGGESTION_BOX_WIDTH_PREFORMATTED");
+ private final String MSG_SUGGESTION_BOX_HEIGHT_PREFORMATTED =
getMsg("SUGGESTION_BOX_HEIGHT_PREFORMATTED");
+ private final String MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED =
getMsg("SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED");
+ private final String MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED =
getMsg("SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED");
+ private final String MSG_SUGGESTION_BOX_CELLPADDING_PREFORMATTED =
getMsg("SUGGESTION_BOX_CELLPADDING_PREFORMATTED");
+ private final String MSG_COUNT_OF_ALL_SUGGESTIONS =
getMsg("COUNT_OF_ALL_SUGGESTIONS");
+ private final String MSG_AUGUSTA_MAINE = getMsg("AUGUSTA_MAINE");
+ private final String MSG_AUGUSTA_MADISON_MAINE_WISCONSIN =
getMsg("AUGUSTA_MADISON_MAINE_WISCONSIN");
- // locators
- private final String LOC_FIRST_SUGGESTION_BOX_N =
getLoc("FIRST_SUGGESTION_BOX_N");
- private final String LOC_FIRST_TOWN_TABLE_M_N =
getLoc("FIRST_TOWN_TABLE_M_N");
+ // locators
+ private final String LOC_FIRST_SUGGESTION_BOX_PREFORMATTED =
getLoc("FIRST_SUGGESTION_BOX_PREFORMATTED");
+ private final String LOC_FIRST_TOWN_TABLE_PREFORMATTED =
getLoc("FIRST_TOWN_TABLE_PREFORMATTED");
- private final String LOC_FIRST_INPUT = getLoc("FIRST_INPUT");
- private final String LOC_FIRST_BORDER_INPUT = getLoc("FIRST_BORDER_INPUT");
- private final String LOC_FIRST_WIDTH_INPUT = getLoc("FIRST_WIDTH_INPUT");
- private final String LOC_FIRST_HEIGHT_INPUT = getLoc("FIRST_HEIGHT_INPUT");
- private final String LOC_FIRST_SHADOW_DEPTH_INPUT =
getLoc("FIRST_SHADOW_DEPTH_INPUT");
- private final String LOC_FIRST_SHADOW_OPACITY_INPUT =
getLoc("FIRST_SHADOW_OPACITY_INPUT");
- private final String LOC_FIRST_CELLPADDING_INPUT =
getLoc("FIRST_CELLPADDING_INPUT");
+ private final String LOC_FIRST_INPUT = getLoc("FIRST_INPUT");
+ private final String LOC_FIRST_BORDER_INPUT =
getLoc("FIRST_BORDER_INPUT");
+ private final String LOC_FIRST_WIDTH_INPUT = getLoc("FIRST_WIDTH_INPUT");
+ private final String LOC_FIRST_HEIGHT_INPUT =
getLoc("FIRST_HEIGHT_INPUT");
+ private final String LOC_FIRST_SHADOW_DEPTH_INPUT =
getLoc("FIRST_SHADOW_DEPTH_INPUT");
+ private final String LOC_FIRST_SHADOW_OPACITY_INPUT =
getLoc("FIRST_SHADOW_OPACITY_INPUT");
+ private final String LOC_FIRST_CELLPADDING_INPUT =
getLoc("FIRST_CELLPADDING_INPUT");
- private final String LOC_FIRST_BORDER_STYLE = getLoc("FIRST_BORDER_STYLE");
- private final String LOC_FIRST_WIDTH_STYLE = getLoc("FIRST_WIDTH_STYLE");
- private final String LOC_FIRST_HEIGHT_STYLE = getLoc("FIRST_HEIGHT_STYLE");
- private final String LOC_FIRST_SHADOW_DEPTH_STYLE =
getLoc("FIRST_SHADOW_DEPTH_STYLE");
- private final String LOC_FIRST_SHADOW_OPACITY_STYLE =
getLoc("FIRST_SHADOW_OPACITY_STYLE");
- private final String LOC_FIRST_CELLPADDING = getLoc("FIRST_CELLPADDING");
+ private final String LOC_FIRST_BORDER_STYLE =
getLoc("FIRST_BORDER_STYLE");
+ private final String LOC_FIRST_WIDTH_STYLE = getLoc("FIRST_WIDTH_STYLE");
+ private final String LOC_FIRST_HEIGHT_STYLE =
getLoc("FIRST_HEIGHT_STYLE");
+ private final String LOC_FIRST_SHADOW_DEPTH_STYLE =
getLoc("FIRST_SHADOW_DEPTH_STYLE");
+ private final String LOC_FIRST_SHADOW_OPACITY_STYLE =
getLoc("FIRST_SHADOW_OPACITY_STYLE");
+ private final String LOC_FIRST_CELLPADDING = getLoc("FIRST_CELLPADDING");
- private final String LOC_SECOND_INPUT = getLoc("SECOND_INPUT");
- private final String LOC_SECOND_BUTTON = getLoc("SECOND_BUTTON");
- private final String LOC_SECOND_SUGGESTION_LINES =
getLoc("SECOND_SUGGESTION_LINES");
- private final String LOC_SECOND_SUGGESTION_BOX_N =
getLoc("SECOND_SUGGESTION_BOX_N");
- private final String LOC_SECOND_STATE = getLoc("SECOND_STATE");
+ private final String LOC_SECOND_INPUT = getLoc("SECOND_INPUT");
+ private final String LOC_SECOND_BUTTON = getLoc("SECOND_BUTTON");
+ private final String LOC_SECOND_SUGGESTION_LINES =
getLoc("SECOND_SUGGESTION_LINES");
+ private final String LOC_SECOND_SUGGESTION_BOX_PREFORMATTED =
getLoc("SECOND_SUGGESTION_BOX_PREFORMATTED");
+ private final String LOC_SECOND_STATE = getLoc("SECOND_STATE");
- /**
- * Tests inputting two cities separated by a comma. First it chooses Atlanta and
Madison. Then
- * it checks all items in the table on the right.
- */
- @Test
- public void testCommaSeparatedTowns() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ /**
+ * Tests inputting two cities separated by a comma. First it chooses Atlanta
+ * and Madison. Then it checks all items in the table on the right.
+ */
+ @Test
+ public void testCommaSeparatedTowns() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- // select Atlanta
- selenium.typeKeys(LOC_FIRST_INPUT, "at");
- waitForElement(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1));
+ // select Atlanta
+ selenium.typeKeys(LOC_FIRST_INPUT, "at");
+ waitForElement(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1));
- selenium.click(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1));
+ selenium.click(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1));
- // select Madison
- selenium.typeKeys(LOC_FIRST_INPUT, ",ma");
-
- waitForTextEquals(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1),
- "MadisonWisconsin");
- selenium.click(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1));
+ // select Madison
+ selenium.typeKeys(LOC_FIRST_INPUT, ",ma");
- String text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N,
- 1, 1));
- assertEquals(text, "Georgia", String.format(MSG_TABLE_M_N, 1, 1));
+ waitForTextEquals(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1),
"MadisonWisconsin");
+ selenium.click(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 1, 2));
- assertEquals(text, "Atlanta", String.format(MSG_TABLE_M_N, 1, 2));
+ String text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 1));
+ assertEquals(text, "Georgia", format(MSG_TABLE_PREFORMATTED, 1, 1));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 1, 3));
- assertEquals(text, "Augusta", String.format(MSG_TABLE_M_N, 1, 3));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 2));
+ assertEquals(text, "Atlanta", format(MSG_TABLE_PREFORMATTED, 1, 2));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 1, 4));
- assertEquals(text, "Columbus", String.format(MSG_TABLE_M_N, 1, 4));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 3));
+ assertEquals(text, "Augusta", format(MSG_TABLE_PREFORMATTED, 1, 3));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 1));
- assertEquals(text, "Wisconsin", String.format(MSG_TABLE_M_N, 2, 1));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 4));
+ assertEquals(text, "Columbus", format(MSG_TABLE_PREFORMATTED, 1, 4));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 2));
- assertEquals(text, "Milwaukee", String.format(MSG_TABLE_M_N, 2, 2));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 1));
+ assertEquals(text, "Wisconsin", format(MSG_TABLE_PREFORMATTED, 2, 1));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 3));
- assertEquals(text, "Madison", String.format(MSG_TABLE_M_N, 2, 3));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 2));
+ assertEquals(text, "Milwaukee", format(MSG_TABLE_PREFORMATTED, 2, 2));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 4));
- assertEquals(text, "Green Bay", String.format(MSG_TABLE_M_N, 2, 4));
- }
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 3));
+ assertEquals(text, "Madison", format(MSG_TABLE_PREFORMATTED, 2, 3));
- /**
- * Tests inputting two cities separated by square brackets. First it chooses Atlanta and
Madison. Then
- * it checks all items in the table on the right.
- */
- @Test
- public void testSquareBracketsSeparatedTowns() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 4));
+ assertEquals(text, "Green Bay", format(MSG_TABLE_PREFORMATTED, 2, 4));
+ }
- // select Atlanta
- selenium.typeKeys(LOC_FIRST_INPUT, "[at");
- waitForElement(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1));
+ /**
+ * Tests inputting two cities separated by square brackets. First it chooses
+ * Atlanta and Madison. Then it checks all items in the table on the right.
+ */
+ @Test
+ public void testSquareBracketsSeparatedTowns() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.click(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1));
- selenium.typeKeys(LOC_FIRST_INPUT, "]");
+ // select Atlanta
+ selenium.typeKeys(LOC_FIRST_INPUT, "[at");
+ waitForElement(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1));
- // select Madison
- selenium.typeKeys(LOC_FIRST_INPUT, "[ma");
- waitForTextEquals(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1),
- "MadisonWisconsin");
- selenium.click(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1));
- selenium.typeKeys(LOC_FIRST_INPUT, "]");
-
- String text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N,
- 1, 1));
- assertEquals(text, "Georgia", String.format(MSG_TABLE_M_N, 1, 1));
+ selenium.click(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1));
+ selenium.typeKeys(LOC_FIRST_INPUT, "]");
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 1, 2));
- assertEquals(text, "Atlanta", String.format(MSG_TABLE_M_N, 1, 2));
+ // select Madison
+ selenium.typeKeys(LOC_FIRST_INPUT, "[ma");
+ waitForTextEquals(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1),
"MadisonWisconsin");
+ selenium.click(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1));
+ selenium.typeKeys(LOC_FIRST_INPUT, "]");
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 1, 3));
- assertEquals(text, "Augusta", String.format(MSG_TABLE_M_N, 1, 3));
+ String text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 1));
+ assertEquals(text, "Georgia", format(MSG_TABLE_PREFORMATTED, 1, 1));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 1, 4));
- assertEquals(text, "Columbus", String.format(MSG_TABLE_M_N, 1, 4));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 2));
+ assertEquals(text, "Atlanta", format(MSG_TABLE_PREFORMATTED, 1, 2));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 1));
- assertEquals(text, "Wisconsin", String.format(MSG_TABLE_M_N, 2, 1));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 3));
+ assertEquals(text, "Augusta", format(MSG_TABLE_PREFORMATTED, 1, 3));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 2));
- assertEquals(text, "Milwaukee", String.format(MSG_TABLE_M_N, 2, 2));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 4));
+ assertEquals(text, "Columbus", format(MSG_TABLE_PREFORMATTED, 1, 4));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 3));
- assertEquals(text, "Madison", String.format(MSG_TABLE_M_N, 2, 3));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 1));
+ assertEquals(text, "Wisconsin", format(MSG_TABLE_PREFORMATTED, 2, 1));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 4));
- assertEquals(text, "Green Bay", String.format(MSG_TABLE_M_N, 2, 4));
- }
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 2));
+ assertEquals(text, "Milwaukee", format(MSG_TABLE_PREFORMATTED, 2, 2));
- /**
- * Tests typing in a non-existing city ('aaa'). It checks that the string
"No capitals found" is shown.
- */
- @Test
- public void testNonExisting() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 3));
+ assertEquals(text, "Madison", format(MSG_TABLE_PREFORMATTED, 2, 3));
- // select aaa
- selenium.typeKeys(LOC_FIRST_INPUT, "aaa");
-
- waitForElement(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 4));
+ assertEquals(text, "Green Bay", format(MSG_TABLE_PREFORMATTED, 2, 4));
+ }
- String text = selenium.getText(String.format(
- LOC_FIRST_SUGGESTION_BOX_N, 1));
+ /**
+ * Tests typing in a non-existing city ('aaa'). It checks that the string
+ * "No capitals found" is shown.
+ */
+ @Test
+ public void testNonExisting() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- assertEquals(text, "No capitals found", MSG_NO_CAPITALS_FOUND);
- }
+ // select aaa
+ selenium.typeKeys(LOC_FIRST_INPUT, "aaa");
- /**
- * Tests the "Border" slider. It tests values 3, 5, and 7.
- */
- @Test
- public void testBorder() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ waitForElement(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1));
+ String text = selenium.getText(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED,
1));
+ assertEquals(text, "No capitals found",
MSG_PREFORMATTEDO_CAPITALS_FOUND);
+ }
- selenium.type(LOC_FIRST_BORDER_INPUT, "3");
- waitFor(1500);
- int width = getValue(LOC_FIRST_BORDER_STYLE, "border-width");
- assertEquals(width, 3, String.format(MSG_SUGGESTION_BOX_BORDER, 3));
+ /**
+ * Tests the "Border" slider. It tests values 3, 5, and 7.
+ */
+ @Test
+ public void testBorder() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_BORDER_INPUT, "5");
- waitFor(1500);
- width = getValue(LOC_FIRST_BORDER_STYLE, "border-width");
- assertEquals(width, 5, String.format(MSG_SUGGESTION_BOX_BORDER, 5));
+ selenium.type(LOC_FIRST_BORDER_INPUT, "3");
+ waitFor(1500);
+ int width = getValue(LOC_FIRST_BORDER_STYLE, "border-width");
+ assertEquals(width, 3, format(MSG_SUGGESTION_BOX_BORDER_PREFORMATTED, 3));
- selenium.type(LOC_FIRST_BORDER_INPUT, "7"); // 7 -> 5
- waitFor(1500);
- width = getValue(LOC_FIRST_BORDER_STYLE, "border-width");
- assertEquals(width, 5, String.format(MSG_SUGGESTION_BOX_BORDER, 7));
- }
+ selenium.type(LOC_FIRST_BORDER_INPUT, "5");
+ waitFor(1500);
+ width = getValue(LOC_FIRST_BORDER_STYLE, "border-width");
+ assertEquals(width, 5, format(MSG_SUGGESTION_BOX_BORDER_PREFORMATTED, 5));
- /**
- * Tests the "Width" slider. It tests values 150, 350, 400, and 176.
- */
- @Test
- public void testWidth() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ selenium.type(LOC_FIRST_BORDER_INPUT, "7"); // 7 -> 5
+ waitFor(1500);
+ width = getValue(LOC_FIRST_BORDER_STYLE, "border-width");
+ assertEquals(width, 5, format(MSG_SUGGESTION_BOX_BORDER_PREFORMATTED, 7));
+ }
- selenium.type(LOC_FIRST_WIDTH_INPUT, "150");
- waitFor(1500);
- int width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
- assertEquals(width, 150, String.format(MSG_SUGGESTION_BOX_WIDTH, 150));
+ /**
+ * Tests the "Width" slider. It tests values 150, 350, 400, and 176.
+ */
+ @Test
+ public void testWidth() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_WIDTH_INPUT, "350");
- waitFor(1500);
- width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
- assertEquals(width, 350, String.format(MSG_SUGGESTION_BOX_WIDTH, 350));
+ selenium.type(LOC_FIRST_WIDTH_INPUT, "150");
+ waitFor(1500);
+ int width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
+ assertEquals(width, 150, format(MSG_SUGGESTION_BOX_WIDTH_PREFORMATTED, 150));
- selenium.type(LOC_FIRST_WIDTH_INPUT, "400"); // 400 -> 350
- waitFor(1500);
- width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
- assertEquals(width, 350, String.format(MSG_SUGGESTION_BOX_WIDTH, 400));
+ selenium.type(LOC_FIRST_WIDTH_INPUT, "350");
+ waitFor(1500);
+ width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
+ assertEquals(width, 350, format(MSG_SUGGESTION_BOX_WIDTH_PREFORMATTED, 350));
- selenium.type(LOC_FIRST_WIDTH_INPUT, "176"); // 176 -> 200
- waitFor(1500);
- width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
- assertEquals(width, 200, String.format(MSG_SUGGESTION_BOX_WIDTH, 176));
- }
+ selenium.type(LOC_FIRST_WIDTH_INPUT, "400"); // 400 -> 350
+ waitFor(1500);
+ width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
+ assertEquals(width, 350, format(MSG_SUGGESTION_BOX_WIDTH_PREFORMATTED, 400));
- /**
- * Tests the "Height" slider. It tests values 100, 300, 400, and 176.
- */
- @Test
- public void testHeight() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ selenium.type(LOC_FIRST_WIDTH_INPUT, "176"); // 176 -> 200
+ waitFor(1500);
+ width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
+ assertEquals(width, 200, format(MSG_SUGGESTION_BOX_WIDTH_PREFORMATTED, 176));
+ }
- selenium.type(LOC_FIRST_HEIGHT_INPUT, "100");
- waitFor(1500);
- int height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
- assertEquals(height, 100, String.format(MSG_SUGGESTION_BOX_HEIGHT, 100));
+ /**
+ * Tests the "Height" slider. It tests values 100, 300, 400, and 176.
+ */
+ @Test
+ public void testHeight() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_HEIGHT_INPUT, "300");
- waitFor(1500);
- height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
- assertEquals(height, 300, String.format(MSG_SUGGESTION_BOX_HEIGHT, 300));
+ selenium.type(LOC_FIRST_HEIGHT_INPUT, "100");
+ waitFor(1500);
+ int height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
+ assertEquals(height, 100, format(MSG_SUGGESTION_BOX_HEIGHT_PREFORMATTED, 100));
- selenium.type(LOC_FIRST_HEIGHT_INPUT, "400"); // 400 -> 300
- waitFor(1500);
- height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
- assertEquals(height, 300, String.format(MSG_SUGGESTION_BOX_HEIGHT, 400));
+ selenium.type(LOC_FIRST_HEIGHT_INPUT, "300");
+ waitFor(1500);
+ height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
+ assertEquals(height, 300, format(MSG_SUGGESTION_BOX_HEIGHT_PREFORMATTED, 300));
- selenium.type(LOC_FIRST_HEIGHT_INPUT, "176"); // 176 -> 200
- waitFor(1500);
- height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
- assertEquals(height, 200, String.format(MSG_SUGGESTION_BOX_HEIGHT, 176));
- }
+ selenium.type(LOC_FIRST_HEIGHT_INPUT, "400"); // 400 -> 300
+ waitFor(1500);
+ height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
+ assertEquals(height, 300, format(MSG_SUGGESTION_BOX_HEIGHT_PREFORMATTED, 400));
- /**
- * Tests the "Shadow Depth" slider. It tests values 3, 5, 6, and 7. It test
both top and left offset.
- */
- @Test
- public void testShadowDepth() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ selenium.type(LOC_FIRST_HEIGHT_INPUT, "176"); // 176 -> 200
+ waitFor(1500);
+ height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
+ assertEquals(height, 200, format(MSG_SUGGESTION_BOX_HEIGHT_PREFORMATTED, 176));
+ }
- selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "3");
- waitFor(1500);
- int top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
- assertEquals(top, 3, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 3));
- int left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
- assertEquals(left, 3, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 3));
+ /**
+ * Tests the "Shadow Depth" slider. It tests values 3, 5, 6, and 7. It
test
+ * both top and left offset.
+ */
+ @Test
+ public void testShadowDepth() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "5");
- waitFor(1500);
- top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
- assertEquals(top, 5, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 5));
- left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
- assertEquals(left, 5, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 5));
+ selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "3");
+ waitFor(1500);
+ int top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
+ assertEquals(top, 3, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 3));
+ int left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
+ assertEquals(left, 3, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 3));
- selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "6");
- waitFor(1500);
- top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
- assertEquals(top, 6, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 6));
- left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
- assertEquals(left, 6, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 6));
+ selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "5");
+ waitFor(1500);
+ top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
+ assertEquals(top, 5, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 5));
+ left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
+ assertEquals(left, 5, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 5));
- selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "7"); // 7 -> 6
- waitFor(1500);
- top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
- assertEquals(top, 6, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 7));
- left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
- assertEquals(left, 6, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 7));
- }
+ selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "6");
+ waitFor(1500);
+ top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
+ assertEquals(top, 6, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 6));
+ left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
+ assertEquals(left, 6, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 6));
- /**
- * Tests the "Shadow Opacity" slider. It tests values 1, 5, 9, and 11.
- */
- @Test
- public void testShadowOpacity() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "7"); // 7 -> 6
+ waitFor(1500);
+ top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
+ assertEquals(top, 6, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 7));
+ left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
+ assertEquals(left, 6, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 7));
+ }
- selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "1");
- waitFor(1500);
- double opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
- assertEquals(opacity, 0.1, String.format(
- MSG_SUGGESTION_BOX_SHADOW_OPACITY, 1));
+ /**
+ * Tests the "Shadow Opacity" slider. It tests values 1, 5, 9, and 11.
+ */
+ @Test
+ public void testShadowOpacity() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "5");
- waitFor(1500);
- opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
- assertEquals(opacity, 0.5, String.format(
- MSG_SUGGESTION_BOX_SHADOW_OPACITY, 5));
+ selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "1");
+ waitFor(1500);
+ double opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
+ assertEquals(opacity, 0.1, format(MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED,
1));
- selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "9");
- waitFor(1500);
- opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
- assertEquals(opacity, 0.9, String.format(
- MSG_SUGGESTION_BOX_SHADOW_OPACITY, 9));
+ selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "5");
+ waitFor(1500);
+ opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
+ assertEquals(opacity, 0.5, format(MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED,
5));
- selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "11"); // 11 -> 9
- waitFor(1500);
- opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
- assertEquals(opacity, 0.9, String.format(
- MSG_SUGGESTION_BOX_SHADOW_OPACITY, 11));
- }
+ selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "9");
+ waitFor(1500);
+ opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
+ assertEquals(opacity, 0.9, format(MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED,
9));
- /**
- * Tests the "Cellpadding" slider. It tests values 1, 10, 20, and 25.
- */
- @Test
- public void testCellpadding() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "11"); // 11 -> 9
+ waitFor(1500);
+ opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
+ assertEquals(opacity, 0.9, format(MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED,
11));
+ }
- selenium.type(LOC_FIRST_CELLPADDING_INPUT, "1");
- waitFor(1500);
- int cellpadding = Integer.parseInt(selenium
- .getAttribute(LOC_FIRST_CELLPADDING));
- assertEquals(cellpadding, 1, String.format(
- MSG_SUGGESTION_BOX_CELLPADDING, 1));
+ /**
+ * Tests the "Cellpadding" slider. It tests values 1, 10, 20, and 25.
+ */
+ @Test
+ public void testCellpadding() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_CELLPADDING_INPUT, "10");
- waitFor(1500);
- cellpadding = Integer.parseInt(selenium
- .getAttribute(LOC_FIRST_CELLPADDING));
- assertEquals(cellpadding, 10, String.format(
- MSG_SUGGESTION_BOX_CELLPADDING, 10));
+ selenium.type(LOC_FIRST_CELLPADDING_INPUT, "1");
+ waitFor(1500);
+ int cellpadding =
Integer.parseInt(selenium.getAttribute(LOC_FIRST_CELLPADDING));
+ assertEquals(cellpadding, 1, format(MSG_SUGGESTION_BOX_CELLPADDING_PREFORMATTED,
1));
- selenium.type(LOC_FIRST_CELLPADDING_INPUT, "20");
- waitFor(1500);
- cellpadding = Integer.parseInt(selenium
- .getAttribute(LOC_FIRST_CELLPADDING));
- assertEquals(cellpadding, 20, String.format(
- MSG_SUGGESTION_BOX_CELLPADDING, 20));
+ selenium.type(LOC_FIRST_CELLPADDING_INPUT, "10");
+ waitFor(1500);
+ cellpadding = Integer.parseInt(selenium.getAttribute(LOC_FIRST_CELLPADDING));
+ assertEquals(cellpadding, 10, format(MSG_SUGGESTION_BOX_CELLPADDING_PREFORMATTED,
10));
- selenium.type(LOC_FIRST_CELLPADDING_INPUT, "25"); // 25 -> 20
- waitFor(1500);
- cellpadding = Integer.parseInt(selenium
- .getAttribute(LOC_FIRST_CELLPADDING));
- assertEquals(cellpadding, 20, String.format(
- MSG_SUGGESTION_BOX_CELLPADDING, 25));
- }
+ selenium.type(LOC_FIRST_CELLPADDING_INPUT, "20");
+ waitFor(1500);
+ cellpadding = Integer.parseInt(selenium.getAttribute(LOC_FIRST_CELLPADDING));
+ assertEquals(cellpadding, 20, format(MSG_SUGGESTION_BOX_CELLPADDING_PREFORMATTED,
20));
- /**
- * Tests the button with arrow in the second example. It checks that there are 50
suggestions.
- */
- @Test
- void testSecondExampleButton() {
- scrollIntoView(LOC_SECOND_INPUT, true);
+ selenium.type(LOC_FIRST_CELLPADDING_INPUT, "25"); // 25 -> 20
+ waitFor(1500);
+ cellpadding = Integer.parseInt(selenium.getAttribute(LOC_FIRST_CELLPADDING));
+ assertEquals(cellpadding, 20, format(MSG_SUGGESTION_BOX_CELLPADDING_PREFORMATTED,
25));
+ }
- selenium.click(LOC_SECOND_BUTTON);
- waitForElement(LOC_SECOND_SUGGESTION_LINES);
+ /**
+ * Tests the button with arrow in the second example. It checks that there
+ * are 50 suggestions.
+ */
+ @Test
+ void testSecondExampleButton() {
+ scrollIntoView(LOC_SECOND_INPUT, true);
- int count = selenium.getXpathCount(LOC_SECOND_SUGGESTION_LINES)
- .intValue();
- assertEquals(count, 50, MSG_COUNT_OF_ALL_SUGGESTIONS);
- }
+ selenium.click(LOC_SECOND_BUTTON);
+ waitForElement(LOC_SECOND_SUGGESTION_LINES);
- /**
- * Tests inputting one city in the second example. It presses 'a' and clicks on
the second suggestion.
- */
- @Test
- public void testSecondExampleOneCity() {
- scrollIntoView(LOC_SECOND_INPUT, true);
+ int count = selenium.getXpathCount(LOC_SECOND_SUGGESTION_LINES).intValue();
+ assertEquals(count, 50, MSG_COUNT_OF_ALL_SUGGESTIONS);
+ }
- selenium.typeKeys(LOC_SECOND_INPUT, "a");
- waitForElement(String.format(LOC_SECOND_SUGGESTION_BOX_N, 2));
- selenium.click(String.format(LOC_SECOND_SUGGESTION_BOX_N, 2)); // Augusta
+ /**
+ * Tests inputting one city in the second example. It presses 'a' and clicks
+ * on the second suggestion.
+ */
+ @Test
+ public void testSecondExampleOneCity() {
+ scrollIntoView(LOC_SECOND_INPUT, true);
- String state = selenium.getText(LOC_SECOND_STATE);
- assertEquals(state, "Maine", MSG_AUGUSTA_MAINE);
- }
+ selenium.typeKeys(LOC_SECOND_INPUT, "a");
+ waitForElement(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 2));
+ selenium.click(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 2)); // Augusta
- /**
- * Tests inputting two cities separated by a comma in the second example. It presses
'a', clicks
- * on the second suggestion, presses ',' and 'm' and clicks on the third
suggestion (Augusta and Madison).
- * Then it checks that states belonging to these cities are shown below the combo box.
- */
- @Test
- public void testSecondExampleMoreCities() {
- scrollIntoView(LOC_SECOND_INPUT, true);
-
- selenium.typeKeys(LOC_SECOND_INPUT, "a");
- waitForElement(String.format(LOC_SECOND_SUGGESTION_BOX_N, 2));
- selenium.click(String.format(LOC_SECOND_SUGGESTION_BOX_N, 2)); // Augusta
+ String state = selenium.getText(LOC_SECOND_STATE);
+ assertEquals(state, "Maine", MSG_AUGUSTA_MAINE);
+ }
- selenium.typeKeys(LOC_SECOND_INPUT, ",m");
- waitForTextEquals(String.format(LOC_SECOND_SUGGESTION_BOX_N, 3),
- "Madison");
- selenium.click(String.format(LOC_SECOND_SUGGESTION_BOX_N, 3)); // Madison
+ /**
+ * Tests inputting two cities separated by a comma in the second example. It
+ * presses 'a', clicks on the second suggestion, presses ',' and
'm' and
+ * clicks on the third suggestion (Augusta and Madison). Then it checks that
+ * states belonging to these cities are shown below the combo box.
+ */
+ @Test
+ public void testSecondExampleMoreCities() {
+ scrollIntoView(LOC_SECOND_INPUT, true);
- waitFor(700);
- String state = selenium.getText(LOC_SECOND_STATE);
- assertEquals(state, "Maine,Wisconsin",
- MSG_AUGUSTA_MADISON_MAINE_WISCONSIN);
- }
+ selenium.typeKeys(LOC_SECOND_INPUT, "a");
+ waitForElement(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 2));
+ selenium.click(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 2)); // Augusta
- /**
- * Tests the "View Page Source" in the first example. It checks that the
source
- * code is not visible, clicks on the link, and checks 10 lines of source
- * code.
+ selenium.typeKeys(LOC_SECOND_INPUT, ",m");
+ waitForTextEquals(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 3),
"Madison");
+ selenium.click(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 3)); // Madison
+
+ waitFor(700);
+ String state = selenium.getText(LOC_SECOND_STATE);
+ assertEquals(state, "Maine,Wisconsin",
MSG_AUGUSTA_MADISON_MAINE_WISCONSIN);
+ }
+
+ /**
+ * Tests the "View Page Source" in the first example. It checks that the
+ * source code is not visible, clicks on the link, and checks 10 lines of
+ * source code.
*/
@Test
public void testFirstExamplePageSource() {
- String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
"<script
type=\"text/javascript\">//<![CDATA[",
"\"<tr><td>State</td><td>1st
City</td><td>2nd City</td><td>3rd
City</td></tr>\" +",
"vertical-align: top;",
@@ -418,30 +418,27 @@
"<rich:suggestionbox id=\"suggestionBoxId\"
for=\"text\" tokens=\",[]\"",
" rules=\"#{suggestionBox.rules}\"",
"suggestionAction=\"#{capitalsBean.autocomplete}\"
var=\"result\"",
- "height=\"#{suggestionBox.height}\"",
- "nothingLabel=\"No capitals found\"
columnClasses=\"center\"",
- };
+ "height=\"#{suggestionBox.height}\"",
"nothingLabel=\"No capitals found\"
columnClasses=\"center\"", };
abstractTestSource(1, "View Page Source", strings);
}
/**
- * Tests the "View CapitalsBean.java Source" in the first example. It
checks that the source
- * code is not visible, clicks on the link, and checks 8 lines of source
- * code.
+ * Tests the "View CapitalsBean.java Source" in the first example. It
checks
+ * that the source code is not visible, clicks on the link, and checks 8
+ * lines of source code.
*/
@Test
public void testFirstExampleBeanSource() {
- String[] strings = new String[] {
- "package org.richfaces.demo.capitals;",
- "import javax.faces.FacesException;",
- "public class CapitalsBean {",
- "public List<Capital> autocomplete(Object suggest) {",
- "if ((elem.getName() != null &&
elem.getName().toLowerCase().indexOf(pref.toLowerCase()) == 0) ||
\"\".equals(pref))",
- "URL rulesUrl =
getClass().getResource(\"capitals-rules.xml\");",
-
"digester.parse(getClass().getResourceAsStream(\"capitals.xml\"));",
- "public ArrayList<Capital> getCapitals() {",
- };
+ String[] strings = new String[] {
+ "package org.richfaces.demo.capitals;",
+ "import javax.faces.FacesException;",
+ "public class CapitalsBean {",
+ "public List<Capital> autocomplete(Object suggest) {",
+ "if ((elem.getName() != null &&
elem.getName().toLowerCase().indexOf(pref.toLowerCase()) == 0) ||
\"\".equals(pref))",
+ "URL rulesUrl =
getClass().getResource(\"capitals-rules.xml\");",
+
"digester.parse(getClass().getResourceAsStream(\"capitals.xml\"));",
+ "public ArrayList<Capital> getCapitals() {", };
abstractTestSource(1, "View CapitalsBean.java Source", strings);
}
@@ -453,7 +450,7 @@
*/
@Test
public void testSecondExamplePageSource() {
- String[] strings = new String[] {
+ String[] strings = new String[] {
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">",
"<h:form id=\"form\">",
"<h:panelGrid columns=\"2\">",
@@ -461,42 +458,49 @@
"usingSuggestObjects=\"true\"",
"onobjectchange=\"printObjectsSelected(#{rich:element('objects')},
#{rich:component('suggestion')});\"",
"suggestionAction=\"#{capitalsBean.autocomplete}\"
var=\"cap\"",
- "for=\"statesinput\" fetchValue=\"#{cap.name}\"
id=\"suggestion\" tokens=\",\">",
- };
+ "for=\"statesinput\" fetchValue=\"#{cap.name}\"
id=\"suggestion\" tokens=\",\">", };
abstractTestSource(2, "View Source", strings);
}
-
- /**
- * Pulls out the value of the specified attribute from the specified location.
- * @param loc an attribute locator
- * @param attr an 'subattribute' whose value we want (e.g. <div
style="left: 4px;"/>, then loc=//div@style and attr=left
- * @return the value of the subattribute
- */
- private int getValue(String loc, String attr) {
- String tmp = selenium.getAttribute(loc);
- int firstIdx = tmp.indexOf(attr) + 2 + attr.length();
- int secondIdx = tmp.indexOf("px;", firstIdx);
- return Integer.parseInt(tmp.substring(firstIdx, secondIdx));
- }
- /**
- * Pulls out opacity from the specified attribute.
- * @param loc an attribute locator
- * @return the value of opacity
- */
- private double getOpacity(String loc) {
- String tmp = selenium.getAttribute(loc);
- int firstIdx = tmp.indexOf("opacity") + 9;
- int secondIdx = tmp.indexOf(";", firstIdx);
- return Double.parseDouble(tmp.substring(firstIdx, secondIdx));
- }
+ /**
+ * Pulls out the value of the specified attribute from the specified
+ * location.
+ *
+ * @param loc
+ * an attribute locator
+ * @param attr
+ * an 'subattribute' whose value we want (e.g. <div
+ * style="left: 4px;"/>, then loc=//div@style and attr=left
+ * @return the value of the subattribute
+ */
+ private int getValue(String loc, String attr) {
+ String tmp = selenium.getAttribute(loc);
+ int firstIdx = tmp.indexOf(attr) + 2 + attr.length();
+ int secondIdx = tmp.indexOf("px;", firstIdx);
+ return Integer.parseInt(tmp.substring(firstIdx, secondIdx));
+ }
- /**
- * Loads the page containing the calendar component.
- */
- @BeforeMethod
- private void loadPage() {
- super.loadPage("richInputs", 10, 1, MSG_COMPONENT_DESCRIPTION);
- }
+ /**
+ * Pulls out opacity from the specified attribute.
+ *
+ * @param loc
+ * an attribute locator
+ * @return the value of opacity
+ */
+ private double getOpacity(String loc) {
+ String tmp = selenium.getAttribute(loc);
+ int firstIdx = tmp.indexOf("opacity") + 9;
+ int secondIdx = tmp.indexOf(";", firstIdx);
+ return Double.parseDouble(tmp.substring(firstIdx, secondIdx));
+ }
+
+ /**
+ * Loads the page containing the calendar component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Suggestion Box");
+ }
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tabPanel/TabPanelTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tabPanel/TabPanelTestCase.java 2009-09-08
14:43:30 UTC (rev 15494)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tabPanel/TabPanelTestCase.java 2009-09-08
14:54:18 UTC (rev 15495)
@@ -1,3 +1,21 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
package org.jboss.richfaces.integrationTest.tabPanel;
import static org.testng.Assert.assertEquals;
@@ -5,6 +23,7 @@
import static org.testng.Assert.assertTrue;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -16,176 +35,165 @@
*/
public class TabPanelTestCase extends AbstractSeleniumRichfacesTestCase {
- // messages -- Usage
- private final String MSG_USAGE_COMPONENT_DESCRIPTION =
getMess("USAGE_COMPONENT_DESCRIPTION");
- private final String MSG_USAGE_CONTENT_OF_PANEL_N =
getMess("USAGE_CONTENT_OF_PANEL_N");
- private final String MSG_USAGE_SECOND_TAB_SHOULD_BE_DISABLED =
getMess("USAGE_SECOND_TAB_SHOULD_BE_DISABLED");
+ // messages
+ private final String MSG_USAGE_CONTENT_OF_PANEL_PREFORMATTED =
getMsg("USAGE_CONTENT_OF_PANEL_PREFORMATTED");
+ private final String MSG_USAGE_SECOND_TAB_SHOULD_BE_DISABLED =
getMsg("USAGE_SECOND_TAB_SHOULD_BE_DISABLED");
+ private final String MSG_CUST_TABS_RIGHT_ALIGNED =
getMsg("CUST_TABS_RIGHT_ALIGNED");
+ private final String MSG_DELET_NUMBER_OF_TABS =
getMsg("DELET_NUMBER_OF_TABS");
- // messages -- Look Customization
- private final String MSG_CUST_COMPONENT_DESCRIPTION =
getMess("CUST_COMPONENT_DESCRIPTION");
- private final String MSG_CUST_TABS_RIGHT_ALIGNED =
getMess("CUST_TABS_RIGHT_ALIGNED");
+ // locators
+ private final String LOC_USAGE_EXAMPLE_HEADER =
getLoc("USAGE_EXAMPLE_HEADER");
+ private final String LOC_USAGE_PANEL_TAB_PREFORMATTED =
getLoc("USAGE_PANEL_TAB_PREFORMATTED");
+ private final String LOC_USAGE_PANEL_TEXT_PREFORMATTED =
getLoc("USAGE_PANEL_TEXT_PREFORMATTED");
+ private final String LOC_USAGE_PANEL_3_TEXT_PREFORMATTED =
getLoc("USAGE_PANEL_3_TEXT_PREFORMATTED");
- // messages -- Tabs Deletion
- private final String MSG_DELET_COMPONENT_DESCRIPTION =
getMess("DELET_COMPONENT_DESCRIPTION");
- private final String MSG_DELET_NUMBER_OF_TABS =
getMess("DELET_NUMBER_OF_TABS");
+ private final String LOC_CUST_EXAMPLE_HEADER =
getLoc("CUST_EXAMPLE_HEADER");
+ private final String LOC_CUST_TABS_ALIGN = getLoc("CUST_TABS_ALIGN");
+ private final String LOC_CUST_PANEL_TEXT_PREFORMATTED =
getLoc("CUST_PANEL_TEXT_PREFORMATTED");
+ private final String LOC_CUST_PANEL_TAB_PREFORMATTED =
getLoc("CUST_PANEL_TAB_PREFORMATTED");
- // locators -- Usage
- private final String LOC_USAGE_EXAMPLE_HEADER =
getLoc("USAGE_EXAMPLE_HEADER");
- private final String LOC_USAGE_PANEL_N_TAB_M = getLoc("USAGE_PANEL_N_TAB_M");
- private final String LOC_USAGE_PANEL_N_TEXT = getLoc("USAGE_PANEL_N_TEXT");
- private final String LOC_USAGE_PANEL_3_N_TEXT =
getLoc("USAGE_PANEL_3_N_TEXT");
+ private final String LOC_DELET_EXAMPLE_HEADER =
getLoc("DELET_EXAMPLE_HEADER");
+ private final String LOC_DELET_PANEL_TABS = getLoc("DELET_PANEL_TABS");
+ private final String LOC_DELET_PANEL_TAB_CLOSE_PREFORMATTED =
getLoc("DELET_PANEL_TAB_CLOSE_PREFORMATTED");
+ private final String LOC_DELET_RESET_BUTTON =
getLoc("DELET_RESET_BUTTON");
- // locators -- Look Customization
- private final String LOC_CUST_EXAMPLE_HEADER = getLoc("CUST_EXAMPLE_HEADER");
- private final String LOC_CUST_TABS_ALIGN = getLoc("CUST_TABS_ALIGN");
- private final String LOC_CUST_PANEL_TEXT = getLoc("CUST_PANEL_TEXT");
- private final String LOC_CUST_PANEL_TAB_N = getLoc("CUST_PANEL_TAB_N");
+ /**
+ * Tests three tab panels from the usage tab. It click on each tab and
+ * verifies that the content of panel changed appropriately.
+ */
+ @Test
+ public void testTabPanelExample() {
+ openTab("Usage");
+ String text;
- // locators -- Tabs Deletion
- private final String LOC_DELET_EXAMPLE_HEADER =
getLoc("DELET_EXAMPLE_HEADER");
- private final String LOC_DELET_PANEL_TABS = getLoc("DELET_PANEL_TABS");
- private final String LOC_DELET_PANEL_TAB_N_CLOSE =
getLoc("DELET_PANEL_TAB_N_CLOSE");
- private final String LOC_DELET_RESET_BUTTON = getLoc("DELET_RESET_BUTTON");
+ // test the first tab panel
+ for (int i = 3; i > 0; i--) {
+ scrollIntoView(LOC_USAGE_EXAMPLE_HEADER, true); // scrolling is
+ // forgotten after
+ // page reload
+ selenium.click(format(LOC_USAGE_PANEL_TAB_PREFORMATTED, 1, i));
+ waitFor(2000);
+ text = selenium.getText(format(LOC_USAGE_PANEL_TEXT_PREFORMATTED, 1));
+ assertEquals(text, "Here is tab #" + i,
format(MSG_USAGE_CONTENT_OF_PANEL_PREFORMATTED, 1));
+ }
- /**
- * Tests three tab panels from the usage tab. It click on each tab and
- * verifies that the content of panel changed appropriately.
- */
- @Test
- public void testTabPanelExample() {
- super.loadPage("richOutputs", 10, 1, MSG_USAGE_COMPONENT_DESCRIPTION);
- String text;
+ // test the second tab panel
+ scrollIntoView(LOC_USAGE_EXAMPLE_HEADER, true);
+ selenium.click(format(LOC_USAGE_PANEL_TAB_PREFORMATTED, 2, 3));
+ waitFor(2000);
+ text = selenium.getText(format(LOC_USAGE_PANEL_TEXT_PREFORMATTED, 2));
+ assertEquals(text, "Here is tab #" + 3,
format(MSG_USAGE_CONTENT_OF_PANEL_PREFORMATTED, 2));
- // test the first tab panel
- for (int i = 3; i > 0; i--) {
- scrollIntoView(LOC_USAGE_EXAMPLE_HEADER, true); // scrolling is
- // forgotten after
- // page reload
- selenium.click(String.format(LOC_USAGE_PANEL_N_TAB_M, 1, i));
- waitFor(2000);
- text = selenium.getText(String.format(LOC_USAGE_PANEL_N_TEXT, 1));
- assertEquals(text, "Here is tab #" + i, String.format(
- MSG_USAGE_CONTENT_OF_PANEL_N, 1));
- }
+ selenium.click(format(LOC_USAGE_PANEL_TAB_PREFORMATTED, 2, 1));
+ waitFor(2000);
+ text = selenium.getText(format(LOC_USAGE_PANEL_TEXT_PREFORMATTED, 2));
+ assertEquals(text, "Here is tab #" + 1,
format(MSG_USAGE_CONTENT_OF_PANEL_PREFORMATTED, 2));
- // test the second tab panel
- scrollIntoView(LOC_USAGE_EXAMPLE_HEADER, true);
- selenium.click(String.format(LOC_USAGE_PANEL_N_TAB_M, 2, 3));
- waitFor(2000);
- text = selenium.getText(String.format(LOC_USAGE_PANEL_N_TEXT, 2));
- assertEquals(text, "Here is tab #" + 3, String.format(
- MSG_USAGE_CONTENT_OF_PANEL_N, 2));
+ // test the disabled tab
+ boolean isEnabled = true;
+ try {
+ isEnabled = belongsClass("rich-tab-diabled",
format(LOC_USAGE_PANEL_TAB_PREFORMATTED, 2, 2));
+ assertFalse(isEnabled, MSG_USAGE_SECOND_TAB_SHOULD_BE_DISABLED);
+ } catch (Exception e) {
+ // OK - there is no class attribute
+ }
+ selenium.click(format(LOC_USAGE_PANEL_TAB_PREFORMATTED, 2, 2));
+ waitFor(2000);
+ text = selenium.getText(format(LOC_USAGE_PANEL_TEXT_PREFORMATTED, 2));
+ assertEquals(text, "Here is tab #1",
format(MSG_USAGE_CONTENT_OF_PANEL_PREFORMATTED, 2));
- selenium.click(String.format(LOC_USAGE_PANEL_N_TAB_M, 2, 1));
- waitFor(2000);
- text = selenium.getText(String.format(LOC_USAGE_PANEL_N_TEXT, 2));
- assertEquals(text, "Here is tab #" + 1, String.format(
- MSG_USAGE_CONTENT_OF_PANEL_N, 2));
+ // test the third tab panel -- client type work different
+ scrollIntoView(LOC_USAGE_EXAMPLE_HEADER, true);
+ for (int i = 3; i > 0; i--) {
+ selenium.click(format(LOC_USAGE_PANEL_TAB_PREFORMATTED, 3, i));
+ waitFor(2000);
+ for (int j = 1; j < 4; j++) {
+ if (i == j) {
+ assertTrue(isDisplayed(format(LOC_USAGE_PANEL_3_TEXT_PREFORMATTED,
j)));
+ } else {
+ assertFalse(isDisplayed(format(LOC_USAGE_PANEL_3_TEXT_PREFORMATTED,
j)));
+ }
+ }
+ }
+ }
- // test the disabled tab
- boolean isEnabled = true;
- try {
- selenium.getAttribute(
- String.format(LOC_USAGE_PANEL_N_TAB_M, 2, 2) + "@class")
- .contains("rich-tab-diabled");
- assertFalse(isEnabled, MSG_USAGE_SECOND_TAB_SHOULD_BE_DISABLED);
- } catch (Exception e) {
- // OK - there is no class attribute
- }
- selenium.click(String.format(LOC_USAGE_PANEL_N_TAB_M, 2, 2));
- waitFor(2000);
- text = selenium.getText(String.format(LOC_USAGE_PANEL_N_TEXT, 2));
- assertEquals(text, "Here is tab #1", String.format(
- MSG_USAGE_CONTENT_OF_PANEL_N, 2));
+ /**
+ * Tests tab panel customization. It clicks every tab and verifies that the
+ * content of panel changed. Then it checks that the tabs are aligned to the
+ * right.
+ */
+ @Test
+ public void testCustomization() {
+ openTab("Look Customization");
+ scrollIntoView(LOC_CUST_EXAMPLE_HEADER, true);
+ String text;
- // test the third tab panel -- client type work different
- scrollIntoView(LOC_USAGE_EXAMPLE_HEADER, true);
- for (int i = 3; i > 0; i--) {
- selenium.click(String.format(LOC_USAGE_PANEL_N_TAB_M, 3, i));
- waitFor(2000);
- for (int j = 1; j < 4; j++) {
- if (i == j) {
- assertTrue(isDisplayed(String.format(
- LOC_USAGE_PANEL_3_N_TEXT, j)));
- } else {
- assertFalse(isDisplayed(String.format(
- LOC_USAGE_PANEL_3_N_TEXT, j)));
- }
- }
- }
- }
+ for (int i = 3; i > 0; i--) {
+ selenium.click(format(LOC_CUST_PANEL_TAB_PREFORMATTED, i));
+ waitFor(2000);
+ for (int j = 1; j < 4; j++) {
+ if (i == j) {
+ waitFor(5000);
+ assertTrue(isDisplayed(format(LOC_CUST_PANEL_TEXT_PREFORMATTED, j)),
format(
+ "Tab nr. {0} should be open.", j));
+ } else {
+ assertFalse(isDisplayed(format(LOC_CUST_PANEL_TEXT_PREFORMATTED, j)),
format(
+ "Tab nr. {0} should not be open.", j));
+ }
+ }
+ }
- /**
- * Tests tab panel customization. It clicks every tab and verifies that the
- * content of panel changed. Then it checks that the tabs are aligned to the
- * right.
- */
- @Test
- public void testCustomization() {
- super.loadPage("richOutputs", 10, 2, MSG_CUST_COMPONENT_DESCRIPTION);
- scrollIntoView(LOC_CUST_EXAMPLE_HEADER, true);
+ text = selenium.getAttribute(LOC_CUST_TABS_ALIGN);
+ assertEquals(text, "right", MSG_CUST_TABS_RIGHT_ALIGNED);
+ }
- String text;
+ /**
+ * Tests tabs deletion. First it check that there are 3 tabs, then deletes
+ * the third, the second, and the first tab. After each deletion it verifies
+ * the number of remaining tabs. In the end it clicks the reset button and
+ * checks that all tabs were restored.
+ */
+ @Test
+ public void testTabsDeletion() {
+ openTab("Tabs Deletion");
+ scrollIntoView(LOC_DELET_EXAMPLE_HEADER, true);
- for (int i = 3; i > 0; i--) {
- selenium.click(String.format(LOC_CUST_PANEL_TAB_N, i));
- waitFor(2000);
- for (int j = 1; j < 4; j++) {
- if (i == j) {
- assertTrue(isDisplayed(String
- .format(LOC_CUST_PANEL_TEXT, j)));
- } else {
- assertFalse(isDisplayed(String.format(LOC_CUST_PANEL_TEXT,
- j)));
- }
- }
- }
+ int count = selenium.getXpathCount(LOC_DELET_PANEL_TABS).intValue();
+ assertEquals(count - 4, 3, MSG_DELET_NUMBER_OF_TABS);
- text = selenium.getAttribute(LOC_CUST_TABS_ALIGN);
- assertEquals(text, "right", MSG_CUST_TABS_RIGHT_ALIGNED);
- }
+ for (int i = 3; i > 0; i--) {
+ selenium.click(format(LOC_DELET_PANEL_TAB_CLOSE_PREFORMATTED, i));
+ waitFor(2000);
+ count = selenium.getXpathCount(LOC_DELET_PANEL_TABS).intValue();
+ assertEquals(count / 2, i - 1, MSG_DELET_NUMBER_OF_TABS);
+ }
- /**
- * Tests tabs deletion. First it check that there are 3 tabs, then deletes
- * the third, the second, and the first tab. After each deletion it verifies
- * the number of remaining tabs. In the end it clicks the reset button and
- * checks that all tabs were restored.
- */
- @Test
- public void testTabsDeletion() {
- super.loadPage("richOutputs", 10, 3, MSG_DELET_COMPONENT_DESCRIPTION);
- scrollIntoView(LOC_DELET_EXAMPLE_HEADER, true);
+ selenium.click(LOC_DELET_RESET_BUTTON);
+ waitFor(2000);
+ count = selenium.getXpathCount(LOC_DELET_PANEL_TABS).intValue();
+ assertEquals(count - 4, 3, MSG_DELET_NUMBER_OF_TABS);
+ }
- int count = selenium.getXpathCount(LOC_DELET_PANEL_TABS).intValue();
- assertEquals(count - 4, 3, MSG_DELET_NUMBER_OF_TABS);
+ /**
+ * Tests the "View Source". It checks that the source code is not visible,
+ * clicks on the link, and checks 5 lines of source code.
+ */
+ @Test
+ public void testUsageTabExampleSource() {
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
"<rich:tabPanel>",
+ "<rich:tab label=\"First\">", "Here is tab
#2", "<rich:tabPanel switchType=\"ajax\">",
+ "<rich:tab label=\"Second\"
disabled=\"true\">", "<rich:tabPanel
switchType=\"client\">", };
- for (int i = 3; i > 0; i--) {
- selenium.click(String.format(LOC_DELET_PANEL_TAB_N_CLOSE, i));
- waitFor(2000);
- count = selenium.getXpathCount(LOC_DELET_PANEL_TABS).intValue();
- assertEquals(count / 2, i - 1, MSG_DELET_NUMBER_OF_TABS);
- }
+ abstractTestSource(1, "View Source", strings);
+ }
- selenium.click(LOC_DELET_RESET_BUTTON);
- waitFor(2000);
- count = selenium.getXpathCount(LOC_DELET_PANEL_TABS).intValue();
- assertEquals(count - 4, 3, MSG_DELET_NUMBER_OF_TABS);
- }
+ /**
+ * Loads the page containing the calendar component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Tab Panel");
+ }
- /**
- * Tests the "View Source". It checks that the source code is not visible,
- * clicks on the link, and checks 5 lines of source code.
- */
- @Test
- public void testUsageTabExampleSource() {
- String[] strings = new String[] {
- "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
- "<rich:tabPanel>", "<rich:tab
label=\"First\">",
- "Here is tab #2", "<rich:tabPanel
switchType=\"ajax\">",
- "<rich:tab label=\"Second\" disabled=\"true\">",
- "<rich:tabPanel switchType=\"client\">", };
-
- abstractTestSource(1, "View Source", strings);
- }
-
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/locators.properties 2009-09-08
14:43:30 UTC (rev 15494)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/locators.properties 2009-09-08
14:54:18 UTC (rev 15495)
@@ -1,10 +1,12 @@
EXAMPLE_1_HEADER=//fieldset[1]/legend
EXAMPLE_2_HEADER=//fieldset[2]/legend
-FIRST_EXAMPLE_HEADER=//fieldset[legend/text()='Simple Toggle Panel
example']//div[@class='rich-stglpanel-header']
-FIRST_EXAMPLE_ARROWS_LEFT_RELATIVE_TO_HEADER={0}//div[@class='rich-stglpnl-marker'
and contains(@id,'switch_on')]
-FIRST_EXAMPLE_ARROWS_RIGHT_RELATIVE_TO_HEADER={0}//div[@class='rich-stglpnl-marker'
and contains(@id,'switch_off')]
-FIRST_EXAMPLE_BODY=//fieldset[legend/text()='Simple Toggle Panel
example']//div[@class='rich-stglpanel-body']
-SECOND_EXAMPLE_N_HEADER=//fieldset[legend/text()\='Switch types
example']//td[@class\='tpanels'][%d]//div[@class\='rich-stglpanel-header']
-SECOND_EXAMPLE_N_ARROWS_LEFT_RELATIVE_TO_HEADER={0}//div[@class\='rich-stglpnl-marker'
and contains(@id,'switch_on')]
-SECOND_EXAMPLE_N_ARROWS_RIGHT_RELATIVE_TO_HEADER={0}//div[@class\='rich-stglpnl-marker'
and contains(@id,'switch_off')]
-SECOND_EXAMPLE_N_BODY=//fieldset[legend/text()\='Switch types
example']//td[@class\='tpanels'][%d]//div[@class\='rich-stglpanel-body']
+
+FIRST_EXAMPLE_HEADER=//fieldset[1]//form/div
+FIRST_EXAMPLE_ARROWS_LEFT=//fieldset[1]//div[@class='rich-stglpnl-marker' and
contains(@id,'switch_on')]
+FIRST_EXAMPLE_ARROWS_RIGHT=//fieldset[1]//div[@class='rich-stglpnl-marker' and
contains(@id,'switch_off')]
+FIRST_EXAMPLE_BODY=//fieldset[1]/div/div[1]/div
+
+SECOND_EXAMPLE_N_HEADER=//fieldset[2]//td[{0}]/div/div[1]
+SECOND_EXAMPLE_N_ARROWS_LEFT=//fieldset[2]//td[{0}]//div[@class\='rich-stglpnl-marker'
and contains(@id,'switch_on')]
+SECOND_EXAMPLE_N_ARROWS_RIGHT=//fieldset[2]//td[{0}]//div[@class\='rich-stglpnl-marker'
and contains(@id,'switch_off')]
+SECOND_EXAMPLE_N_BODY=//fieldset[2]//td[{0}]/div/div[contains(@class,
'rich-stglpanel-body')]
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/messages.properties 2009-09-08
14:43:30 UTC (rev 15494)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/messages.properties 2009-09-08
14:54:18 UTC (rev 15495)
@@ -1,10 +1,9 @@
-COMPONENT_DESCRIPTION= SimpleTogglePanel represents a panel with a base text label at the
top and additional content
-PANEL_HEADER=Header of the panel should be "%s".
+PANEL_HEADER=Header of the panel should be "{0}".
BODY_SHOULD_BE_VISIBLE=Content of the panel should be visible.
BODY_SHOULD_NOT_BE_VISIBLE=Content of the panel should not be visible.
-LEFT_ARROWS_SHOULD_BE_VISIBLE=Picture with two arrow heading to the left in panel's
header should be visible.
-LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE=Picture with two arrow heading to the left in
panel's header should not be visible.
-RIGHT_ARROWS_SHOULD_BE_VISIBLE=Picture with two arrow heading to the right in panel's
header should be visible.
-RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE=Picture with two arrow heading to the right in
panel's header should not be visible.
+LEFT_ARROWS_SHOULD_BE_VISIBLE=Picture with two arrows heading to the left in panel's
header should be visible.
+LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE=Picture with two arrows heading to the left in
panel's header should not be visible.
+RIGHT_ARROWS_SHOULD_BE_VISIBLE=Picture with two arrows heading to the right in
panel's header should be visible.
+RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE=Picture with two arrows heading to the right in
panel's header should not be visible.
Added:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/locators.properties
(rev 0)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/locators.properties 2009-09-08
14:54:18 UTC (rev 15495)
@@ -0,0 +1,7 @@
+EXAMPLE_HEADER=//fieldset/legend
+UPPER_SPINNER_INPUT=//fieldset/div/form/table[1]/tbody/tr/td[1]/input
+UPPER_SPINNER_UP=//fieldset/div/form/table[1]/tbody/tr/td[2]/table/tbody/tr[1]/td/input
+UPPER_SPINNER_DOWN=//fieldset/div/form/table[1]/tbody/tr/td[2]/table/tbody/tr[2]/td/input
+LOWER_SPINNER_INPUT=//fieldset/div/form/table[2]/tbody/tr/td[1]/input
+LOWER_SPINNER_UP=//fieldset/div/form/table[2]/tbody/tr/td[2]/table/tbody/tr[1]/td/input
+LOWER_SPINNER_DOWN=//fieldset/div/form/table[2]/tbody/tr/td[2]/table/tbody/tr[2]/td/input
\ No newline at end of file
Added:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/messages.properties
(rev 0)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/messages.properties 2009-09-08
14:54:18 UTC (rev 15495)
@@ -0,0 +1,29 @@
+INITIAL_STATE_UPPER=50
+INITIAL_STATE_LOWER=50
+
+TYPE_TO_UPPER_FIRST_TYPED=20
+TYPE_TO_UPPER_FIRST_EXPECTED=20
+TYPE_TO_UPPER_SECOND_TYPED=2000
+TYPE_TO_UPPER_SECOND_EXPECTED=100
+TYPE_TO_UPPER_THIRD_TYPED=-23
+TYPE_TO_UPPER_THIRD_EXPECTED=0
+TYPE_TO_UPPER_FOURTH_TYPED=34.5
+TYPE_TO_UPPER_FOURTH_EXPECTED=34.5
+TYPE_TO_UPPER_FIFTH_TYPED=aaa
+TYPE_TO_UPPER_FIFTH_EXPECTED=34.5
+
+TYPE_TO_LOWER_FIRST_TYPED=20
+TYPE_TO_LOWER_FIRST_EXPECTED=20
+TYPE_TO_LOWER_SECOND_TYPED=2000
+TYPE_TO_LOWER_SECOND_EXPECTED=100
+TYPE_TO_LOWER_THIRD_TYPED=-23
+TYPE_TO_LOWER_THIRD_EXPECTED=0
+TYPE_TO_LOWER_FOURTH_TYPED=34.5
+TYPE_TO_LOWER_FOURTH_EXPECTED=34.5
+TYPE_TO_LOWER_FIFTH_TYPED=aaa
+TYPE_TO_LOWER_FIFTH_EXPECTED=34.5
+
+OVERFLOW_UPPER=0
+OVERFLOW_LOWER=0
+UNDERFLOW_UPPER=100
+UNDERFLOW_LOWER=100
\ No newline at end of file
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties 2009-09-08
14:43:30 UTC (rev 15494)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties 2009-09-08
14:54:18 UTC (rev 15495)
@@ -1,4 +1,4 @@
-FIRST_SUGGESTION_BOX_N=//table[@id='suggestionbox_form:suggestionBoxId:suggest']/tbody/tr[%d]
+FIRST_SUGGESTION_BOX_PREFORMATTED=//table[@id='suggestionbox_form:suggestionBoxId:suggest']/tbody/tr[{0}]
FIRST_INPUT=//fieldset[1]/div/form/table/tbody/tr/td[1]/input[1]
FIRST_BORDER_INPUT=//fieldset[1]/div/form/table/tbody/tr/td[1]/table/tbody/tr[1]/td[2]/table/tbody/tr[1]/td[3]/input
@@ -8,7 +8,7 @@
FIRST_SHADOW_OPACITY_INPUT=//fieldset[1]/div/form/table/tbody/tr/td[1]/table/tbody/tr[5]/td[2]/table/tbody/tr[1]/td[3]/input
FIRST_CELLPADDING_INPUT=//fieldset[1]/div/form/table/tbody/tr/td[1]/table/tbody/tr[6]/td[2]/table/tbody/tr[1]/td[3]/input
-FIRST_TOWN_TABLE_M_N=//fieldset[1]/div/form/table/tbody/tr/td[2]/div/table/tbody/tr[%d]/td[%d]
+FIRST_TOWN_TABLE_PREFORMATTED=//fieldset[1]/div/form/table/tbody/tr/td[2]/div/table/tbody/tr[{0}]/td[{1}]
FIRST_BORDER_STYLE=//div[@id='suggestionbox_form:suggestionBoxId']/div[1]/div@style
FIRST_WIDTH_STYLE=//div[@id='suggestionbox_form:suggestionBoxId']@style
@@ -20,5 +20,5 @@
SECOND_INPUT=//fieldset[2]/div/form/table/tbody/tr[1]/td[2]/table/tbody/tr/td[1]/input
SECOND_BUTTON=//fieldset[2]/div/form/table/tbody/tr[1]/td[2]/table/tbody/tr/td[2]/img
SECOND_SUGGESTION_LINES=//div[@id='form:suggestion']/div[1]/div/table/tbody/tr/td/div/table/tbody/tr
-SECOND_SUGGESTION_BOX_N=//div[@id='form:suggestion']/div[1]/div/table/tbody/tr/td/div/table/tbody/tr[%d]
+SECOND_SUGGESTION_BOX_PREFORMATTED=//div[@id='form:suggestion']/div[1]/div/table/tbody/tr/td/div/table/tbody/tr[{0}]
SECOND_STATE=//fieldset[2]/div/form/table/tbody/tr[2]/td[2]/span
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/messages.properties 2009-09-08
14:43:30 UTC (rev 15494)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/messages.properties 2009-09-08
14:54:18 UTC (rev 15495)
@@ -1,13 +1,13 @@
COMPONENT_DESCRIPTION=RichFaces Suggestion Box component adds the autocomplete capability
to the existing input component
-TABLE_M_N=String in the table on the position [%d,%d].
+TABLE_PREFORMATTED=String in the table on the position [{0},{1}].
NO_CAPITALS_FOUND=There should be no capitals.
-SUGGESTION_BOX_BORDER=Border width of the suggestion box after typing %d.
-SUGGESTION_BOX_WIDTH=Width of the suggestion box after typing %d.
-SUGGESTION_BOX_HEIGHT=Height of the suggestion box after typing %d.
-SUGGESTION_BOX_SHADOW_DEPTH=Depth of the shadow after typing %d.
-SUGGESTION_BOX_SHADOW_OPACITY=Opacity of the shadow after typing %d.
-SUGGESTION_BOX_CELLPADDING=Padding of the suggestion box's cells after typing %d.
+SUGGESTION_BOX_BORDER_PREFORMATTED=Border width of the suggestion box after typing {0}.
+SUGGESTION_BOX_WIDTH_PREFORMATTED=Width of the suggestion box after typing {0}.
+SUGGESTION_BOX_HEIGHT_PREFORMATTED=Height of the suggestion box after typing {0}.
+SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED=Depth of the shadow after typing {0}.
+SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED=Opacity of the shadow after typing {0}.
+SUGGESTION_BOX_CELLPADDING_PREFORMATTED=Padding of the suggestion box's cells after
typing {0}.
COUNT_OF_ALL_SUGGESTIONS=Count of all suggestions.
AUGUSTA_MAINE=Augusta is the capital of Maine.
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/locators.properties 2009-09-08
14:43:30 UTC (rev 15494)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/locators.properties 2009-09-08
14:54:18 UTC (rev 15495)
@@ -1,17 +1,17 @@
# first tab
USAGE_EXAMPLE_HEADER=//fieldset/legend
-USAGE_PANEL_N_TEXT=//fieldset/div/table[%d]/tbody/tr[2]/td/table/tbody/tr/td
-USAGE_PANEL_3_N_TEXT=//fieldset/div/table[3]/tbody/tr[2]/td[%d]
-USAGE_PANEL_N_TAB_M=//fieldset/div/table[%d]/tbody/tr[1]/td/form/table/tbody/tr/td[%d*2]/table
+USAGE_PANEL_TEXT_PREFORMATTED=//fieldset/div/table[{0}]/tbody/tr[2]/td/table/tbody/tr/td
+USAGE_PANEL_3_TEXT_PREFORMATTED=//fieldset/div/table[3]/tbody/tr[2]/td[{0}]
+USAGE_PANEL_TAB_PREFORMATTED=//fieldset/div/table[{0}]/tbody/tr[1]/td/form/table/tbody/tr/td[{1}*2]/table
# second tab
CUST_EXAMPLE_HEADER=//div[@id='itme']/p
-CUST_TABS_ALIGN=//table[@class\='rich-tabpanel']/tbody/tr[1]/td@align
-CUST_PANEL_TEXT=//table[@class\='rich-tabpanel']/tbody/tr[2]/td[%d]
-CUST_PANEL_TAB_N=//table[@class\='rich-tabpanel']/tbody/tr[1]/td/form/table/tbody/tr/td[%d*2]/table
+CUST_TABS_ALIGN=//div[@id='itme']//table[contains(@class,'rich-tabpanel')]/tbody/tr[1]/td@align
+CUST_PANEL_TEXT_PREFORMATTED=//div[@id='itme']//table[contains(@class,'rich-tabpanel')]/tbody/tr[2]/td[{0}]
+CUST_PANEL_TAB_PREFORMATTED=//div[@id='itme']//table[contains(@class,'rich-tabpanel')]/tbody/tr[1]/td/form/table/tbody/tr/td[{0}*2]/table
# third tab
DELET_EXAMPLE_HEADER=//form[@id='tabs_form']/../../p
DELET_PANEL_TABS=//table[@id='tabs_form:RemoveAbleTabPanel']/tbody/tr[1]/td/table/tbody/tr/td
-DELET_PANEL_TAB_N_CLOSE=//img[@id='tabs_form:hidelink%d']
+DELET_PANEL_TAB_CLOSE_PREFORMATTED=//img[@id='tabs_form:hidelink{0}']
DELET_RESET_BUTTON=//form[@id\='tabs_form']/input[2]
\ No newline at end of file
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/messages.properties 2009-09-08
14:43:30 UTC (rev 15494)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/messages.properties 2009-09-08
14:54:18 UTC (rev 15495)
@@ -1,12 +1,9 @@
# first tab
-USAGE_COMPONENT_DESCRIPTION=Tab panel is used to create "tabbed" pages.
-USAGE_CONTENT_OF_PANEL_N=Content of tab panel %d.
+USAGE_CONTENT_OF_PANEL_PREFORMATTED=Content of tab panel {0}.
USAGE_SECOND_TAB_SHOULD_BE_DISABLED=The second tab should be disabled.
# second tab
-CUST_COMPONENT_DESCRIPTION=This is a demo of how to use stylesheets and skinnability
features in order to adjust tab panel appearance.
CUST_TABS_RIGHT_ALIGNED=Tabs should be aligned to the right.
# third tab
-DELET_COMPONENT_DESCRIPTION=This simple sample is added according to numerous Forum
requests and shows how to implement tabs deletion from tabPanel component.
DELET_NUMBER_OF_TABS=Number of tabs in the example.
\ No newline at end of file