Author: ppitonak(a)redhat.com
Date: 2009-09-10 11:46:40 -0400 (Thu, 10 Sep 2009)
New Revision: 15532
Added:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/listShuttle/
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/listShuttle/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/listShuttle/messages.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/orderingList/
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/orderingList/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/orderingList/messages.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/pickList/
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/pickList/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/pickList/messages.properties
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/listShuttle/ListShuttleTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/modalPanel/ModalPanelTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/orderingList/OrderingListTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/paint2d/Paint2DTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelCustomizationTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelBar/PanelBarTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelMenu/PanelMenuTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/pickList/PickListTestCase.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/resources/org/jboss/richfaces/integrationTest/modalPanel/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/modalPanel/messages.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/paint2d/messages.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panel/messages.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panelMenu/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panelMenu/messages.properties
Log:
* ListShuttleTestCase, ModalPanelTestCase, OrderingListTestCase, Paint2DTestCase,
PanelTestCase, PanelCustomizationTestCase, PanelBarTestCase, PanelMenuTestCase,
PickListTestCase, and SpinnerTestCase refactored
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/listShuttle/ListShuttleTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/listShuttle/ListShuttleTestCase.java 2009-09-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/listShuttle/ListShuttleTestCase.java 2009-09-10
15:46:40 UTC (rev 15532)
@@ -1,75 +1,83 @@
-/**
- * License Agreement.
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * JBoss RichFaces
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Copyright (C) 2009 Red Hat, Inc.
- *
- * This code is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this code; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
package org.jboss.richfaces.integrationTest.listShuttle;
import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
+ * Test case for list shuttle.
*
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
public class ListShuttleTestCase extends AbstractSeleniumRichfacesTestCase {
- private final String toolbar =
"//fieldset[1]/div/form/table[1]/tbody/tr[1]";
- private final String leftTable =
"//fieldset[1]/div/form/table[2]/tbody/tr[2]/td[1]/div/table/tbody/tr/td/div/div/table/tbody";
- private final String leftButtons =
"//fieldset[1]/div/form/table[2]/tbody/tr[2]/td[2]/div";
- private final String rightTable =
"//fieldset[1]/div/form/table[2]/tbody/tr[2]/td[3]/div/table/tbody/tr/td/div/div/table/tbody";
- private final String rightButtons =
"//fieldset[1]/div/form/table[2]/tbody/tr[2]/td[4]/div";
+ private final String LOC_EXAMPLE_HEADER = getLoc("EXAMPLE_HEADER");
+ private final String LOC_LEFT_TABLE_LINES = getLoc("LEFT_TABLE_LINES");
+ private final String LOC_RIGHT_TABLE_LINES = getLoc("RIGHT_TABLE_LINES");
+ private final String LOC_LEFT_TABLE_LINE_1 = getLoc("LEFT_TABLE_LINE_1");
+ private final String LOC_RIGHT_TABLE_LINE_PREFORMATTED =
getLoc("RIGHT_TABLE_LINE_PREFORMATTED");
+ private final String LOC_TOOLBAR_ITEMS = getLoc("TOOLBAR_ITEMS");
+ private final String LOC_TOOLBAR_ITEM_PREFORMATTED =
getLoc("TOOLBAR_ITEM_PREFORMATTED");
+ private final String LOC_COPY_ALL_BUTTON = getLoc("COPY_ALL_BUTTON");
+ private final String LOC_COPY_BUTTON = getLoc("COPY_BUTTON");
+ private final String LOC_REMOVE_BUTTON = getLoc("REMOVE_BUTTON");
+ private final String LOC_REMOVE_ALL_BUTTON = getLoc("REMOVE_ALL_BUTTON");
+ private final String LOC_FIRST_BUTTON = getLoc("FIRST_BUTTON");
+ private final String LOC_UP_BUTTON = getLoc("UP_BUTTON");
+ private final String LOC_DOWN_BUTTON = getLoc("DOWN_BUTTON");
+ private final String LOC_LAST_BUTTON = getLoc("LAST_BUTTON");
+
+ /**
+ * Tests copy button. Fist it clicks on the first item in left table, checks
+ * that copy button is enabled, and clicks the button. Then it checks that
+ * one item diappeared from left table, one appeared in right table and one
+ * item appeared in toolbar.
+ */
@Test
public void testCopyButton() {
- // get the count of items in left table
- int leftCount = selenium.getXpathCount(leftTable + "/tr").intValue();
- // get the count of items in right table
- int rightCount = selenium.getXpathCount(rightTable +
"/tr").intValue();
+ int leftCount = selenium.getXpathCount(LOC_LEFT_TABLE_LINES).intValue();
+ int rightCount = selenium.getXpathCount(LOC_RIGHT_TABLE_LINES).intValue();
- // click the first item in left table
- selenium.click(leftTable + "/tr[1]");
+ selenium.click(LOC_LEFT_TABLE_LINE_1);
+ assertTrue(isDisplayed(LOC_COPY_BUTTON), "Copy button should be
enabled.");
- // check that the copy button is enabled
- try {
- String text = selenium.getAttribute(leftButtons +
"/div[3]@style");
- assertFalse(text.contains("display: none;"), "Copy button
should not have style 'display: none;'");
- } catch (Exception e) {
- // OK
- }
+ selenium.click(LOC_COPY_BUTTON);
- // click 'Copy' button
- selenium.click(leftButtons + "/div[3]");
-
- int tmpInt = selenium.getXpathCount(leftTable + "/tr").intValue();
+ int tmpInt = selenium.getXpathCount(LOC_LEFT_TABLE_LINES).intValue();
assertEquals(tmpInt, leftCount - 1, "In left table, one item should be
removed.");
- tmpInt = selenium.getXpathCount(rightTable + "/tr").intValue();
+ tmpInt = selenium.getXpathCount(LOC_RIGHT_TABLE_LINES).intValue();
assertEquals(tmpInt, rightCount + 1, "In right table, one item should be
added.");
// check that it was added also to the toolbar
- tmpInt = selenium.getXpathCount(toolbar +
"/td[contains((a)class,'rich-toolbar-item')]").intValue();
+ tmpInt = selenium.getXpathCount(LOC_TOOLBAR_ITEMS).intValue();
assertEquals(tmpInt, rightCount + 1, "Number of items in toolbar.");
}
@@ -83,67 +91,55 @@
// fail("TODO");
// }
+ /**
+ * Tests copy all button. First it checks that the button is enabled, clicks
+ * on it and verifies that all items from left table were moved to the
+ * right. Then it checks that toolbar was modified.
+ */
@Test
public void testCopyAllButton() {
- // click 'Remove All' button
- selenium.click(leftButtons + "/div[7]");
+ int leftCount = selenium.getXpathCount(LOC_LEFT_TABLE_LINES).intValue();
+ int rightCount = selenium.getXpathCount(LOC_RIGHT_TABLE_LINES).intValue();
- // get the count of items in left table
- int leftCount = selenium.getXpathCount(leftTable + "/tr").intValue();
- // get the count of items in right table
- int rightCount = selenium.getXpathCount(rightTable +
"/tr").intValue();
+ assertTrue(isDisplayed(LOC_COPY_ALL_BUTTON), "Copy all button should be
enabled.");
- // check that the 'Copy All' button is enabled
- try {
- String text = selenium.getAttribute(leftButtons +
"/div[1]@style");
- assertFalse(text.contains("display: none;"), "Copy all button
should not have style 'display: none;'");
- } catch (Exception e) {
- // OK
- }
+ selenium.click(LOC_COPY_ALL_BUTTON);
- // click 'Copy All' button
- selenium.click(leftButtons + "/div[1]");
-
- int count = selenium.getXpathCount(leftTable + "/tr").intValue();
+ int count = selenium.getXpathCount(LOC_LEFT_TABLE_LINES).intValue();
assertEquals(count, 0, "All items from left table should be
removed.");
- count = selenium.getXpathCount(rightTable + "/tr").intValue();
+ count = selenium.getXpathCount(LOC_RIGHT_TABLE_LINES).intValue();
assertEquals(count, rightCount + leftCount, "All items should be added to
the right table.");
// check that they were added also to the toolbar
- count = selenium.getXpathCount(toolbar +
"/td[contains((a)class,'rich-toolbar-item')]").intValue();
+ count = selenium.getXpathCount(LOC_TOOLBAR_ITEMS).intValue();
assertEquals(count, rightCount + leftCount, "Number of items in
toolbar.");
}
+ /**
+ * Test remove button. First it clicks on the first item on the left and
+ * verifies that remove button is enabled. Then it clicks the button and
+ * verifies the count of items on the left, on the right, and in the
+ * toolbar.
+ */
@Test
public void testRemoveButton() {
- // get the count of items in left table
- int leftCount = selenium.getXpathCount(leftTable + "/tr").intValue();
- // get the count of items in right table
- int rightCount = selenium.getXpathCount(rightTable +
"/tr").intValue();
+ int leftCount = selenium.getXpathCount(LOC_LEFT_TABLE_LINES).intValue();
+ int rightCount = selenium.getXpathCount(LOC_RIGHT_TABLE_LINES).intValue();
- // click the first item in the right table
- selenium.click(rightTable + "/tr[1]");
+ selenium.click(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 1));
+ assertTrue(isDisplayed(LOC_REMOVE_BUTTON), "Remove button should be
enabled.");
- // check that the 'Remove' button is enabled
- try {
- String text = selenium.getAttribute(leftButtons +
"/div[5]@style");
- assertFalse(text.contains("display: none;"), "Remove button
should not have style 'display: none;'");
- } catch (Exception e) {
- // OK
- }
+ selenium.click(LOC_REMOVE_BUTTON);
- // click 'Remove' button
- selenium.click(leftButtons + "/div[5]");
-
- int tmpInt = selenium.getXpathCount(leftTable + "/tr").intValue();
+ int tmpInt = selenium.getXpathCount(LOC_LEFT_TABLE_LINES).intValue();
assertEquals(tmpInt, leftCount + 1, "One item should be added to the left
table.");
- tmpInt = selenium.getXpathCount(rightTable + "/tr").intValue();
+ tmpInt = selenium.getXpathCount(LOC_RIGHT_TABLE_LINES).intValue();
assertEquals(tmpInt, rightCount - 1, "One item should be removed from the
right table.");
// check that one item was removed from toolbar
- tmpInt = selenium.getXpathCount(toolbar +
"/td[contains((a)class,'rich-toolbar-item')]").intValue();
+ tmpInt = selenium.getXpathCount(LOC_TOOLBAR_ITEMS).intValue();
assertEquals(tmpInt, rightCount - 1, "Number of items in toolbar.");
}
@@ -157,64 +153,60 @@
// fail("TODO");
// }
+ /**
+ * Tests remove all button. First it verifies that the button is enabled and
+ * clicks it. Then it verifies count of items on the left, on the right, and
+ * in toolbar.
+ */
@Test
public void testRemoveAllButton() {
- // get the count of items in left table
- int leftCount = selenium.getXpathCount(leftTable + "/tr").intValue();
- // get the count of items in right table
- int rightCount = selenium.getXpathCount(rightTable +
"/tr").intValue();
+ int leftCount = selenium.getXpathCount(LOC_LEFT_TABLE_LINES).intValue();
+ int rightCount = selenium.getXpathCount(LOC_RIGHT_TABLE_LINES).intValue();
- // check that the 'Remove All' button is enabled
- try {
- String text = selenium.getAttribute(leftButtons +
"/div[7]@style");
- assertFalse(text.contains("display: none;"), "Remove all
button should not have style 'display: none;'");
- } catch (Exception e) {
- // OK
- }
+ assertTrue(isDisplayed(LOC_REMOVE_ALL_BUTTON), "Remove all button should be
enabled.");
- // click 'Remove All' button
- selenium.click(leftButtons + "/div[7]");
+ selenium.click(LOC_REMOVE_ALL_BUTTON);
- int tmpInt = selenium.getXpathCount(leftTable + "/tr").intValue();
+ int tmpInt = selenium.getXpathCount(LOC_LEFT_TABLE_LINES).intValue();
assertEquals(tmpInt, leftCount + rightCount, "All items should be added to
the left table.");
- tmpInt = selenium.getXpathCount(rightTable + "/tr").intValue();
+ tmpInt = selenium.getXpathCount(LOC_RIGHT_TABLE_LINES).intValue();
assertEquals(tmpInt, 0, "All items from right table should be
removed.");
// check that everything was removed from toolbar
- tmpInt = selenium.getXpathCount(toolbar +
"/td[contains((a)class,'rich-toolbar-item')]").intValue();
+ tmpInt = selenium.getXpathCount(LOC_TOOLBAR_ITEMS).intValue();
assertEquals(tmpInt, 0, "Number of items in toolbar.");
}
+ /**
+ * Tests button "up". First it clicks the second item on the right and
+ * clicks the button. Then it verifies that the item was moved both in table
+ * and in toolbar.
+ */
@Test
public void testUpButton() {
- // click 'Copy All' button
- selenium.click(leftButtons + "/div[1]");
+ String firstItemFromTable =
selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 1));
+ String firstItemFromToolbar =
selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 1));
+ String secondItemFromTable =
selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 2));
+ String secondItemFromToolbar =
selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 2));
- String firstItemFromTable = selenium.getText(rightTable +
"/tr[1]/td[2]");
- String firstItemFromToolbar = selenium.getText(toolbar + "/td[1]");
- String secondItemFromTable = selenium.getText(rightTable +
"/tr[2]/td[2]");
- String secondItemFromToolbar = selenium.getText(toolbar + "/td[3]");
-
assertEquals(secondItemFromToolbar, secondItemFromTable,
"The second item in right table and toolbar should be the
same.");
- // click the second item in the right table
- selenium.click(rightTable + "/tr[2]");
- // click the 'Up' button
- selenium.click(rightButtons + "/div[3]");
+ selenium.click(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 2));
+ selenium.click(LOC_UP_BUTTON);
// check items in the table
- String tmpString = selenium.getText(rightTable + "/tr[1]/td[2]");
+ String tmpString = selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED,
1));
assertEquals(tmpString, secondItemFromTable, "The first and the second item
in the table should be swapped.");
- tmpString = selenium.getText(rightTable + "/tr[2]/td[2]");
+ tmpString = selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 2));
assertEquals(tmpString, firstItemFromTable, "The first and the second item
in the table should be swapped.");
// check items in the toolbar
- tmpString = selenium.getText(toolbar + "/td[1]");
+ tmpString = selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 1));
assertEquals(tmpString, secondItemFromToolbar,
"The first and the second item in the toolbar should be
swapped.");
- tmpString = selenium.getText(toolbar + "/td[3]");
+ tmpString = selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 2));
assertEquals(tmpString, firstItemFromToolbar, "The first and the second item
in the toolbar should be swapped.");
}
@@ -228,72 +220,72 @@
// fail("TODO");
// }
+ /**
+ * Tests button "first". First it clicks the third item on the right and
+ * clicks the button. Then it verifies that the item was moved both in table
+ * and in toolbar.
+ */
@Test
public void testFirstButton() {
- // click 'Copy All' button
- selenium.click(leftButtons + "/div[1]");
+ String firstItemFromTable =
selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 1));
+ String firstItemFromToolbar =
selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 1));
+ String secondItemFromTable =
selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 2));
+ String secondItemFromToolbar =
selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 2));
+ String thirdItemFromTable =
selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 3));
+ String thirdItemFromToolbar =
selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 3));
- String firstItemFromTable = selenium.getText(rightTable +
"/tr[1]/td[2]");
- String firstItemFromToolbar = selenium.getText(toolbar + "/td[1]");
- String secondItemFromTable = selenium.getText(rightTable +
"/tr[2]/td[2]");
- String secondItemFromToolbar = selenium.getText(toolbar + "/td[3]");
- String thirdItemFromTable = selenium.getText(rightTable +
"/tr[3]/td[2]");
- String thirdItemFromToolbar = selenium.getText(toolbar + "/td[5]");
-
assertEquals(secondItemFromToolbar, secondItemFromTable,
"The second item in right table and toolbar should be the
same.");
- // click the third item in the right table
- selenium.click(rightTable + "/tr[3]");
- // click the 'First' button
- selenium.click(rightButtons + "/div[1]");
+ selenium.click(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 3));
+ selenium.click(LOC_FIRST_BUTTON);
// check items in the table
- String tmpString = selenium.getText(rightTable + "/tr[2]/td[2]");
+ String tmpString = selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED,
2));
assertEquals(tmpString, firstItemFromTable, "The first item from the table
should be now the second.");
- tmpString = selenium.getText(rightTable + "/tr[3]/td[2]");
+ tmpString = selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 3));
assertEquals(tmpString, secondItemFromTable, "The second item from the table
should be now the third.");
- tmpString = selenium.getText(rightTable + "/tr[1]/td[2]");
+ tmpString = selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 1));
assertEquals(tmpString, thirdItemFromTable, "The third item from the table
should be now the first.");
// check items in the toolbar
- tmpString = selenium.getText(toolbar + "/td[3]");
+ tmpString = selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 2));
assertEquals(tmpString, firstItemFromToolbar, "The first item from the
toolbar should be now the second.");
- tmpString = selenium.getText(toolbar + "/td[5]");
+ tmpString = selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 3));
assertEquals(tmpString, secondItemFromToolbar, "The second item from the
toolbar should be now the third.");
- tmpString = selenium.getText(toolbar + "/td[1]");
+ tmpString = selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 1));
assertEquals(tmpString, thirdItemFromToolbar, "The third item from the
toolbar should be now the first.");
}
+ /**
+ * Tests button "down".First it clicks the first item on the right and
+ * clicks the button. Then it verifies that the item was moved both in table
+ * and in toolbar.
+ */
@Test
public void testDownButton() {
- // click 'Copy All' button
- selenium.click(leftButtons + "/div[1]");
+ String firstItemFromTable =
selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 1));
+ String firstItemFromToolbar =
selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 1));
+ String secondItemFromTable =
selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 2));
+ String secondItemFromToolbar =
selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 2));
- String firstItemFromTable = selenium.getText(rightTable +
"/tr[1]/td[2]");
- String firstItemFromToolbar = selenium.getText(toolbar + "/td[1]");
- String secondItemFromTable = selenium.getText(rightTable +
"/tr[2]/td[2]");
- String secondItemFromToolbar = selenium.getText(toolbar + "/td[3]");
-
assertEquals(secondItemFromToolbar, secondItemFromTable,
"The second item in right table and toolbar should be the
same.");
- // click the first item in the right table
- selenium.click(rightTable + "/tr[1]");
- // click the 'Down' button
- selenium.click(rightButtons + "/div[5]");
+ selenium.click(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 1));
+ selenium.click(LOC_DOWN_BUTTON);
// check items in the table
- String tmpString = selenium.getText(rightTable + "/tr[1]/td[2]");
+ String tmpString = selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED,
1));
assertEquals(tmpString, secondItemFromTable, "The first and the second item
in the table should be swapped.");
- tmpString = selenium.getText(rightTable + "/tr[2]/td[2]");
+ tmpString = selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 2));
assertEquals(tmpString, firstItemFromTable, "The first and the second item
in the table should be swapped.");
// check items in the toolbar
- tmpString = selenium.getText(toolbar + "/td[1]");
+ tmpString = selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 1));
assertEquals(tmpString, secondItemFromToolbar,
"The first and the second item in the toolbar should be
swapped.");
- tmpString = selenium.getText(toolbar + "/td[3]");
+ tmpString = selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 2));
assertEquals(tmpString, firstItemFromToolbar, "The first and the second item
in the toolbar should be swapped.");
}
@@ -307,55 +299,73 @@
// fail("TODO");
// }
+ /**
+ * Tests the button "last". First it clicks the first item on the right
and
+ * clicks the button. Then it verifies that the item was moved both in table
+ * and in toolbar.
+ */
@Test
public void testLastButton() {
- // click 'Copy All' button
- selenium.click(leftButtons + "/div[1]");
+ String firstItemFromTable =
selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 1));
+ String firstItemFromToolbar =
selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 1));
+ String secondItemFromTable =
selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 2));
+ String secondItemFromToolbar =
selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 2));
+ String thirdItemFromTable =
selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 3));
+ String thirdItemFromToolbar =
selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 3));
- String firstItemFromTable = selenium.getText(rightTable +
"/tr[1]/td[2]");
- String firstItemFromToolbar = selenium.getText(toolbar + "/td[1]");
- String secondItemFromTable = selenium.getText(rightTable +
"/tr[2]/td[2]");
- String secondItemFromToolbar = selenium.getText(toolbar + "/td[3]");
- String thirdItemFromTable = selenium.getText(rightTable +
"/tr[3]/td[2]");
- String thirdItemFromToolbar = selenium.getText(toolbar + "/td[5]");
-
assertEquals(secondItemFromToolbar, secondItemFromTable,
"The second item in right table and toolbar should be the
same.");
- // click the first item in the right table
- selenium.click(rightTable + "/tr[1]");
- // click the 'Last' button
- selenium.click(rightButtons + "/div[7]");
+ selenium.click(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 1));
+ selenium.click(LOC_LAST_BUTTON);
// check items in the table
- String tmpString = selenium.getText(rightTable + "/tr[7]/td[2]");
+ String tmpString = selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED,
3));
assertEquals(tmpString, firstItemFromTable, "The first item from the table
should be now last.");
- tmpString = selenium.getText(rightTable + "/tr[1]/td[2]");
+ tmpString = selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 1));
assertEquals(tmpString, secondItemFromTable, "The second item from the table
should be now the first.");
- tmpString = selenium.getText(rightTable + "/tr[2]/td[2]");
+ tmpString = selenium.getText(format(LOC_RIGHT_TABLE_LINE_PREFORMATTED, 2));
assertEquals(tmpString, thirdItemFromTable, "The third item from the table
should be now the second.");
// check items in the toolbar
- tmpString = selenium.getText(toolbar + "/td[13]");
+ tmpString = selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 3));
assertEquals(tmpString, firstItemFromToolbar, "The first item from the
toolbar should be now last.");
- tmpString = selenium.getText(toolbar + "/td[1]");
+ tmpString = selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 1));
assertEquals(tmpString, secondItemFromToolbar, "The second item from the
toolbar should be now the first.");
- tmpString = selenium.getText(toolbar + "/td[3]");
+ tmpString = selenium.getText(format(LOC_TOOLBAR_ITEM_PREFORMATTED, 2));
assertEquals(tmpString, thirdItemFromToolbar, "The third item from the
toolbar should be now the second.");
}
+ /**
+ * 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 testListShuttleSource() {
- abstractTestSource(1, 1, "<", "ui:composition");
+ public void testExampleSource() {
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<rich:toolBar id=\"toolBar\"
itemSeparator=\"line\" height=\"28px\">",
+ "<c:forEach items=\"#{toolBar.items}\"
var=\"item\">", "<h:panelGroup>",
+ "<h:graphicImage value=\"#{item.iconURI}\"
styleClass=\"pic\" />",
+ "<h:outputLink value=\"#\"
style=\"color:#{a4jSkin.generalTextColor}; text-decoration:none;\" >",
+ "<rich:listShuttle
sourceValue=\"#{toolBar.freeItems}\"",
+ "targetValue=\"#{toolBar.items}\" var=\"items\"
listsHeight=\"150\"",
+ "sourceListWidth=\"130\" targetListWidth=\"130\"
sourceCaptionLabel=\"Available Items\"",
+ "targetCaptionLabel=\"Currently Active Items\"",
"converter=\"listShuttleconverter\"> ",
+ "<rich:column width=\"18\"> ",
"<h:graphicImage
value=\"#{items.iconURI}\"></h:graphicImage>",
+ "<h:outputText
value=\"#{items.label}\"></h:outputText>",
+ "<a4j:support event=\"onlistchanged\"
reRender=\"toolBar\" />",
+ "<a4j:support event=\"onorderchanged\"
reRender=\"toolBar\" />", };
+
+ abstractTestSource(1, "View Source", strings);
}
/**
* Loads the needed page.
*/
+ @SuppressWarnings("unused")
@BeforeMethod
private void loadPage() {
- super.loadPage("richSelect", 1, "listShuttle component allows to
select items using two lists");
openComponent("List Shuttle");
- scrollIntoView("//fieldset[1]/legend", true);
+ scrollIntoView(LOC_EXAMPLE_HEADER, true);
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/modalPanel/ModalPanelTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/modalPanel/ModalPanelTestCase.java 2009-09-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/modalPanel/ModalPanelTestCase.java 2009-09-10
15:46:40 UTC (rev 15532)
@@ -1,22 +1,23 @@
-/**
- * License Agreement.
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * JBoss RichFaces
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Copyright (C) 2009 Red Hat, Inc.
- *
- * This code is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this code; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
package org.jboss.richfaces.integrationTest.modalPanel;
@@ -37,230 +38,190 @@
*/
public class ModalPanelTestCase extends AbstractSeleniumRichfacesTestCase {
- // messages
- private final String MSG_COMPONENT_DESCRIPTION =
getMsg("COMPONENT_DESCRIPTION");
+ // messages
+ private final String MSG_FIRST_PANEL_HEADER =
getMsg("FIRST_PANEL_HEADER");
+ private final String MSG_FIRST_PANEL_CONTENT =
getMsg("FIRST_PANEL_CONTENT");
- private final String MSG_FIRST_PANEL_NOT_VISIBLE =
getMsg("FIRST_PANEL_NOT_VISIBLE");
- private final String MSG_FIRST_PANEL_VISIBLE = getMsg("FIRST_PANEL_VISIBLE");
- private final String MSG_FIRST_PANEL_WRONG_CONTENT =
getMsg("FIRST_PANEL_WRONG_CONTENT");
- private final String MSG_FIRST_PANEL_WRONG_HEADER =
getMsg("FIRST_PANEL_WRONG_HEADER");
+ private final String MSG_SECOND_PANEL_HEADER =
getMsg("SECOND_PANEL_HEADER");
+ private final String MSG_SECOND_PANEL_CONTENT =
getMsg("SECOND_PANEL_CONTENT");
- private final String MSG_SECOND_PANEL_NOT_VISIBLE =
getMsg("SECOND_PANEL_NOT_VISIBLE");
- private final String MSG_SECOND_PANEL_VISIBLE =
getMsg("SECOND_PANEL_VISIBLE");
- private final String MSG_SECOND_PANEL_WRONG_CONTENT =
getMsg("SECOND_PANEL_WRONG_CONTENT");
- private final String MSG_SECOND_PANEL_WRONG_HEADER =
getMsg("SECOND_PANEL_WRONG_HEADER");
+ // locators
+ private final String LOC_FIRST_EXAMPLE_HEADER =
getLoc("FIRST_EXAMPLE_HEADER");
+ private final String LOC_FIRST_PANEL = getLoc("FIRST_PANEL");
+ private final String LOC_FIRST_PANEL_POSITION =
getLoc("FIRST_PANEL_POSITION");
+ private final String LOC_FIRST_PANEL_OPEN = getLoc("FIRST_PANEL_OPEN");
+ private final String LOC_FIRST_PANEL_CLOSE = getLoc("FIRST_PANEL_CLOSE");
+ private final String LOC_FIRST_PANEL_HEADER =
getLoc("FIRST_PANEL_HEADER");
+ private final String LOC_FIRST_PANEL_CONTENT =
getLoc("FIRST_PANEL_CONTENT");
- // locators
- private final String LOC_FIRST_EXAMPLE_HEADER =
getLoc("FIRST_EXAMPLE_HEADER");
- private final String LOC_FIRST_PANEL = getLoc("FIRST_PANEL");
- private final String LOC_FIRST_PANEL_POSITION =
getLoc("FIRST_PANEL_POSITION");
- private final String LOC_FIRST_PANEL_OPEN = getLoc("FIRST_PANEL_OPEN");
- private final String LOC_FIRST_PANEL_CLOSE = getLoc("FIRST_PANEL_CLOSE");
- private final String LOC_FIRST_PANEL_HEADER = getLoc("FIRST_PANEL_HEADER");
- private final String LOC_FIRST_PANEL_CONTENT = getLoc("FIRST_PANEL_CONTENT");
+ private final String LOC_SECOND_EXAMPLE_HEADER =
getLoc("SECOND_EXAMPLE_HEADER");
+ private final String LOC_SECOND_PANEL = getLoc("SECOND_PANEL");
+ private final String LOC_SECOND_PANEL_POSITION =
getLoc("SECOND_PANEL_POSITION");
+ private final String LOC_SECOND_PANEL_OPEN = getLoc("SECOND_PANEL_OPEN");
+ private final String LOC_SECOND_PANEL_CLOSE =
getLoc("SECOND_PANEL_CLOSE");
+ private final String LOC_SECOND_PANEL_HEADER =
getLoc("SECOND_PANEL_HEADER");
+ private final String LOC_SECOND_PANEL_CONTENT =
getLoc("SECOND_PANEL_CONTENT");
- private final String LOC_SECOND_EXAMPLE_HEADER =
getLoc("SECOND_EXAMPLE_HEADER");
- private final String LOC_SECOND_PANEL = getLoc("SECOND_PANEL");
- private final String LOC_SECOND_PANEL_POSITION =
getLoc("SECOND_PANEL_POSITION");
- private final String LOC_SECOND_PANEL_OPEN = getLoc("SECOND_PANEL_OPEN");
- private final String LOC_SECOND_PANEL_CLOSE = getLoc("SECOND_PANEL_CLOSE");
- private final String LOC_SECOND_PANEL_HEADER = getLoc("SECOND_PANEL_HEADER");
- private final String LOC_SECOND_PANEL_CONTENT =
getLoc("SECOND_PANEL_CONTENT");
+ /**
+ * Tests the first panel. First it checks that the panel is invisible
+ * initially, then opens the panel and verifies it is visible. Then it
+ * checks the content of the panel's header and its content. In the end it
+ * closes the panel.
+ */
+ @Test
+ public void testFirstPanelOpenClose() {
+ scrollIntoView(LOC_FIRST_EXAMPLE_HEADER, true);
- /**
- * Tests the first panel. First it checks that the panel is invisible
- * initially, then opens the panel and verifies it is visible. Then it
- * checks the content of the panel's header and its content. In the end it
- * closes the panel.
- */
- @Test
- public void testFirstPanelOpenClose() {
- String tmp = selenium.getAttribute(LOC_FIRST_PANEL + "@style");
- assertFalse(!tmp.contains("display: none;"),
- MSG_FIRST_PANEL_NOT_VISIBLE);
-
- selenium.click(LOC_FIRST_PANEL_OPEN);
+ assertFalse(isDisplayed(LOC_FIRST_PANEL), "The first panel should not be
visible.");
- tmp = selenium.getAttribute(LOC_FIRST_PANEL + "@style");
- assertTrue(!tmp.contains("display: none;"), MSG_FIRST_PANEL_VISIBLE);
+ selenium.click(LOC_FIRST_PANEL_OPEN);
+ assertTrue(isDisplayed(LOC_FIRST_PANEL), "The first panel should be
visible.");
- tmp = selenium.getText(LOC_FIRST_PANEL_HEADER);
- assertEquals(tmp, "Modal Panel", MSG_FIRST_PANEL_WRONG_HEADER);
+ String tmp = selenium.getText(LOC_FIRST_PANEL_HEADER);
+ assertEquals(tmp, MSG_FIRST_PANEL_HEADER, "The header of the first panel is
wrong.");
+ tmp = selenium.getText(LOC_FIRST_PANEL_CONTENT);
+ assertEquals(tmp, MSG_FIRST_PANEL_CONTENT, "The content of the first panel
is wrong.");
- tmp = selenium.getText(LOC_FIRST_PANEL_CONTENT);
- assertEquals(
- tmp,
- "This panel is called using Component Control Component \n"
- + "Closure link (X) works also through Component Control",
- MSG_FIRST_PANEL_WRONG_CONTENT);
+ selenium.click(LOC_FIRST_PANEL_CLOSE);
+ assertFalse(isDisplayed(LOC_FIRST_PANEL), "The first panel should not be
visible.");
+ }
- selenium.click(LOC_FIRST_PANEL_CLOSE);
-
- tmp = selenium.getAttribute(LOC_FIRST_PANEL + "@style");
- assertFalse(!tmp.contains("display: none;"),
- MSG_FIRST_PANEL_NOT_VISIBLE);
- }
+ /**
+ * Tests moving the panel. It opens the panel, gets panel's position on the
+ * page, and moves it 20px right, 20px down. Then it verifies the position,
+ * closes the panel, and opens it again. Then it verifies that the panel is
+ * locatet on the new position.
+ */
+ @Test
+ public void testFirstPanelMove() {
+ scrollIntoView(LOC_FIRST_EXAMPLE_HEADER, true);
+ selenium.click(LOC_FIRST_PANEL_OPEN);
- /**
- * Tests moving the panel. It opens the panel, gets panel's position on the
- * page, and moves it 20px right, 20px down. Then it verifies the position,
- * closes the panel, and opens it again. Then it verifies that the panel is
- * locatet on the new position.
- */
- @Test
- public void testFirstPanelMove() {
- selenium.click(LOC_FIRST_PANEL_OPEN);
+ int firstX = Integer.parseInt(getStyle(LOC_FIRST_PANEL_POSITION,
"left").replace("px", ""));
+ int firstY = Integer.parseInt(getStyle(LOC_FIRST_PANEL_POSITION,
"top").replace("px", ""));
- int firstX = getPosition("left", LOC_FIRST_PANEL_POSITION);
- int firstY = getPosition("top", LOC_FIRST_PANEL_POSITION);
+ for (int i = 0; i < 40; i++) {
+ if (i % 2 == 0) {
+ selenium.dragAndDrop(LOC_FIRST_PANEL_HEADER, "+1,0");
+ } else {
+ selenium.dragAndDrop(LOC_FIRST_PANEL_HEADER, "0,+1");
+ }
+ }
- for (int i = 0; i < 40; i++) {
- if (i % 2 == 0) {
- selenium.dragAndDrop(LOC_FIRST_PANEL_HEADER, "+1,0");
- } else {
- selenium.dragAndDrop(LOC_FIRST_PANEL_HEADER, "0,+1");
- }
- }
+ int secondX = Integer.parseInt(getStyle(LOC_FIRST_PANEL_POSITION,
"left").replace("px", ""));
+ int secondY = Integer.parseInt(getStyle(LOC_FIRST_PANEL_POSITION,
"top").replace("px", ""));
- int secondX = getPosition("left", LOC_FIRST_PANEL_POSITION);
- int secondY = getPosition("top", LOC_FIRST_PANEL_POSITION);
+ assertEquals(secondX, firstX + 20, "Panel should move 20px right.");
+ assertEquals(secondY, firstY + 20, "Panel should move 20px down.");
- assertEquals(secondX, firstX + 20, "sdlkfj");
- assertEquals(secondY, firstY + 20, "skldfjsk");
+ selenium.click(LOC_FIRST_PANEL_CLOSE);
+ selenium.click(LOC_FIRST_PANEL_OPEN);
- selenium.click(LOC_FIRST_PANEL_CLOSE);
- selenium.click(LOC_FIRST_PANEL_OPEN);
+ int thirdX = Integer.parseInt(getStyle(LOC_FIRST_PANEL_POSITION,
"left").replace("px", ""));
+ int thirdY = Integer.parseInt(getStyle(LOC_FIRST_PANEL_POSITION,
"top").replace("px", ""));
- int thirdX = getPosition("left", LOC_FIRST_PANEL_POSITION);
- int thirdY = getPosition("top", LOC_FIRST_PANEL_POSITION);
+ assertEquals(thirdX, secondX, "Panel shouldn't move after closing and
opening.");
+ assertEquals(thirdY, secondY, "Panel shouldn't move after closing and
opening.");
+ }
- assertEquals(thirdX, secondX, "sdsdflkfj");
- assertEquals(thirdY, secondY, "skldfsdfjsk");
- }
+ /**
+ * Tests the second panel. First it checks that the panel is invisible
+ * initially, then opens the panel and verifies it is visible. Then it
+ * checks the content of the panel's header and its content. In the end it
+ * closes the panel.
+ */
+ @Test
+ public void testSecondPanelOpenClose() {
+ scrollIntoView(LOC_SECOND_EXAMPLE_HEADER, true);
+ assertFalse(isDisplayed(LOC_SECOND_PANEL), "The second panel should not be
visible.");
- /**
- * Tests the second panel. First it checks that the panel is invisible
- * initially, then opens the panel and verifies it is visible. Then it
- * checks the content of the panel's header and its content. In the end it
- * closes the panel.
- */
- @Test
- public void testSecondPanelOpenClose() {
- String tmp = selenium.getAttribute(LOC_SECOND_PANEL + "@style");
- assertFalse(!tmp.contains("display: none;"),
- MSG_SECOND_PANEL_NOT_VISIBLE);
+ selenium.click(LOC_SECOND_PANEL_OPEN);
+ assertTrue(isDisplayed(LOC_SECOND_PANEL), "The second panel should be
visible.");
- selenium.click(LOC_SECOND_PANEL_OPEN);
+ String tmp = selenium.getText(LOC_SECOND_PANEL_HEADER);
+ assertEquals(tmp, MSG_SECOND_PANEL_HEADER, "The header of the second panel
is wrong.");
- tmp = selenium.getAttribute(LOC_SECOND_PANEL + "@style");
- assertTrue(!tmp.contains("display: none;"), MSG_SECOND_PANEL_VISIBLE);
+ tmp = selenium.getText(LOC_SECOND_PANEL_CONTENT);
+ assertTrue(tmp.contains(MSG_SECOND_PANEL_CONTENT), "The content of the
second panel is wrong.");
- tmp = selenium.getText(LOC_SECOND_PANEL_HEADER);
- assertEquals(tmp, "Modal Panel Title", MSG_SECOND_PANEL_WRONG_HEADER);
+ selenium.click(LOC_SECOND_PANEL_CLOSE);
+ assertFalse(isDisplayed(LOC_SECOND_PANEL), "The second panel should not be
visible.");
+ }
- tmp = selenium.getText(LOC_SECOND_PANEL_CONTENT);
- assertTrue(tmp.contains("Any JSF content might be inside the panel."),
- MSG_SECOND_PANEL_WRONG_CONTENT);
+ /**
+ * Tests moving the panel. It opens the panel, gets panel's position on the
+ * page, and moves it 20px right, 20px down. Then it verifies the position,
+ * closes the panel, and opens it again. Then it verifies that the panel is
+ * locatet on the new position.
+ */
+ @Test
+ public void testSecondPanelMove() {
+ scrollIntoView(LOC_SECOND_EXAMPLE_HEADER, true);
+ selenium.click(LOC_SECOND_PANEL_OPEN);
- selenium.click(LOC_SECOND_PANEL_CLOSE);
+ int firstX = Integer.parseInt(getStyle(LOC_SECOND_PANEL_POSITION,
"left").replace("px", ""));
+ int firstY = Integer.parseInt(getStyle(LOC_SECOND_PANEL_POSITION,
"top").replace("px", ""));
- tmp = selenium.getAttribute(LOC_SECOND_PANEL + "@style");
- assertFalse(!tmp.contains("display: none;"),
- MSG_SECOND_PANEL_NOT_VISIBLE);
- }
+ for (int i = 0; i < 40; i++) {
+ if (i % 2 == 0) {
+ selenium.dragAndDrop(LOC_SECOND_PANEL_HEADER, "+1,0");
+ } else {
+ selenium.dragAndDrop(LOC_SECOND_PANEL_HEADER, "0,+1");
+ }
+ }
- /**
- * Tests moving the panel. It opens the panel, gets panel's position on the
- * page, and moves it 20px right, 20px down. Then it verifies the position,
- * closes the panel, and opens it again. Then it verifies that the panel is
- * locatet on the new position.
- */
- @Test
- public void testSecondPanelMove() {
- selenium.click(LOC_SECOND_PANEL_OPEN);
+ int secondX = Integer.parseInt(getStyle(LOC_SECOND_PANEL_POSITION,
"left").replace("px", ""));
+ int secondY = Integer.parseInt(getStyle(LOC_SECOND_PANEL_POSITION,
"top").replace("px", ""));
- int firstX = getPosition("left", LOC_SECOND_PANEL_POSITION);
- int firstY = getPosition("top", LOC_SECOND_PANEL_POSITION);
+ assertEquals(secondX, firstX + 20, "Panel should move 20px right.");
+ assertEquals(secondY, firstY + 20, "Panel should move 20px down.");
- for (int i = 0; i < 40; i++) {
- if (i % 2 == 0) {
- selenium.dragAndDrop(LOC_SECOND_PANEL_HEADER, "+1,0");
- } else {
- selenium.dragAndDrop(LOC_SECOND_PANEL_HEADER, "0,+1");
- }
- }
+ selenium.click(LOC_SECOND_PANEL_CLOSE);
+ selenium.click(LOC_SECOND_PANEL_OPEN);
- int secondX = getPosition("left", LOC_SECOND_PANEL_POSITION);
- int secondY = getPosition("top", LOC_SECOND_PANEL_POSITION);
+ int thirdX = Integer.parseInt(getStyle(LOC_SECOND_PANEL_POSITION,
"left").replace("px", ""));
+ int thirdY = Integer.parseInt(getStyle(LOC_SECOND_PANEL_POSITION,
"top").replace("px", ""));
- assertEquals(secondX, firstX + 20, "sdlkfj");
- assertEquals(secondY, firstY + 20, "skldfjsk");
+ assertEquals(thirdX, secondX, "Panel shouldn't move after closing and
opening.");
+ assertEquals(thirdY, secondY, "Panel shouldn't move after closing and
opening.");
+ }
- selenium.click(LOC_SECOND_PANEL_CLOSE);
- selenium.click(LOC_SECOND_PANEL_OPEN);
+ /**
+ * 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 testFirstSource() {
+ String[] strings = new String[] { "<rich:modalPanel
id=\"panel\" width=\"350\" height=\"100\">",
+ "<f:facet name=\"header\">",
+ "<h:graphicImage value=\"/images/modal/close.png\"
styleClass=\"hidelink\" id=\"hidelink\"/>",
+ "<h:outputText value=\"This panel is called using Component
Control Component\"></h:outputText>",
+ "<h:outputLink value=\"#\"
id=\"link\">", };
- int thirdX = getPosition("left", LOC_SECOND_PANEL_POSITION);
- int thirdY = getPosition("top", LOC_SECOND_PANEL_POSITION);
+ abstractTestSource(1, "View Source", strings);
+ }
- assertEquals(thirdX, secondX, "sdsdflkfj");
- assertEquals(thirdY, secondY, "skldfsdfjsk");
- }
+ /**
+ * 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 testSecondSource() {
+ String[] strings = new String[] { "function getRightTop(ref) {",
+ "<h:outputText value=\"Modal Panel Title\"
/>",
+ "<p>Any JSF content might be inside the panel. In case of
using ",
+ "<a href=\"#\"
onclick=\"#{rich:component('mp')}.hide()\">hide this
panel</a>:",
+
"<f:verbatim>#</f:verbatim>{rich:component('mp')}.hide()</p>",
};
- /**
- * 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 testFirstSource() {
- String [] strings = new String [] {
- "<rich:modalPanel id=\"panel\" width=\"350\"
height=\"100\">",
- "<f:facet name=\"header\">",
- "<h:graphicImage value=\"/images/modal/close.png\"
styleClass=\"hidelink\" id=\"hidelink\"/>",
- "<h:outputText value=\"This panel is called using Component
Control Component\"></h:outputText>",
- "<h:outputLink value=\"#\"
id=\"link\">",
- };
-
- abstractTestSource(1, "View Source", strings);
- }
+ abstractTestSource(2, "View Source", strings);
+ }
- /**
- * 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 testSecondSource() {
- String [] strings = new String [] {
- "function getRightTop(ref) {",
- "<h:outputText value=\"Modal Panel Title\" />",
- "<p>Any JSF content might be inside the panel. In case of using ",
- "<a href=\"#\"
onclick=\"#{rich:component('mp')}.hide()\">hide this
panel</a>:",
- "<f:verbatim>#</f:verbatim>{rich:component('mp')}.hide()</p>",
- };
-
- abstractTestSource(2, "View Source", strings);
- }
-
- /**
- * Returns one component of the position from the attribute "style".
- *
- * @param which
- * one of left, right, top, bottom
- * @param locator
- * locator of the style attribute
- * @return the value of the attribute in pixels
- */
- private int getPosition(String which, String locator) {
- String attr = selenium.getAttribute(locator);
- attr = attr.substring(attr.indexOf(which));
- attr = attr.substring(which.length() + 2, attr.indexOf("px;"));
- return Integer.parseInt(attr);
- }
-
- /**
- * Loads the page containing the calendar component.
- */
- @BeforeMethod
- private void loadPage() {
- openComponent("Modal Panel");
- }
+ /**
+ * Loads the page containing the calendar component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Modal Panel");
+ }
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/orderingList/OrderingListTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/orderingList/OrderingListTestCase.java 2009-09-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/orderingList/OrderingListTestCase.java 2009-09-10
15:46:40 UTC (rev 15532)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
package org.jboss.richfaces.integrationTest.orderingList;
import static org.testng.Assert.assertEquals;
@@ -9,475 +31,504 @@
import org.testng.annotations.Test;
/**
+ * Test case for ordering list.
*
- * <ul>
- * <li><b>TODO</b> check that the number of lines does not change on
Up, Down,
- * First, Last (+Ctrl/Shift)</li>
- * <li><b>TODO</b> check that all buttons are disabled if no lines
selected</li>
- * <li><b>TODO</b> refactor tests so that the common functionality is
in one
- * method</li>
- * </ul>
- *
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
+// TODO check that the number of lines does not change on Up, Down, First, Last
+// (+Ctrl/Shift)
+// TODO check that all buttons are disabled if no lines selected
+// TODO refactor tests so that the common functionality is in one method
public class OrderingListTestCase extends AbstractSeleniumRichfacesTestCase {
- private final String table =
"//fieldset[1]/div/form/table/tbody/tr/td[1]/div/table/tbody/tr[2]/td[1]/div/div[2]/table/tbody";
- private final String buttons =
"//fieldset[1]/div/form/table/tbody/tr/td[1]/div/table/tbody/tr[2]/td[2]/div";
- private final String selection =
"//fieldset[1]/div/form/table/tbody/tr/td[2]/div/div[2]";
+ // locators
+ private final String LOC_EXAMPLE_HEADER = getLoc("EXAMPLE_HEADER");
+ private final String LOC_TABLE_LINES = getLoc("TABLE_LINES");
+ private final String LOC_TABLE_LINE_PREFORMATTED =
getLoc("TABLE_LINE_PREFORMATTED");
+ private final String LOC_SELECTION = getLoc("SELECTION");
+ private final String LOC_SELECTION_PREFORMATTED =
getLoc("SELECTION_PREFORMATTED");
- @Test
- public void testOrderingList() {
- int count = selenium.getXpathCount(table + "/tr").intValue();
- assertTrue(count > 0, "There are no lines in the table.");
+ private final String LOC_BUTTON_FIRST = getLoc("BUTTON_FIRST");
+ private final String LOC_BUTTON_UP = getLoc("BUTTON_UP");
+ private final String LOC_BUTTON_DOWN = getLoc("BUTTON_DOWN");
+ private final String LOC_BUTTON_LAST = getLoc("BUTTON_LAST");
- waitFor(1000);
- String text = selenium.getText(selection);
- assertEquals(text, "No Songs Selected",
- "Selection should not contain any name of song.");
+ // messages
+ private final String MSG_ORDERING_LIST_SELECTION =
getMsg("ORDERING_LIST_SELECTION");
- }
+ /**
+ * Tests initial state of the ordering list.
+ */
+ @Test
+ public void testOrderingList() {
+ int count = selenium.getXpathCount(LOC_TABLE_LINES).intValue();
+ assertTrue(count > 0, "There are no lines in the table.");
- @Test
- public void testClickSingleFile() {
- selenium.click(table + "/tr[1]");
- String text = selenium.getText(table + "/tr[1]/td[1]");
+ waitFor(1000);
+ String text = selenium.getText(LOC_SELECTION);
+ assertEquals(text, MSG_ORDERING_LIST_SELECTION, "Selection should not
contain any name of song.");
+ }
- waitFor(1000);
- String text2 = selenium.getText(selection);
+ /**
+ * Tests clicking on a single line.
+ */
+ @Test
+ public void testClickSingleSong() {
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ String text = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 1));
- assertEquals(text2, text,
- "Selected song is not shown in the selection panel.");
- }
+ waitFor(1000);
+ String text2 = selenium.getText(LOC_SELECTION);
- @Test
- public void testClickMultipleFilesCtrl() {
- String[] fromTable = new String[3];
- String[] fromPanel = new String[3];
+ assertEquals(text2, text, "Selected song is not shown in the selection
panel.");
+ }
- // click lines nr. 1, 3, and 5 in the table
- selenium.click(table + "/tr[1]");
- selenium.controlKeyDown();
- selenium.click(table + "/tr[3]");
- selenium.click(table + "/tr[5]");
- selenium.controlKeyUp();
+ /**
+ * Tests clicking on multiple lines using Ctrl key.
+ */
+ @Test
+ public void testClickMultipleSongsCtrl() {
+ String[] fromTable = new String[3];
+ String[] fromPanel = new String[3];
- fromTable[0] = selenium.getText(table + "/tr[1]/td[1]");
- fromTable[1] = selenium.getText(table + "/tr[3]/td[1]");
- fromTable[2] = selenium.getText(table + "/tr[5]/td[1]");
+ // click lines nr. 1, 3, and 5 in the table
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ selenium.controlKeyDown();
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 3));
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 5));
+ selenium.controlKeyUp();
- waitFor(1000);
+ fromTable[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ fromTable[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 3));
+ fromTable[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 5));
- // get all selections from the panel on the right
- for (int i = 0; i < 3; i++) {
- fromPanel[i] = selenium.getText(selection + "/ul/li[" + (i + 1)
- + "]");
- }
+ waitFor(1000);
- assertEqualsNoOrder(fromPanel, fromTable,
- "Items chosen in table should be also in the right panel.");
- }
+ // get all selections from the panel on the right
+ for (int i = 0; i < 3; i++) {
+ fromPanel[i] = selenium.getText(format(LOC_SELECTION_PREFORMATTED, i + 1));
+ }
- @Test
- public void testClickMultipleFilesShift() {
- String[] fromTable = new String[3];
- String[] fromPanel = new String[3];
+ assertEqualsNoOrder(fromPanel, fromTable, "Items chosen in table should be
also in the right panel.");
+ }
- // click lines nr. 1 and 3 in the table
- selenium.click(table + "/tr[1]");
- selenium.shiftKeyDown();
- selenium.click(table + "/tr[3]");
- selenium.shiftKeyUp();
+ /**
+ * Tests clicking on multiple lines using Shift key.
+ */
+ @Test
+ public void testClickMultipleSongsShift() {
+ String[] fromTable = new String[3];
+ String[] fromPanel = new String[3];
- fromTable[0] = selenium.getText(table + "/tr[1]/td[1]");
- fromTable[1] = selenium.getText(table + "/tr[2]/td[1]");
- fromTable[2] = selenium.getText(table + "/tr[3]/td[1]");
+ // click lines nr. 1 and 3 in the table
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ selenium.shiftKeyDown();
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 3));
+ selenium.shiftKeyUp();
- waitFor(1000);
+ fromTable[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ fromTable[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 2));
+ fromTable[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 3));
- // get all selections from the panel on the right
- for (int i = 0; i < 3; i++) {
- fromPanel[i] = selenium.getText(selection + "/ul/li[" + (i + 1)
- + "]");
- }
+ waitFor(1000);
- assertEqualsNoOrder(fromPanel, fromTable,
- "Items chosen in table should be also in the right panel.");
- }
+ // get all selections from the panel on the right
+ for (int i = 0; i < 3; i++) {
+ fromPanel[i] = selenium.getText(format(LOC_SELECTION_PREFORMATTED, i + 1));
+ }
- @Test
- public void testUpSingleFile() {
- String[] before = new String[2];
- String[] after = new String[2];
+ assertEqualsNoOrder(fromPanel, fromTable, "Items chosen in table should be
also in the right panel.");
+ }
- before[0] = selenium.getText(table + "/tr[5]/td[1]");
- before[1] = selenium.getText(table + "/tr[6]/td[1]");
+ /**
+ * Tests the button up for a single song.
+ */
+ @Test
+ public void testUpSingleSong() {
+ String[] before = new String[2];
+ String[] after = new String[2];
- // click line nr. 6 in the table
- selenium.click(table + "/tr[6]");
- // click the 'Up' button
- selenium.click(buttons + "/div[3]");
+ before[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 5));
+ before[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 6));
- after[0] = selenium.getText(table + "/tr[5]/td[1]");
- after[1] = selenium.getText(table + "/tr[6]/td[1]");
+ // click line nr. 6 in the table
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ // click the 'Up' button
+ selenium.click(LOC_BUTTON_UP);
- assertEquals(after[0], before[1], "The sixth line should be now fifth.");
- assertEquals(after[1], before[0], "The fifth line should be now sixth.");
- }
+ after[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 5));
+ after[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 6));
- @Test
- public void testUpMultipleFilesShift() {
- String[] before = new String[3];
- String[] after = new String[3];
+ assertEquals(after[0], before[1], "The sixth line should be now
fifth.");
+ assertEquals(after[1], before[0], "The fifth line should be now
sixth.");
+ }
- before[0] = selenium.getText(table + "/tr[5]/td[1]");
- before[1] = selenium.getText(table + "/tr[6]/td[1]");
- before[2] = selenium.getText(table + "/tr[7]/td[1]");
+ /**
+ * Tests the button up for multiple songs selected using Shift key.
+ */
+ @Test
+ public void testUpMultipleSongsShift() {
+ String[] before = new String[3];
+ String[] after = new String[3];
- // click line nr. 6 and 7 in the table
- selenium.click(table + "/tr[6]");
- selenium.shiftKeyDown();
- selenium.click(table + "/tr[7]");
- selenium.shiftKeyUp();
+ before[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 5));
+ before[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ before[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 7));
- // click the 'Up' button (5,6,7 -> 6,7,5)
- selenium.click(buttons + "/div[3]");
+ // click line nr. 6 and 7 in the table
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ selenium.shiftKeyDown();
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 7));
+ selenium.shiftKeyUp();
- after[0] = selenium.getText(table + "/tr[5]/td[1]");
- after[1] = selenium.getText(table + "/tr[6]/td[1]");
- after[2] = selenium.getText(table + "/tr[7]/td[1]");
+ // click the 'Up' button (5,6,7 -> 6,7,5)
+ selenium.click(LOC_BUTTON_UP);
- assertEquals(after[0], before[1], "The sixth line should be now fifth.");
- assertEquals(after[1], before[2],
- "The seventh line should be now sixth.");
- assertEquals(after[2], before[0],
- "The fifth line should be now seventh.");
- }
+ after[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 5));
+ after[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ after[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 7));
- @Test
- public void testUpMultipleFilesCtrl() {
- String[] before = new String[3];
- String[] after = new String[3];
+ assertEquals(after[0], before[1], "The sixth line should be now
fifth.");
+ assertEquals(after[1], before[2], "The seventh line should be now
sixth.");
+ assertEquals(after[2], before[0], "The fifth line should be now
seventh.");
+ }
- before[0] = selenium.getText(table + "/tr[5]/td[1]");
- before[1] = selenium.getText(table + "/tr[6]/td[1]");
- before[2] = selenium.getText(table + "/tr[7]/td[1]");
+ /**
+ * Tests the button up for multiple songs selected using Ctrl key.
+ */
+ @Test
+ public void testUpMultipleSongsCtrl() {
+ String[] before = new String[3];
+ String[] after = new String[3];
- // click line nr. 6 and 7 in the table
- selenium.click(table + "/tr[6]");
- selenium.controlKeyDown();
- selenium.click(table + "/tr[7]");
- selenium.controlKeyUp();
+ before[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 5));
+ before[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ before[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 7));
- // click the 'Up' button (5,6,7 -> 6,7,5)
- selenium.click(buttons + "/div[3]");
+ // click line nr. 6 and 7 in the table
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ selenium.controlKeyDown();
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 7));
+ selenium.controlKeyUp();
- after[0] = selenium.getText(table + "/tr[5]/td[1]");
- after[1] = selenium.getText(table + "/tr[6]/td[1]");
- after[2] = selenium.getText(table + "/tr[7]/td[1]");
+ // click the 'Up' button (5,6,7 -> 6,7,5)
+ selenium.click(LOC_BUTTON_UP);
- assertEquals(after[0], before[1], "The sixth line should be now fifth.");
- assertEquals(after[1], before[2],
- "The seventh line should be now sixth.");
- assertEquals(after[2], before[0],
- "The fifth line should be now seventh.");
- }
+ after[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 5));
+ after[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ after[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 7));
- @Test
- public void testDownSingleFile() {
- String[] before = new String[2];
- String[] after = new String[2];
+ assertEquals(after[0], before[1], "The sixth line should be now
fifth.");
+ assertEquals(after[1], before[2], "The seventh line should be now
sixth.");
+ assertEquals(after[2], before[0], "The fifth line should be now
seventh.");
+ }
- before[0] = selenium.getText(table + "/tr[6]/td[1]");
- before[1] = selenium.getText(table + "/tr[7]/td[1]");
+ /**
+ * Tests the button down for a single song.
+ */
+ @Test
+ public void testDownSingleSong() {
+ String[] before = new String[2];
+ String[] after = new String[2];
- // click line nr. 6 in the table
- selenium.click(table + "/tr[6]");
- // click the 'Up' button
- selenium.click(buttons + "/div[5]");
+ before[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ before[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 7));
- after[0] = selenium.getText(table + "/tr[6]/td[1]");
- after[1] = selenium.getText(table + "/tr[7]/td[1]");
+ // click line nr. 6 in the table
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ // click the 'Down' button
+ selenium.click(LOC_BUTTON_DOWN);
- assertEquals(after[0], before[1],
- "The sixth line should be now seventh.");
- assertEquals(after[1], before[0],
- "The seventh line should be now sixth.");
- }
+ after[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ after[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 7));
- @Test
- public void testDownMultipleFilesShift() {
- String[] before = new String[3];
- String[] after = new String[3];
+ assertEquals(after[0], before[1], "The sixth line should be now
seventh.");
+ assertEquals(after[1], before[0], "The seventh line should be now
sixth.");
+ }
- before[0] = selenium.getText(table + "/tr[5]/td[1]");
- before[1] = selenium.getText(table + "/tr[6]/td[1]");
- before[2] = selenium.getText(table + "/tr[7]/td[1]");
+ /**
+ * Tests the button down for multiple songs selected using Shift key.
+ */
+ @Test
+ public void testDownMultipleSongsShift() {
+ String[] before = new String[3];
+ String[] after = new String[3];
- // click line nr. 5 and 6 in the table
- selenium.click(table + "/tr[5]");
- selenium.shiftKeyDown();
- selenium.click(table + "/tr[6]");
- selenium.shiftKeyUp();
+ before[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 5));
+ before[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ before[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 7));
- // click the 'Up' button (5,6,7 -> 7,5,6)
- selenium.click(buttons + "/div[5]");
+ // click line nr. 5 and 6 in the table
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 5));
+ selenium.shiftKeyDown();
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ selenium.shiftKeyUp();
- after[0] = selenium.getText(table + "/tr[5]/td[1]");
- after[1] = selenium.getText(table + "/tr[6]/td[1]");
- after[2] = selenium.getText(table + "/tr[7]/td[1]");
+ // click the 'Down' button (5,6,7 -> 7,5,6)
+ selenium.click(LOC_BUTTON_DOWN);
- assertEquals(after[0], before[2],
- "The seventh line should be now fifth.");
- assertEquals(after[1], before[0], "The fifth line should be now sixth.");
- assertEquals(after[2], before[1],
- "The sixth line should be now seventh.");
- }
+ after[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 5));
+ after[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ after[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 7));
- @Test
- public void testDownMultipleFilesCtrl() {
- String[] before = new String[3];
- String[] after = new String[3];
+ assertEquals(after[0], before[2], "The seventh line should be now
fifth.");
+ assertEquals(after[1], before[0], "The fifth line should be now
sixth.");
+ assertEquals(after[2], before[1], "The sixth line should be now
seventh.");
+ }
- before[0] = selenium.getText(table + "/tr[5]/td[1]");
- before[1] = selenium.getText(table + "/tr[6]/td[1]");
- before[2] = selenium.getText(table + "/tr[7]/td[1]");
+ /**
+ * Tests the button down for multiple songs selected using Ctrl key.
+ */
+ @Test
+ public void testDownMultipleSongsCtrl() {
+ String[] before = new String[3];
+ String[] after = new String[3];
- // click line nr. 5 and 6 in the table
- selenium.click(table + "/tr[5]");
- selenium.controlKeyDown();
- selenium.click(table + "/tr[6]");
- selenium.controlKeyUp();
+ before[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 5));
+ before[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ before[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 7));
- // click the 'Up' button (5,6,7 -> 7,5,6)
- selenium.click(buttons + "/div[5]");
+ // click line nr. 5 and 6 in the table
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 5));
+ selenium.controlKeyDown();
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ selenium.controlKeyUp();
- after[0] = selenium.getText(table + "/tr[5]/td[1]");
- after[1] = selenium.getText(table + "/tr[6]/td[1]");
- after[2] = selenium.getText(table + "/tr[7]/td[1]");
+ // click the 'Down' button (5,6,7 -> 7,5,6)
+ selenium.click(LOC_BUTTON_DOWN);
- assertEquals(after[0], before[2],
- "The seventh line should be now fifth.");
- assertEquals(after[1], before[0], "The fifth line should be now sixth.");
- assertEquals(after[2], before[1],
- "The sixth line should be now seventh.");
- }
+ after[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 5));
+ after[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 6));
+ after[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 7));
- @Test
- public void testLastSingleFile() {
- String[] before = new String[3];
- String[] after = new String[3];
- int countOfLines = selenium.getXpathCount(table + "/tr").intValue();
+ assertEquals(after[0], before[2], "The seventh line should be now
fifth.");
+ assertEquals(after[1], before[0], "The fifth line should be now
sixth.");
+ assertEquals(after[2], before[1], "The sixth line should be now
seventh.");
+ }
- before[0] = selenium.getText(table + "/tr[1]/td[1]");
- before[1] = selenium.getText(table + "/tr[2]/td[1]");
- before[2] = selenium.getText(table + "/tr[" + countOfLines +
"]/td[1]");
+ /**
+ * Tests the button last for a single song.
+ */
+ @Test
+ public void testLastSingleSong() {
+ String[] before = new String[3];
+ String[] after = new String[3];
+ int countOfLines = selenium.getXpathCount(LOC_TABLE_LINES).intValue();
- // click line nr. 1 in the table
- selenium.click(table + "/tr[1]");
- // click the 'Last' button (1,2,..,last-1,last --> 2,..,last,1)
- selenium.click(buttons + "/div[7]");
+ before[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ before[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 2));
+ before[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines));
- after[0] = selenium.getText(table + "/tr[1]/td[1]");
- after[1] = selenium.getText(table + "/tr[" + (countOfLines - 1)
- + "]/td[1]");
- after[2] = selenium.getText(table + "/tr[" + countOfLines +
"]/td[1]");
+ // click line nr. 1 in the table
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ // click the 'Last' button (1,2,..,last-1,last --> 2,..,last,1)
+ selenium.click(LOC_BUTTON_LAST);
- assertEquals(after[0], before[1],
- "The second line should be now first.");
- assertEquals(after[1], before[2],
- "The last line should be now last but one.");
- assertEquals(after[2], before[0], "The first line should be now last.");
- }
+ after[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ after[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines -
1));
+ after[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines));
- @Test
- public void testLastMultipleFilesShift() {
- String[] before = new String[4];
- String[] after = new String[4];
- int countOfLines = selenium.getXpathCount(table + "/tr").intValue();
+ assertEquals(after[0], before[1], "The second line should be now
first.");
+ assertEquals(after[1], before[2], "The last line should be now last but
one.");
+ assertEquals(after[2], before[0], "The first line should be now
last.");
+ }
- before[0] = selenium.getText(table + "/tr[1]/td[1]");
- before[1] = selenium.getText(table + "/tr[2]/td[1]");
- before[2] = selenium.getText(table + "/tr[3]/td[1]");
- before[3] = selenium.getText(table + "/tr[" + countOfLines +
"]/td[1]");
+ /**
+ * Tests the button last for multiple songs selected using Shift key.
+ */
+ @Test
+ public void testLastMultipleSongsShift() {
+ String[] before = new String[4];
+ String[] after = new String[4];
+ int countOfLines = selenium.getXpathCount(LOC_TABLE_LINES).intValue();
- // click line nr. 1 and 2 in the table
- selenium.click(table + "/tr[1]");
- selenium.shiftKeyDown();
- selenium.click(table + "/tr[2]");
- selenium.shiftKeyUp();
+ before[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ before[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 2));
+ before[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 3));
+ before[3] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines));
- // click the 'Last' button (1,2,3,..,last --> 3,..,last,1,2)
- selenium.click(buttons + "/div[7]");
+ // click line nr. 1 and 2 in the table
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ selenium.shiftKeyDown();
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 2));
+ selenium.shiftKeyUp();
- after[0] = selenium.getText(table + "/tr[1]/td[1]");
- after[1] = selenium.getText(table + "/tr[" + (countOfLines - 2)
- + "]/td[1]");
- after[2] = selenium.getText(table + "/tr[" + (countOfLines - 1)
- + "]/td[1]");
- after[3] = selenium.getText(table + "/tr[" + countOfLines +
"]/td[1]");
+ // click the 'Last' button (1,2,3,..,last --> 3,..,last,1,2)
+ selenium.click(LOC_BUTTON_LAST);
- assertEquals(after[0], before[2], "The third line should be now first.");
- assertEquals(after[1], before[3],
- "The last line should be now last but two.");
- assertEquals(after[2], before[0],
- "The first line should be now last but one.");
- assertEquals(after[3], before[1], "The second line should be now last.");
- }
+ after[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ after[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines -
2));
+ after[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines -
1));
+ after[3] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines));
- @Test
- public void testLastMultipleFilesCtrl() {
- String[] before = new String[4];
- String[] after = new String[4];
- int countOfLines = selenium.getXpathCount(table + "/tr").intValue();
+ assertEquals(after[0], before[2], "The third line should be now
first.");
+ assertEquals(after[1], before[3], "The last line should be now last but
two.");
+ assertEquals(after[2], before[0], "The first line should be now last but
one.");
+ assertEquals(after[3], before[1], "The second line should be now
last.");
+ }
- before[0] = selenium.getText(table + "/tr[1]/td[1]");
- before[1] = selenium.getText(table + "/tr[2]/td[1]");
- before[2] = selenium.getText(table + "/tr[3]/td[1]");
- before[3] = selenium.getText(table + "/tr[" + countOfLines +
"]/td[1]");
+ /**
+ * Tests the button last for multiple songs selected using Ctrl key.
+ */
+ @Test
+ public void testLastMultipleSongsCtrl() {
+ String[] before = new String[4];
+ String[] after = new String[4];
+ int countOfLines = selenium.getXpathCount(LOC_TABLE_LINES).intValue();
- // click line nr. 1 and 2 in the table
- selenium.click(table + "/tr[1]");
- selenium.controlKeyDown();
- selenium.click(table + "/tr[2]");
- selenium.controlKeyUp();
+ before[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ before[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 2));
+ before[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 3));
+ before[3] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines));
- // click the 'Last' button (1,2,3,..,last --> 3,..,last,1,2)
- selenium.click(buttons + "/div[7]");
+ // click line nr. 1 and 2 in the table
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ selenium.controlKeyDown();
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, 2));
+ selenium.controlKeyUp();
- after[0] = selenium.getText(table + "/tr[1]/td[1]");
- after[1] = selenium.getText(table + "/tr[" + (countOfLines - 2)
- + "]/td[1]");
- after[2] = selenium.getText(table + "/tr[" + (countOfLines - 1)
- + "]/td[1]");
- after[3] = selenium.getText(table + "/tr[" + countOfLines +
"]/td[1]");
+ // click the 'Last' button (1,2,3,..,last --> 3,..,last,1,2)
+ selenium.click(LOC_BUTTON_LAST);
- assertEquals(after[0], before[2], "The third line should be now first.");
- assertEquals(after[1], before[3],
- "The last line should be now last but two.");
- assertEquals(after[2], before[0],
- "The first line should be now last but one.");
- assertEquals(after[3], before[1], "The second line should be now last.");
- }
+ after[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ after[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines -
2));
+ after[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines -
1));
+ after[3] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines));
- @Test
- public void testFirstSingleFile() {
- String[] before = new String[3];
- String[] after = new String[3];
- int countOfLines = selenium.getXpathCount(table + "/tr").intValue();
+ assertEquals(after[0], before[2], "The third line should be now
first.");
+ assertEquals(after[1], before[3], "The last line should be now last but
two.");
+ assertEquals(after[2], before[0], "The first line should be now last but
one.");
+ assertEquals(after[3], before[1], "The second line should be now
last.");
+ }
- before[0] = selenium.getText(table + "/tr[1]/td[1]");
- before[1] = selenium.getText(table + "/tr[" + (countOfLines - 1)
- + "]/td[1]");
- before[2] = selenium.getText(table + "/tr[" + countOfLines +
"]/td[1]");
+ /**
+ * Tests the button first for a single song.
+ */
+ @Test
+ public void testFirstSingleSong() {
+ String[] before = new String[3];
+ String[] after = new String[3];
+ int countOfLines = selenium.getXpathCount(LOC_TABLE_LINES).intValue();
- // click the last line in the table
- selenium.click(table + "/tr[" + countOfLines + "]");
- // click the 'First' button (1...last-1,last --> last,1...last-1)
- selenium.click(buttons + "/div[1]");
+ before[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ before[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines -
1));
+ before[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines));
- after[0] = selenium.getText(table + "/tr[1]/td[1]");
- after[1] = selenium.getText(table + "/tr[2]/td[1]");
- after[2] = selenium.getText(table + "/tr[" + countOfLines +
"]/td[1]");
+ // click the last line in the table
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines));
+ // click the 'First' button (1...last-1,last --> last,1...last-1)
+ selenium.click(LOC_BUTTON_FIRST);
- assertEquals(after[0], before[2],
- "The second line should be now first.");
- assertEquals(after[1], before[0],
- "The first line should be now second.");
- assertEquals(after[2], before[1],
- "The last but one line should be now last.");
- }
+ after[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ after[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 2));
+ after[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines));
- @Test
- public void testFirstMultipleFilesShift() {
- String[] before = new String[4];
- String[] after = new String[4];
- int countOfLines = selenium.getXpathCount(table + "/tr").intValue();
+ assertEquals(after[0], before[2], "The second line should be now
first.");
+ assertEquals(after[1], before[0], "The first line should be now
second.");
+ assertEquals(after[2], before[1], "The last but one line should be now
last.");
+ }
- before[0] = selenium.getText(table + "/tr[1]/td[1]");
- before[1] = selenium.getText(table + "/tr[" + (countOfLines - 2)
- + "]/td[1]");
- before[2] = selenium.getText(table + "/tr[" + (countOfLines - 1)
- + "]/td[1]");
- before[3] = selenium.getText(table + "/tr[" + countOfLines +
"]/td[1]");
+ /**
+ * Tests the button first for multiple songs selected using Shift key.
+ */
+ @Test
+ public void testFirstMultipleSongsShift() {
+ String[] before = new String[4];
+ String[] after = new String[4];
+ int countOfLines = selenium.getXpathCount(LOC_TABLE_LINES).intValue();
- // click last 2 lines in the table
- selenium.click(table + "/tr[" + (countOfLines - 1) + "]");
- selenium.shiftKeyDown();
- selenium.click(table + "/tr[" + countOfLines + "]");
- selenium.shiftKeyUp();
+ before[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ before[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines -
2));
+ before[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines -
1));
+ before[3] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines));
- // click the 'First' button (1...last-2,last-1,last -->
- // last-1,last,1...last-2)
- selenium.click(buttons + "/div[1]");
+ // click last 2 lines in the table
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines - 1));
+ selenium.shiftKeyDown();
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines));
+ selenium.shiftKeyUp();
- after[0] = selenium.getText(table + "/tr[1]/td[1]");
- after[1] = selenium.getText(table + "/tr[2]/td[1]");
- after[2] = selenium.getText(table + "/tr[3]/td[1]");
- after[3] = selenium.getText(table + "/tr[" + countOfLines +
"]/td[1]");
+ // click the 'First' button (1...last-2,last-1,last -->
+ // last-1,last,1...last-2)
+ selenium.click(LOC_BUTTON_FIRST);
- assertEquals(after[0], before[2],
- "The last but one line should be now first.");
- assertEquals(after[1], before[3], "The last line should be now second.");
- assertEquals(after[2], before[0], "The first line should be now third.");
- assertEquals(after[3], before[1],
- "The last but two line should be now last.");
- }
+ after[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ after[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 2));
+ after[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 3));
+ after[3] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines));
- @Test
- public void testFirstMultipleFilesCtrl() {
- String[] before = new String[4];
- String[] after = new String[4];
- int countOfLines = selenium.getXpathCount(table + "/tr").intValue();
+ assertEquals(after[0], before[2], "The last but one line should be now
first.");
+ assertEquals(after[1], before[3], "The last line should be now
second.");
+ assertEquals(after[2], before[0], "The first line should be now
third.");
+ assertEquals(after[3], before[1], "The last but two line should be now
last.");
+ }
- before[0] = selenium.getText(table + "/tr[1]/td[1]");
- before[1] = selenium.getText(table + "/tr[" + (countOfLines - 2)
- + "]/td[1]");
- before[2] = selenium.getText(table + "/tr[" + (countOfLines - 1)
- + "]/td[1]");
- before[3] = selenium.getText(table + "/tr[" + countOfLines +
"]/td[1]");
+ /**
+ * Tests the button first for multiple songs selected using Ctrl key.
+ */
+ @Test
+ public void testFirstMultipleSongsCtrl() {
+ String[] before = new String[4];
+ String[] after = new String[4];
+ int countOfLines = selenium.getXpathCount(LOC_TABLE_LINES).intValue();
- // click last 2 lines in the table
- selenium.click(table + "/tr[" + (countOfLines - 1) + "]");
- selenium.controlKeyDown();
- selenium.click(table + "/tr[" + countOfLines + "]");
- selenium.controlKeyUp();
+ before[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ before[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines -
2));
+ before[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines -
1));
+ before[3] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines));
- // click the 'First' button (1...last-2,last-1,last -->
- // last-1,last,1...last-2)
- selenium.click(buttons + "/div[1]");
+ // click last 2 lines in the table
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines - 1));
+ selenium.controlKeyDown();
+ selenium.click(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines));
+ selenium.controlKeyUp();
- after[0] = selenium.getText(table + "/tr[1]/td[1]");
- after[1] = selenium.getText(table + "/tr[2]/td[1]");
- after[2] = selenium.getText(table + "/tr[3]/td[1]");
- after[3] = selenium.getText(table + "/tr[" + countOfLines +
"]/td[1]");
+ // click the 'First' button (1...last-2,last-1,last -->
+ // last-1,last,1...last-2)
+ selenium.click(LOC_BUTTON_FIRST);
- assertEquals(after[0], before[2],
- "The last but one line should be now first.");
- assertEquals(after[1], before[3], "The last line should be now second.");
- assertEquals(after[2], before[0], "The first line should be now third.");
- assertEquals(after[3], before[1],
- "The last but two line should be now last.");
- }
+ after[0] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 1));
+ after[1] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 2));
+ after[2] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, 3));
+ after[3] = selenium.getText(format(LOC_TABLE_LINE_PREFORMATTED, countOfLines));
- @Test
- public void testOrderingListSource() {
- abstractTestSource(1, 1, "<", "ui:composition");
- }
+ assertEquals(after[0], before[2], "The last but one line should be now
first.");
+ assertEquals(after[1], before[3], "The last line should be now
second.");
+ assertEquals(after[2], before[0], "The first line should be now
third.");
+ assertEquals(after[3], before[1], "The last but two line should be now
last.");
+ }
- /**
- * Loads the needed page and makes us sure that no lines are selected.
- */
- @BeforeMethod
- private void loadPage() {
- super.loadPage("richSelect", 2,
- "orderingList component allows to reorder items in a list.");
+ /**
+ * 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 testExampleSource() {
+ String[] strings = new String[] {
+ "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<h:panelGrid columns=\"2\" columnClasses=\"top
70per, top 30per\" width=\"100%\">",
+ "<rich:orderingList value=\"#{library.songsList}\"
var=\"lib\" listHeight=\"300\" listWidth=\"350\"
converter=\"orderingListConverter\"
selection=\"#{library.selectedSongsSet}\">",
+ " <rich:column width=\"180\">",
+ "<f:facet name=\"header\">",
+ "<h:outputText
value=\"#{lib.title}\"></h:outputText>",
+ " <a4j:support event=\"onclick\"
ignoreDupResponses=\"true\" requestDelay=\"500\"
action=\"#{library.takeSelection}\" reRender=\"output\"/>",
+ "<a4j:support event=\"onkeyup\"
ignoreDupResponses=\"true\" requestDelay=\"500\"
action=\"#{library.takeSelection}\" reRender=\"output\"/>",
+ "<rich:panel id=\"output\" header=\"Current
Selection\" style=\"width:200px\">",
+ "<rich:dataList value=\"#{library.selectedSongsList}\"
var=\"song\" rendered=\"#{not empty
library.selectedSongsList}\">",
+ "<h:outputText
value=\"#{song.title}\"></h:outputText>",
+ "<h:outputText value=\"No Songs Selected\"
rendered=\"#{empty library.selectedSongsList}\"/>", };
- // ensure that no lines will be selected
- selenium.click(table + "/tr[1]");
- selenium.controlKeyDown();
- selenium.click(table + "/tr[1]");
- selenium.controlKeyUp();
- }
+ abstractTestSource(1, "View Source", strings);
+ }
+
+ /**
+ * Loads the page containing needed component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Ordering List");
+ scrollIntoView(LOC_EXAMPLE_HEADER, true);
+ }
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/paint2d/Paint2DTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/paint2d/Paint2DTestCase.java 2009-09-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/paint2d/Paint2DTestCase.java 2009-09-10
15:46:40 UTC (rev 15532)
@@ -1,22 +1,23 @@
-/**
- * License Agreement.
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * JBoss RichFaces
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Copyright (C) 2009 Red Hat, Inc.
- *
- * This code is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this code; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
package org.jboss.richfaces.integrationTest.paint2d;
@@ -25,7 +26,6 @@
import static org.testng.Assert.fail;
import java.io.IOException;
-import java.security.NoSuchAlgorithmException;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
import org.jboss.test.selenium.utils.URLUtils;
@@ -41,12 +41,38 @@
public class Paint2DTestCase extends AbstractSeleniumRichfacesTestCase {
// messages
- private final String MSG_TEXT_IN_IMAGE = getMsg("TEXT_IN_IMAGE");
- private final String MSG_COLOR_OF_IMAGE = getMsg("COLOR_OF_IMAGE");
- private final String MSG_SHADOW_SIZE = getMsg("SHADOW_SIZE");
- private final String MSG_POSITION_OF_SLIDERS_HANDLE =
getMsg("POSITION_OF_SLIDERS_HANDLE");
- private final String MSG_IMAGE_HASH = getMsg("IMAGE_HASH");
+ private final String MSG_INITIAL_STATE_INPUT_TEXT =
getMsg("INITIAL_STATE_INPUT_TEXT");
+ private final String MSG_INITIAL_STATE_INPUT_COLOR =
getMsg("INITIAL_STATE_INPUT_COLOR");
+ private final int MSG_INITIAL_STATE_SHADOW_SLIDER_HANDLE = Integer
+ .parseInt(getMsg("INITIAL_STATE_SHADOW_SLIDER_HANDLE"));
+ private final String MSG_INITIAL_STATE_HASH =
getMsg("INITIAL_STATE_HASH");
+ private final String MSG_CHANGE_TEXT_HASH_1 =
getMsg("CHANGE_TEXT_HASH_1");
+ private final String MSG_CHANGE_TEXT_HASH_2 =
getMsg("CHANGE_TEXT_HASH_2");
+
+ private final String MSG_CHANGE_COLOR_HASH_1 =
getMsg("CHANGE_COLOR_HASH_1");
+ private final String MSG_CHANGE_COLOR_HASH_2 =
getMsg("CHANGE_COLOR_HASH_2");
+
+ private final int MSG_CHANGE_SHADOW_SLIDER_HANDLE_1 =
Integer.parseInt(getMsg("CHANGE_SHADOW_SLIDER_HANDLE_1"));
+ private final int MSG_CHANGE_SHADOW_SLIDER_HANDLE_2 =
Integer.parseInt(getMsg("CHANGE_SHADOW_SLIDER_HANDLE_2"));
+ private final int MSG_CHANGE_SHADOW_SLIDER_HANDLE_3 =
Integer.parseInt(getMsg("CHANGE_SHADOW_SLIDER_HANDLE_3"));
+ private final String MSG_CHANGE_SHADOW_HASH_1 =
getMsg("CHANGE_SHADOW_HASH_1");
+ private final String MSG_CHANGE_SHADOW_HASH_2 =
getMsg("CHANGE_SHADOW_HASH_2");
+ private final String MSG_CHANGE_SHADOW_HASH_3 =
getMsg("CHANGE_SHADOW_HASH_3");
+
+ private final String MSG_CHANGE_TEXT_AND_COLOR_HASH =
getMsg("CHANGE_TEXT_AND_COLOR_HASH");
+
+ private final String MSG_CHANGE_TEXT_AND_SHADOW_HASH =
getMsg("CHANGE_TEXT_AND_SHADOW_HASH");
+ private final int MSG_CHANGE_TEXT_AND_SHADOW_SLIDER_HANDLE = Integer
+ .parseInt(getMsg("CHANGE_TEXT_AND_SHADOW_SLIDER_HANDLE"));
+
+ private final int MSG_CHANGE_COLOR_AND_SHADOW_SLIDER_HANDLE = Integer
+ .parseInt(getMsg("CHANGE_COLOR_AND_SHADOW_SLIDER_HANDLE"));
+ private final String MSG_CHANGE_COLOR_AND_SHADOW_HASH =
getMsg("CHANGE_COLOR_AND_SHADOW_HASH");
+
+ private final int MSG_CHANGE_ALL_SLIDER_HANDLE =
Integer.parseInt(getMsg("CHANGE_ALL_SLIDER_HANDLE"));
+ private final String MSG_CHANGE_ALL_HASH = getMsg("CHANGE_ALL_HASH");
+
// locators
private final String LOC_EXAMPLE_HEADER = getLoc("EXAMPLE_HEADER");
private final String LOC_INPUT_TEXT = getLoc("INPUT_TEXT");
@@ -64,15 +90,15 @@
@Test
public void testInitialState() {
String text = selenium.getValue(LOC_INPUT_TEXT);
- assertEquals(text, "Paint 2D", MSG_TEXT_IN_IMAGE);
+ assertEquals(text, MSG_INITIAL_STATE_INPUT_TEXT, "Text in the
image.");
text = selenium.getValue(LOC_INPUT_COLOR);
- assertEquals(text, "0003e8", MSG_COLOR_OF_IMAGE);
+ assertEquals(text, MSG_INITIAL_STATE_INPUT_COLOR, "Color of the
image.");
int position = Integer.parseInt(getStyle(LOC_SHADOW_SLIDER_HANDLE,
"left").replace("px", ""));
- assertEquals(position, 127, MSG_SHADOW_SIZE);
+ assertEquals(position, MSG_INITIAL_STATE_SHADOW_SLIDER_HANDLE, "Size of the
shadow.");
- assertImageHash("da54ff0e62ee33804e270a863d7001a4");
+ assertImageHash(MSG_INITIAL_STATE_HASH);
}
/**
@@ -83,12 +109,12 @@
selenium.type(LOC_INPUT_TEXT, "XoXoXoXoX");
selenium.typeKeys(LOC_INPUT_TEXT, " "); // why is this necessary?
waitFor(1500);
- assertImageHash("490d3b23e3f8c19290d3fbe351409be");
+ assertImageHash(MSG_CHANGE_TEXT_HASH_1);
selenium.type(LOC_INPUT_TEXT, "Red Hat");
selenium.typeKeys(LOC_INPUT_TEXT, " "); // why is this necessary?
waitFor(1500);
- assertImageHash("f56c23afa5207cfdea008d298480c750");
+ assertImageHash(MSG_CHANGE_TEXT_HASH_2);
}
/**
@@ -100,13 +126,13 @@
selenium.click(LOC_BUTTON_APPLY_COLOR);
waitFor(1500);
- assertImageHash("8f71bfc38cf5a26cdd548d3bb0f67291");
+ assertImageHash(MSG_CHANGE_COLOR_HASH_1);
selenium.type(LOC_INPUT_COLOR, "00ffbb");
selenium.click(LOC_BUTTON_APPLY_COLOR);
waitFor(1500);
- assertImageHash("6623c69f0397e00a955ed6bbb41e68e1");
+ assertImageHash(MSG_CHANGE_COLOR_HASH_2);
}
/**
@@ -117,26 +143,26 @@
selenium.mouseDownAt(LOC_SHADOW_SLIDER, "0,0");
selenium.mouseUp(LOC_SHADOW_SLIDER);
int position = Integer.parseInt(getStyle(LOC_SHADOW_SLIDER_HANDLE,
"left").replace("px", ""));
- assertEquals(position, 0, MSG_POSITION_OF_SLIDERS_HANDLE);
+ assertEquals(position, MSG_CHANGE_SHADOW_SLIDER_HANDLE_1, "Position of the
slider's handle.");
waitFor(1500);
- assertImageHash("6f15cab627ffd32528a66ef9731990a2");
+ assertImageHash(MSG_CHANGE_SHADOW_HASH_1);
selenium.mouseDownAt(LOC_SHADOW_SLIDER, "96,0");
selenium.mouseUp(LOC_SHADOW_SLIDER);
position = Integer.parseInt(getStyle(LOC_SHADOW_SLIDER_HANDLE,
"left").replace("px", ""));
- assertEquals(position, 96, MSG_POSITION_OF_SLIDERS_HANDLE);
+ assertEquals(position, MSG_CHANGE_SHADOW_SLIDER_HANDLE_2, "Position of the
slider's handle.");
waitFor(1500);
- assertImageHash("19063b8ea31e2939699abd7dc92cf23e");
+ assertImageHash(MSG_CHANGE_SHADOW_HASH_2);
selenium.mouseDownAt(LOC_SHADOW_SLIDER, "191,0");
selenium.mouseUp(LOC_SHADOW_SLIDER);
position = Integer.parseInt(getStyle(LOC_SHADOW_SLIDER_HANDLE,
"left").replace("px", ""));
- assertEquals(position, 191, MSG_POSITION_OF_SLIDERS_HANDLE);
+ assertEquals(position, MSG_CHANGE_SHADOW_SLIDER_HANDLE_3, "Position of the
slider's handle.");
waitFor(1500);
- assertImageHash("d9e5b2f628d230b7dc41b8ece16a83ff");
+ assertImageHash(MSG_CHANGE_SHADOW_HASH_3);
}
/**
@@ -150,7 +176,7 @@
selenium.click(LOC_BUTTON_APPLY_COLOR);
waitFor(1500);
- assertImageHash("a18ff3c5c86154fc1c3ca2a59e60bbbf");
+ assertImageHash(MSG_CHANGE_TEXT_AND_COLOR_HASH);
}
/**
@@ -163,10 +189,10 @@
selenium.mouseDownAt(LOC_SHADOW_SLIDER, "159,0");
selenium.mouseUp(LOC_SHADOW_SLIDER);
int position = Integer.parseInt(getStyle(LOC_SHADOW_SLIDER_HANDLE,
"left").replace("px", ""));
- assertEquals(position, 159, MSG_POSITION_OF_SLIDERS_HANDLE);
+ assertEquals(position, MSG_CHANGE_TEXT_AND_SHADOW_SLIDER_HANDLE, "Position
of the slider's handle.");
waitFor(1500);
- assertImageHash("74e992e595303a2f16c72a178a116189");
+ assertImageHash(MSG_CHANGE_TEXT_AND_SHADOW_HASH);
}
/**
@@ -180,10 +206,10 @@
selenium.mouseDownAt(LOC_SHADOW_SLIDER, "96,0");
selenium.mouseUp(LOC_SHADOW_SLIDER);
int position = Integer.parseInt(getStyle(LOC_SHADOW_SLIDER_HANDLE,
"left").replace("px", ""));
- assertEquals(position, 96, MSG_POSITION_OF_SLIDERS_HANDLE);
+ assertEquals(position, MSG_CHANGE_COLOR_AND_SHADOW_SLIDER_HANDLE, "Position
of the slider's handle.");
waitFor(1500);
- assertImageHash("fd6a4503b768b0a197851b78948b497c");
+ assertImageHash(MSG_CHANGE_COLOR_AND_SHADOW_HASH);
}
/**
@@ -199,10 +225,10 @@
selenium.mouseDownAt(LOC_SHADOW_SLIDER, "127,0");
selenium.mouseUp(LOC_SHADOW_SLIDER);
int position = Integer.parseInt(getStyle(LOC_SHADOW_SLIDER_HANDLE,
"left").replace("px", ""));
- assertEquals(position, 127, MSG_POSITION_OF_SLIDERS_HANDLE);
+ assertEquals(position, MSG_CHANGE_ALL_SLIDER_HANDLE, "Position of the
slider's handle.");
waitFor(1500);
- assertImageHash("f2016d2528b7d288f752bdaaefc7a666");
+ assertImageHash(MSG_CHANGE_ALL_HASH);
}
/**
@@ -264,12 +290,13 @@
fail(e.getMessage());
}
- assertEquals(tmp, hashCode, MSG_IMAGE_HASH);
+ assertEquals(tmp, hashCode, "Hash of the image.");
}
/**
* Loads the page containing the component.
*/
+ @SuppressWarnings("unused")
@BeforeMethod
private void loadPage() {
openComponent("Paint2D");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelCustomizationTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelCustomizationTestCase.java 2009-09-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelCustomizationTestCase.java 2009-09-10
15:46:40 UTC (rev 15532)
@@ -1,22 +1,23 @@
-/**
- * License Agreement.
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * JBoss RichFaces
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Copyright (C) 2009 Red Hat, Inc.
- *
- * This code is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this code; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
package org.jboss.richfaces.integrationTest.panel;
@@ -37,12 +38,15 @@
public class PanelCustomizationTestCase extends AbstractSeleniumRichfacesTestCase {
// messages
- private final String MSG_CUST_PANEL_HEADER = getMsg("CUST_PANEL_HEADER");
- private final String MSG_CUST_CLASS_HEADER = getMsg("CUST_CLASS_HEADER");
- private final String MSG_CUST_THIRD_HEADER = getMsg("CUST_THIRD_HEADER");
- private final String MSG_CUST_THIRD_BODY = getMsg("CUST_THIRD_BODY");
- private final String MSG_CUST_FOURTH_PANEL_BODY_SCROLLABLE =
getMsg("CUST_FOURTH_PANEL_BODY_SCROLLABLE");
- private final String MSG_CUST_FIFTH_PANEL_NO_HEADER =
getMsg("CUST_FIFTH_PANEL_NO_HEADER");
+ private final String MSG_CUST_FIRST_HEADER = getMsg("CUST_FIRST_HEADER");
+ private final String MSG_CUST_FIRST_CLASS = getMsg("CUST_FIRST_CLASS");
+ private final String MSG_CUST_SECOND_HEADER =
getMsg("CUST_SECOND_HEADER");
+ private final String MSG_CUST_SECOND_CLASS = getMsg("CUST_SECOND_CLASS");
+ private final String MSG_CUST_THIRD_CLASS_1 =
getMsg("CUST_THIRD_CLASS_1");
+ private final String MSG_CUST_THIRD_CLASS_2 =
getMsg("CUST_THIRD_CLASS_2");
+ private final String MSG_CUST_FOURTH_HEADER =
getMsg("CUST_FOURTH_HEADER");
+ private final String MSG_CUST_FOURTH_CLASS = getMsg("CUST_FOURTH_CLASS");
+ private final int MSG_CUST_FIFTH_COUNT =
Integer.parseInt(getMsg("CUST_FIFTH_COUNT"));
// locators
private final String LOC_CUST_FIRST_PANEL_HEADER =
getLoc("CUST_FIRST_PANEL_HEADER");
@@ -53,51 +57,63 @@
private final String LOC_CUST_FOURTH_PANEL_HEADER =
getLoc("CUST_FOURTH_PANEL_HEADER");
private final String LOC_CUST_FIFTH_PANEL_PARTS =
getLoc("CUST_FIFTH_PANEL_PARTS");
+ /**
+ * Tests first panel. It checks panel header's text and class attribute.
+ */
@Test
public void testFirstPanel() {
String text = selenium.getText(LOC_CUST_FIRST_PANEL_HEADER);
- assertEquals(text, "Panel #1. Changing Style Synchronously",
MSG_CUST_PANEL_HEADER);
-
- text = selenium.getAttribute(LOC_CUST_FIRST_PANEL_HEADER + "@class");
- assertTrue(text.contains("rich-panel-header"), MSG_CUST_CLASS_HEADER);
+ assertEquals(text, MSG_CUST_FIRST_HEADER, "Header of the panel.");
+ assertTrue(belongsClass(MSG_CUST_FIRST_CLASS, LOC_CUST_FIRST_PANEL_HEADER),
+ "The \"class\" attribute of the header should contain
\"rich-panel-header\".");
}
+ /**
+ * Tests second panel. It checks panel header's text and class attribute.
+ */
@Test
public void testSecondPanel() {
String text = selenium.getText(LOC_CUST_SECOND_PANEL_HEADER);
- assertEquals(text, "Panel #2. Changing Style Synchronously",
MSG_CUST_PANEL_HEADER);
-
- text = selenium.getAttribute(LOC_CUST_SECOND_PANEL_HEADER + "@class");
- assertTrue(text.contains("rich-panel-header"), MSG_CUST_CLASS_HEADER);
+ assertEquals(text, MSG_CUST_SECOND_HEADER, "Header of the panel.");
+ assertTrue(belongsClass(MSG_CUST_SECOND_CLASS, LOC_CUST_SECOND_PANEL_HEADER),
+ "The \"class\" attribute of the header should contain
\"rich-panel-header\".");
}
+ /**
+ * Tests third panel. It checks that both header and body are green.
+ */
@Test
public void testThirdPanel() {
- String text = selenium.getAttribute(LOC_CUST_THIRD_PANEL_HEADER +
"@class");
- assertTrue(text.contains("head2"), MSG_CUST_THIRD_HEADER);
-
- text = selenium.getAttribute(LOC_CUST_THIRD_PANEL_BODY + "@class");
- assertTrue(text.contains("body3"), MSG_CUST_THIRD_BODY);
+ assertTrue(belongsClass(MSG_CUST_THIRD_CLASS_1, LOC_CUST_THIRD_PANEL_HEADER),
+ "Header of the third panel should be green -- its class attribute
has to contain \"head2\".");
+ assertTrue(belongsClass(MSG_CUST_THIRD_CLASS_2, LOC_CUST_THIRD_PANEL_BODY),
+ "Body of the third panel should be green -- its class attribute has
to contain \"body3\".");
}
+ /**
+ * Tests fourth panel. It checks panel's header and that it is scrollable.
+ */
@Test
public void testFourthPanel() {
String text = selenium.getText(LOC_CUST_FOURTH_PANEL_HEADER);
- assertEquals(text, "Scrolling Text Panel", MSG_CUST_PANEL_HEADER);
-
- text = selenium.getAttribute(LOC_CUST_FOURTH_PANEL_BODY + "@class");
- assertTrue(text.contains("body3"),
MSG_CUST_FOURTH_PANEL_BODY_SCROLLABLE);
+ assertEquals(text, MSG_CUST_FOURTH_HEADER, "Header of the panel.");
+ assertTrue(belongsClass(MSG_CUST_FOURTH_CLASS, LOC_CUST_FOURTH_PANEL_BODY),
+ "Body of the fourth panel should be scrollable -- its class
attribute has to contain \"body3\".");
}
+ /**
+ * Tests fifth panel. It checks that the panel has no header.
+ */
@Test
public void testFifthPanel() {
int count = selenium.getXpathCount(LOC_CUST_FIFTH_PANEL_PARTS).intValue();
- assertEquals(count, 1, MSG_CUST_FIFTH_PANEL_NO_HEADER);
+ assertEquals(count, MSG_CUST_FIFTH_COUNT, "The fifth panel should have no
header.");
}
/**
* Loads the page containing the component.
*/
+ @SuppressWarnings("unused")
@BeforeMethod
private void loadPage() {
openComponent("Panel");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelTestCase.java 2009-09-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panel/PanelTestCase.java 2009-09-10
15:46:40 UTC (rev 15532)
@@ -1,22 +1,23 @@
-/**
- * License Agreement.
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * JBoss RichFaces
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Copyright (C) 2009 Red Hat, Inc.
- *
- * This code is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this code; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
package org.jboss.richfaces.integrationTest.panel;
@@ -35,134 +36,123 @@
*/
public class PanelTestCase extends AbstractSeleniumRichfacesTestCase {
- // messages
- private final String MSG_FIRST_PANEL_TWO_PARTS =
getMsg("FIRST_PANEL_TWO_PARTS");
- private final String MSG_FIRST_HEADER = getMsg("FIRST_HEADER");
- private final String MSG_SECOND_PANEL_NO_HEADER =
getMsg("SECOND_PANEL_NO_HEADER");
- private final String MSG_THIRD_PANEL_TWO_PARTS =
getMsg("THIRD_PANEL_TWO_PARTS");
- private final String MSG_SHOULD_BE_TWO_NESTED_PANELS =
getMsg("SHOULD_BE_TWO_NESTED_PANELS");
- private final String MSG_SIX_ITEMS_IN_LIST_LEFT =
getMsg("SIX_ITEMS_IN_LIST_LEFT");
- private final String MSG_SIX_ITEMS_IN_LIST_RIGHT =
getMsg("SIX_ITEMS_IN_LIST_RIGHT");
- private final String MSG_THIRD_HEADER = getMsg("THIRD_HEADER");
+ // messages
+ private final String MSG_FIRST_PANEL_TWO_PARTS =
getMsg("FIRST_PANEL_TWO_PARTS");
+ private final String MSG_FIRST_HEADER = getMsg("FIRST_HEADER");
+ private final String MSG_SECOND_PANEL_NO_HEADER =
getMsg("SECOND_PANEL_NO_HEADER");
+ private final String MSG_THIRD_PANEL_TWO_PARTS =
getMsg("THIRD_PANEL_TWO_PARTS");
+ private final String MSG_SHOULD_BE_TWO_NESTED_PANELS =
getMsg("SHOULD_BE_TWO_NESTED_PANELS");
+ private final String MSG_SIX_ITEMS_IN_LIST_LEFT =
getMsg("SIX_ITEMS_IN_LIST_LEFT");
+ private final String MSG_SIX_ITEMS_IN_LIST_RIGHT =
getMsg("SIX_ITEMS_IN_LIST_RIGHT");
+ private final String MSG_THIRD_HEADER = getMsg("THIRD_HEADER");
- // locators
- private final String LOC_FIRST_DIVS = getLoc("FIRST_DIVS");
- private final String LOC_FIRST_HEADER = getLoc("FIRST_HEADER");
- private final String LOC_SECOND_DIVS = getLoc("SECOND_DIVS");
- private final String LOC_THIRD_DIVS = getLoc("THIRD_DIVS");
- private final String LOC_THIRD_HEADER = getLoc("THIRD_HEADER");
- private final String LOC_THIRD_NESTED_PANELS = getLoc("THIRD_NESTED_PANELS");
- private final String LOC_LEFT_NESTED_PANEL_LIST_LI =
getLoc("LEFT_NESTED_PANEL_LIST_LI");
- private final String LOC_RIGHT_NESTED_PANEL_LIST_LI =
getLoc("RIGHT_NESTED_PANEL_LIST_LI");
+ // locators
+ private final String LOC_FIRST_DIVS = getLoc("FIRST_DIVS");
+ private final String LOC_FIRST_HEADER = getLoc("FIRST_HEADER");
+ private final String LOC_SECOND_DIVS = getLoc("SECOND_DIVS");
+ private final String LOC_THIRD_DIVS = getLoc("THIRD_DIVS");
+ private final String LOC_THIRD_HEADER = getLoc("THIRD_HEADER");
+ private final String LOC_THIRD_NESTED_PANELS =
getLoc("THIRD_NESTED_PANELS");
+ private final String LOC_LEFT_NESTED_PANEL_LIST_LI =
getLoc("LEFT_NESTED_PANEL_LIST_LI");
+ private final String LOC_RIGHT_NESTED_PANEL_LIST_LI =
getLoc("RIGHT_NESTED_PANEL_LIST_LI");
- /**
- * Tests the first example. It verifies that there are both header and body of the
panel.
- * Then it checks the content of the header.
- */
- @Test
- public void testFirstExample() {
- int count = selenium.getXpathCount(LOC_FIRST_DIVS).intValue();
- assertEquals(count, 2, MSG_FIRST_PANEL_TWO_PARTS);
+ /**
+ * Tests the first example. It verifies that there are both header and body
+ * of the panel. Then it checks the content of the header.
+ */
+ @Test
+ public void testFirstExample() {
+ int count = selenium.getXpathCount(LOC_FIRST_DIVS).intValue();
+ assertEquals(count, 2, MSG_FIRST_PANEL_TWO_PARTS);
- String text = selenium.getText(LOC_FIRST_HEADER);
- assertEquals(
- text,
- "Write your own custom rich components with built-in AJAX support",
- MSG_FIRST_HEADER);
- }
+ String text = selenium.getText(LOC_FIRST_HEADER);
+ assertEquals(text, "Write your own custom rich components with built-in AJAX
support", MSG_FIRST_HEADER);
+ }
- /**
- * Tests the second example. It verifies that there is no header.
- */
- @Test
- public void testSecondExample() {
- int count = selenium.getXpathCount(LOC_SECOND_DIVS).intValue();
- assertEquals(count, 1, MSG_SECOND_PANEL_NO_HEADER);
- }
+ /**
+ * Tests the second example. It verifies that there is no header.
+ */
+ @Test
+ public void testSecondExample() {
+ int count = selenium.getXpathCount(LOC_SECOND_DIVS).intValue();
+ assertEquals(count, 1, MSG_SECOND_PANEL_NO_HEADER);
+ }
- /**
- * Tests the third example. Verifies that the main panel has both header and body and
checks
- * its header. Then it checks the count of nested panels. For both left and right
nested
- * panel it checks that there are 6 items in lists.
- */
- @Test
- public void testThirdExample() {
- int count = selenium.getXpathCount(LOC_THIRD_DIVS).intValue();
- assertEquals(count, 2, MSG_THIRD_PANEL_TWO_PARTS);
+ /**
+ * Tests the third example. Verifies that the main panel has both header and
+ * body and checks its header. Then it checks the count of nested panels.
+ * For both left and right nested panel it checks that there are 6 items in
+ * lists.
+ */
+ @Test
+ public void testThirdExample() {
+ int count = selenium.getXpathCount(LOC_THIRD_DIVS).intValue();
+ assertEquals(count, 2, MSG_THIRD_PANEL_TWO_PARTS);
- String text = selenium.getText(LOC_THIRD_HEADER);
- assertEquals(text, "", MSG_THIRD_HEADER);
+ String text = selenium.getText(LOC_THIRD_HEADER);
+ assertEquals(text, "", MSG_THIRD_HEADER);
- count = selenium.getXpathCount(LOC_THIRD_NESTED_PANELS).intValue();
- assertEquals(count, 2, MSG_SHOULD_BE_TWO_NESTED_PANELS);
+ count = selenium.getXpathCount(LOC_THIRD_NESTED_PANELS).intValue();
+ assertEquals(count, 2, MSG_SHOULD_BE_TWO_NESTED_PANELS);
- count = selenium.getXpathCount(LOC_LEFT_NESTED_PANEL_LIST_LI)
- .intValue();
- assertEquals(count, 6, MSG_SIX_ITEMS_IN_LIST_LEFT);
+ count = selenium.getXpathCount(LOC_LEFT_NESTED_PANEL_LIST_LI).intValue();
+ assertEquals(count, 6, MSG_SIX_ITEMS_IN_LIST_LEFT);
- count = selenium.getXpathCount(LOC_RIGHT_NESTED_PANEL_LIST_LI)
- .intValue();
- assertEquals(count, 6, MSG_SIX_ITEMS_IN_LIST_RIGHT);
- }
+ count = selenium.getXpathCount(LOC_RIGHT_NESTED_PANEL_LIST_LI).intValue();
+ assertEquals(count, 6, MSG_SIX_ITEMS_IN_LIST_RIGHT);
+ }
- /**
- * Tests the "View Source" of the first example. It checks that the source
- * code is not visible, clicks on the link, and checks 7 lines of source
- * code.
- */
- @Test
- public void testFirstExampleSource() {
- String[] strings = new String[] {
- "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
- "<rich:panel>",
- "<f:facet name=\"header\">",
- "Write your own custom rich components with built-in AJAX support",
- "The CDK includes a code-generation facility and a",
- "</rich:panel>", "</ui:composition>", };
+ /**
+ * Tests the "View Source" of the first example. It checks that the source
+ * code is not visible, clicks on the link, and checks 7 lines of source
+ * code.
+ */
+ @Test
+ public void testFirstExampleSource() {
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"", "<rich:panel>",
+ "<f:facet name=\"header\">", "Write your
own custom rich components with built-in AJAX support",
+ "The CDK includes a code-generation facility and a",
"</rich:panel>", "</ui:composition>", };
- abstractTestSource(1, "View Source", strings);
- }
+ abstractTestSource(1, "View Source", strings);
+ }
- /**
- * Tests the "View Source" of the second example. It checks that the source
- * code is not visible, clicks on the link, and checks 6 lines of source
- * code.
- */
- @Test
- public void testSecondExampleSource() {
- String[] strings = new String[] {
- "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
- "xmlns:a4j=\"http://richfaces.org/a4j\"",
- "<rich:panel bodyClass=\"rich-laguna-panel-no-header\">",
- "RichFaces is a library for adding rich user interface features to JSF",
- "</rich:panel>", "</ui:composition>", };
+ /**
+ * Tests the "View Source" of the second example. It checks that the
source
+ * code is not visible, clicks on the link, and checks 6 lines of source
+ * code.
+ */
+ @Test
+ public void testSecondExampleSource() {
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "xmlns:a4j=\"http://richfaces.org/a4j\"",
"<rich:panel bodyClass=\"rich-laguna-panel-no-header\">",
+ "RichFaces is a library for adding rich user interface features to
JSF", "</rich:panel>",
+ "</ui:composition>", };
- abstractTestSource(2, "View Source", strings);
- }
+ abstractTestSource(2, "View Source", strings);
+ }
- /**
- * Tests the "View Source" of the third example. It checks that the source
- * code is not visible, clicks on the link, and checks 7 lines of source
- * code.
- */
- @Test
- public void testThirdExampleSource() {
- String[] strings = new String[] {
- "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
- "<rich:panel style=\"padding:0\"
headerClass=\"outpanelHeader\">",
- "<f:facet name=\"header\">",
- "<h2 align=\"center\"><h:outputText value=\"Benefits of
Using Ajax4jsf\" /></h2>",
- "<rich:panel bodyClass=\"inpanelBody\">",
- "<li>Production quality Open Source</li>",
"</ui:composition>", };
+ /**
+ * Tests the "View Source" of the third example. It checks that the source
+ * code is not visible, clicks on the link, and checks 7 lines of source
+ * code.
+ */
+ @Test
+ public void testThirdExampleSource() {
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<rich:panel style=\"padding:0\"
headerClass=\"outpanelHeader\">", "<f:facet
name=\"header\">",
+ "<h2 align=\"center\"><h:outputText
value=\"Benefits of Using Ajax4jsf\" /></h2>",
+ "<rich:panel bodyClass=\"inpanelBody\">",
"<li>Production quality Open Source</li>",
+ "</ui:composition>", };
- abstractTestSource(3, "View Source", strings);
- }
+ abstractTestSource(3, "View Source", strings);
+ }
- /**
- * Loads the page containing the component.
- */
- @BeforeMethod
- private void loadPage() {
- openComponent("Panel");
- }
+ /**
+ * Loads the page containing the component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Panel");
+ }
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelBar/PanelBarTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelBar/PanelBarTestCase.java 2009-09-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelBar/PanelBarTestCase.java 2009-09-10
15:46:40 UTC (rev 15532)
@@ -1,22 +1,23 @@
-/**
- * License Agreement.
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
*
- * JBoss RichFaces
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
- * Copyright (C) 2009 Red Hat, Inc.
- *
- * This code is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful,
+ * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this code; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
package org.jboss.richfaces.integrationTest.panelBar;
@@ -37,86 +38,83 @@
*/
public class PanelBarTestCase extends AbstractSeleniumRichfacesTestCase {
- // messages
- private final String MSG_HEADER_N = getMsg("HEADER_N");
- private final String MSG_PANEL_N_SHOULD_BE_VISIBLE =
getMsg("PANEL_N_SHOULD_BE_VISIBLE");
- private final String MSG_PANEL_N_SHOULD_NOT_BE_VISIBLE =
getMsg("PANEL_N_SHOULD_NOT_BE_VISIBLE");
+ // messages
+ private final String MSG_HEADER_N = getMsg("HEADER_N");
+ private final String MSG_PANEL_N_SHOULD_BE_VISIBLE =
getMsg("PANEL_N_SHOULD_BE_VISIBLE");
+ private final String MSG_PANEL_N_SHOULD_NOT_BE_VISIBLE =
getMsg("PANEL_N_SHOULD_NOT_BE_VISIBLE");
- // locators
- private final String LOC_EXAMPLE_HEADER = getLoc("EXAMPLE_HEADER");
- private final String LOC_HEADER_1_N = getLoc("HEADER_1_N");
- private final String LOC_HEADER_2_N = getLoc("HEADER_2_N");
- private final String LOC_CONTENT_N = getLoc("CONTENT_N");
+ // locators
+ private final String LOC_EXAMPLE_HEADER = getLoc("EXAMPLE_HEADER");
+ private final String LOC_HEADER_1_N = getLoc("HEADER_1_N");
+ private final String LOC_HEADER_2_N = getLoc("HEADER_2_N");
+ private final String LOC_CONTENT_N = getLoc("CONTENT_N");
- /**
- * Tests all components as they appear after page is loaded.
- */
- @Test
- public void testInitialState() {
- String[] headers = new String[] {
- "Leverage the whole set of JSF benefits while working with AJAX",
- "Add AJAX capability to existing JSF applications",
- "Write your own custom rich components with built-in AJAX support",
- "Package resources with the application's Java classes",
- "Easily generate images on-the-fly",
- "Create a modern rich user interface look-and-feel with skins-based
technology",
- "Test the components, actions, listeners, and pages as you are creating
them" };
+ /**
+ * Tests all components as they appear after page is loaded.
+ */
+ @Test
+ public void testInitialState() {
+ String[] headers = new String[] { "Leverage the whole set of JSF benefits
while working with AJAX",
+ "Add AJAX capability to existing JSF applications",
+ "Write your own custom rich components with built-in AJAX
support",
+ "Package resources with the application's Java classes",
"Easily generate images on-the-fly",
+ "Create a modern rich user interface look-and-feel with skins-based
technology",
+ "Test the components, actions, listeners, and pages as you are
creating them" };
String text = selenium.getText(format(LOC_HEADER_2_N, 1));
- assertEquals(text, headers[0], format(MSG_HEADER_N, 1));
- assertTrue(isDisplayed(format(LOC_CONTENT_N, 1)), format(MSG_PANEL_N_SHOULD_BE_VISIBLE,
1));
+ assertEquals(text, headers[0], format(MSG_HEADER_N, 1));
+ assertTrue(isDisplayed(format(LOC_CONTENT_N, 1)),
format(MSG_PANEL_N_SHOULD_BE_VISIBLE, 1));
- for (int i = 2; i < 8; i++) {
- text = selenium.getText(format(LOC_HEADER_1_N, i));
- assertEquals(text, headers[i - 1], format(MSG_HEADER_N, i));
- assertFalse(isDisplayed(format(LOC_CONTENT_N, i)),
format(MSG_PANEL_N_SHOULD_NOT_BE_VISIBLE, i));
- }
- }
+ for (int i = 2; i < 8; i++) {
+ text = selenium.getText(format(LOC_HEADER_1_N, i));
+ assertEquals(text, headers[i - 1], format(MSG_HEADER_N, i));
+ assertFalse(isDisplayed(format(LOC_CONTENT_N, i)),
format(MSG_PANEL_N_SHOULD_NOT_BE_VISIBLE, i));
+ }
+ }
- /**
- * Tests expanding each panel. It verifies that the clicked panel is visible
- * and that none of the other panels is visible.
- */
- @Test
- public void testExpanding() {
- for (int i = 7; i > 0; i--) {
- selenium.click(format(LOC_HEADER_1_N, i));
+ /**
+ * Tests expanding each panel. It verifies that the clicked panel is visible
+ * and that none of the other panels is visible.
+ */
+ @Test
+ public void testExpanding() {
+ for (int i = 7; i > 0; i--) {
+ selenium.click(format(LOC_HEADER_1_N, i));
- // check that clicked panel is visible
- assertTrue(isDisplayed(format(LOC_CONTENT_N, i)),
format(MSG_PANEL_N_SHOULD_BE_VISIBLE, i));
+ // check that clicked panel is visible
+ assertTrue(isDisplayed(format(LOC_CONTENT_N, i)),
format(MSG_PANEL_N_SHOULD_BE_VISIBLE, i));
- // check that other panel are not visible
- for (int j = 1; j < 8; j++) {
- if (j == i) {
- continue;
- }
- assertFalse(isDisplayed(format(LOC_CONTENT_N, j)),
format(MSG_PANEL_N_SHOULD_NOT_BE_VISIBLE, i));
- }
- }
- }
+ // check that other panel are not visible
+ for (int j = 1; j < 8; j++) {
+ if (j == i) {
+ continue;
+ }
+ assertFalse(isDisplayed(format(LOC_CONTENT_N, j)),
format(MSG_PANEL_N_SHOULD_NOT_BE_VISIBLE, i));
+ }
+ }
+ }
- /**
- * Tests the "View Source". It checks that the source code is not visible,
- * clicks on the link, and checks 6 lines of source code.
- */
- @Test
- public void testPageSource() {
- String[] strings = new String[] {
- "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
- "<rich:panelBar height=\"400\" width=\"500\">",
- "label=\"Leverage the whole set of JSF benefits while working with
AJAX\">",
- "</rich:panelBarItem>", "</rich:panelBar>",
- "</ui:composition>", };
+ /**
+ * Tests the "View Source". It checks that the source code is not visible,
+ * clicks on the link, and checks 6 lines of source code.
+ */
+ @Test
+ public void testPageSource() {
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<rich:panelBar height=\"400\"
width=\"500\">",
+ "label=\"Leverage the whole set of JSF benefits while working
with AJAX\">", "</rich:panelBarItem>",
+ "</rich:panelBar>", "</ui:composition>",
};
- abstractTestSource(1, "View Source", strings);
- }
+ abstractTestSource(1, "View Source", strings);
+ }
- /**
- * Loads the page containing the component.
- */
- @BeforeMethod
- private void loadPage() {
- openComponent("Panel Bar");
- scrollIntoView(LOC_EXAMPLE_HEADER, true);
- }
+ /**
+ * Loads the page containing the component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Panel Bar");
+ scrollIntoView(LOC_EXAMPLE_HEADER, true);
+ }
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelMenu/PanelMenuTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelMenu/PanelMenuTestCase.java 2009-09-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/panelMenu/PanelMenuTestCase.java 2009-09-10
15:46:40 UTC (rev 15532)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
package org.jboss.richfaces.integrationTest.panelMenu;
import static org.testng.Assert.assertEquals;
@@ -17,20 +39,19 @@
public class PanelMenuTestCase extends AbstractSeleniumRichfacesTestCase {
// messages
- private final String MSG_COMPONENT_DESCRIPTION =
getMess("COMPONENT_DESCRIPTION");
- private final String MSG_CONTENT_OF_PANEL_ON_LOAD =
getMess("CONTENT_OF_PANEL_ON_LOAD");
- private final String MSG_CONTENT_OF_PANEL = getMess("CONTENT_OF_PANEL");
- private final String MSG_IMAGE_BEFORE_GROUP_NAME =
getMess("IMAGE_BEFORE_GROUP_NAME");
- private final String MSG_NAME_OF_GROUP = getMess("NAME_OF_GROUP");
- private final String MSG_IMAGE_AFTER_GROUP_NAME_DOWN =
getMess("IMAGE_AFTER_GROUP_NAME_DOWN");
- private final String MSG_IMAGE_AFTER_GROUP_NAME_UP =
getMess("IMAGE_AFTER_GROUP_NAME_UP");
- private final String MSG_IMAGE_AFTER_GROUP_NAME_SPACER =
getMess("IMAGE_AFTER_GROUP_NAME_SPACER");
- private final String MSG_ITEM_M_N_NOT_VISIBLE =
getMess("ITEM_M_N_NOT_VISIBLE");
- private final String MSG_ITEM_M_N_VISIBLE = getMess("ITEM_M_N_VISIBLE");
- private final String MSG_IMAGE_BEFORE_ITEM_GRID =
getMess("IMAGE_BEFORE_ITEM_GRID");
- private final String MSG_DISK_BEFORE_GROUP_NAME =
getMess("DISK_BEFORE_GROUP_NAME");
- private final String MSG_SUBITEM_M_NOT_VISIBLE =
getMess("SUBITEM_M_NOT_VISIBLE");
- private final String MSG_SUBITEM_M_VISIBLE = getMess("SUBITEM_M_VISIBLE");
+ private final String MSG_CONTENT_OF_PANEL_ON_LOAD =
getMsg("CONTENT_OF_PANEL_ON_LOAD");
+ private final String MSG_CONTENT_OF_PANEL = getMsg("CONTENT_OF_PANEL");
+ private final String MSG_IMAGE_BEFORE_GROUP_NAME =
getMsg("IMAGE_BEFORE_GROUP_NAME");
+ private final String MSG_NAME_OF_GROUP = getMsg("NAME_OF_GROUP");
+ private final String MSG_IMAGE_AFTER_GROUP_NAME_DOWN =
getMsg("IMAGE_AFTER_GROUP_NAME_DOWN");
+ private final String MSG_IMAGE_AFTER_GROUP_NAME_UP =
getMsg("IMAGE_AFTER_GROUP_NAME_UP");
+ private final String MSG_IMAGE_AFTER_GROUP_NAME_SPACER =
getMsg("IMAGE_AFTER_GROUP_NAME_SPACER");
+ private final String MSG_ITEM_M_N_NOT_VISIBLE =
getMsg("ITEM_M_N_NOT_VISIBLE");
+ private final String MSG_ITEM_M_N_VISIBLE = getMsg("ITEM_M_N_VISIBLE");
+ private final String MSG_IMAGE_BEFORE_ITEM_GRID =
getMsg("IMAGE_BEFORE_ITEM_GRID");
+ private final String MSG_DISK_BEFORE_GROUP_NAME =
getMsg("DISK_BEFORE_GROUP_NAME");
+ private final String MSG_SUBITEM_M_NOT_VISIBLE =
getMsg("SUBITEM_M_NOT_VISIBLE");
+ private final String MSG_SUBITEM_M_VISIBLE = getMsg("SUBITEM_M_VISIBLE");
// locators
private final String LOC_EXAMPLE_HEADER = getLoc("EXAMPLE_HEADER");
@@ -45,10 +66,9 @@
private final String LOC_ITEM_M_N_TEXT = getLoc("ITEM_M_N_TEXT");
private final String LOC_ITEM_M_N_STYLE = getLoc("ITEM_M_N_STYLE");
- private final String LOC_SUBITEM_GROUP = getLoc("SUBITEM_GROUP");
- private final String LOC_SUBITEM_M_IMAGE_BEFORE =
formatLoc("SUBITEM_M_IMAGE_BEFORE_RELATIVE_TO_GROUP", LOC_SUBITEM_GROUP);
- private final String LOC_SUBITEM_M_TEXT =
formatLoc("SUBITEM_M_TEXT_RELATIVE_TO_GROUP", LOC_SUBITEM_GROUP);
- private final String LOC_SUBITEM_M_STYLE =
formatLoc("SUBITEM_M_STYLE_RELATIVE_TO_GROUP", LOC_SUBITEM_GROUP);
+ private final String LOC_SUBITEM_M_IMAGE = getLoc("SUBITEM_M_IMAGE");
+ private final String LOC_SUBITEM_M_TEXT = getLoc("SUBITEM_M_TEXT");
+ private final String LOC_SUBITEM_M_STYLE = getLoc("SUBITEM_M_STYLE");
/**
* Tests the first group. First it checks the image before group name, group
@@ -97,57 +117,38 @@
public void testSubgroup() {
String text = null;
- selenium.click(String.format(LOC_GROUP_N_TEXT, 2));
+ selenium.click(format(LOC_GROUP_N_TEXT, 2));
// image before subgroup name
- text = selenium.getAttribute(String.format(LOC_ITEM_M_N_IMAGE_BEFORE, 2, 4));
- assertTrue(text.contains("PanelMenuIconDisc"),
- MSG_DISK_BEFORE_GROUP_NAME);
+ text = selenium.getAttribute(format(LOC_ITEM_M_N_IMAGE_BEFORE, 2, 4));
+ assertTrue(text.contains("PanelMenuIconDisc"), MSG_DISK_BEFORE_GROUP_NAME);
// subgroup name
- text = selenium.getText(String.format(LOC_ITEM_M_N_TEXT, 2, 4));
+ text = selenium.getText(format(LOC_ITEM_M_N_TEXT, 2, 4));
assertEquals(text, "Group 2.4", MSG_NAME_OF_GROUP);
// image after subgroup name
- text = selenium.getAttribute(String.format(LOC_ITEM_M_N_IMAGE_AFTER, 2,
- 4));
- assertTrue(text.contains("PanelMenuIconSpacer"),
- MSG_IMAGE_AFTER_GROUP_NAME_SPACER);
+ text = selenium.getAttribute(format(LOC_ITEM_M_N_IMAGE_AFTER, 2, 4));
+ assertTrue(text.contains("PanelMenuIconSpacer"),
MSG_IMAGE_AFTER_GROUP_NAME_SPACER);
for (int i = 1; i < 4; i++) {
- text = selenium.getAttribute(String.format(LOC_SUBITEM_M_STYLE, i));
- assertFalse(!text.contains("display: none;"), String.format(
- MSG_SUBITEM_M_NOT_VISIBLE, i));
+ assertFalse(isDisplayed(format(LOC_SUBITEM_M_STYLE, i)),
format(MSG_SUBITEM_M_NOT_VISIBLE, i));
}
// click Group 2.4
- selenium.click(String.format(LOC_ITEM_M_N_TEXT, 2, 4));
+ selenium.click(format(LOC_ITEM_M_N_TEXT, 2, 4));
// image after subgroup name
- text = selenium.getAttribute(String.format(LOC_ITEM_M_N_IMAGE_AFTER, 2,
- 4));
- assertTrue(text.contains("PanelMenuIconSpacer"),
- MSG_IMAGE_AFTER_GROUP_NAME_SPACER);
+ text = selenium.getAttribute(format(LOC_ITEM_M_N_IMAGE_AFTER, 2, 4));
+ assertTrue(text.contains("PanelMenuIconSpacer"),
MSG_IMAGE_AFTER_GROUP_NAME_SPACER);
for (int i = 1; i < 4; i++) {
// check that items are not hidden
- try {
- text = selenium.getAttribute(String.format(LOC_SUBITEM_M_STYLE,
- i));
- assertTrue(!text.contains("display: none;"), String.format(
- MSG_SUBITEM_M_VISIBLE, i));
- } catch (Exception e) {
- // OK -- there is no style attribute
- }
-
+ assertTrue(isDisplayed(format(LOC_SUBITEM_M_STYLE, i)), format(MSG_SUBITEM_M_VISIBLE,
i));
+
// check the image left of the item
- System.out.println("--------------"
- + String.format(LOC_SUBITEM_M_IMAGE_BEFORE, i) + "-----");
- text = selenium.getAttribute(String.format(
- LOC_SUBITEM_M_IMAGE_BEFORE, i));
- System.out.println("--------------" + text + "-----");
- assertTrue(text.contains("PanelMenuIconGrid"),
- MSG_IMAGE_BEFORE_ITEM_GRID);
+ text = selenium.getAttribute(format(LOC_SUBITEM_M_IMAGE, i));
+ assertTrue(text.contains("PanelMenuIconGrid"), MSG_IMAGE_BEFORE_ITEM_GRID);
}
}
@@ -164,24 +165,22 @@
// check items on the first level (1.1, 1.2, etc.)
for (int i = 1; i < 4; i++) {
- selenium.click(String.format(LOC_GROUP_N_TEXT, i));
+ selenium.click(format(LOC_GROUP_N_TEXT, i));
for (int j = 1; j < 4; j++) {
- selenium.click(String.format(LOC_ITEM_M_N_TEXT, i, j));
+ selenium.click(format(LOC_ITEM_M_N_TEXT, i, j));
waitFor(500); // it use Ajax mode
text = selenium.getText(LOC_PANEL);
- assertEquals(text, String.format("Item %d.%d selected", i, j),
- MSG_CONTENT_OF_PANEL);
+ assertEquals(text, format("Item {0}.{1} selected", i, j),
MSG_CONTENT_OF_PANEL);
}
}
// check items on the second level (2.4.1, 2.4.2, 2.4.3)
- selenium.click(String.format(LOC_ITEM_M_N_TEXT, 2, 4));
+ selenium.click(format(LOC_ITEM_M_N_TEXT, 2, 4));
for (int i = 1; i < 4; i++) {
- selenium.click(String.format(LOC_SUBITEM_M_TEXT, i));
+ selenium.click(format(LOC_SUBITEM_M_TEXT, i));
waitFor(500); // it use Ajax mode
text = selenium.getText(LOC_PANEL);
- assertEquals(text, String.format("Item 2.4.%d selected", i),
- MSG_CONTENT_OF_PANEL);
+ assertEquals(text, format("Item 2.4.{0} selected", i),
MSG_CONTENT_OF_PANEL);
}
}
@@ -213,62 +212,44 @@
String text = null;
// spacer before group name
- text = selenium.getAttribute(String.format(LOC_GROUP_N_IMAGE_BEFORE,
- index));
- assertTrue(text.contains("PanelMenuIconSpacer"),
- MSG_IMAGE_BEFORE_GROUP_NAME);
+ text = selenium.getAttribute(format(LOC_GROUP_N_IMAGE_BEFORE, index));
+ assertTrue(text.contains("PanelMenuIconSpacer"),
MSG_IMAGE_BEFORE_GROUP_NAME);
// group name
- text = selenium.getText(String.format(LOC_GROUP_N_TEXT, index));
+ text = selenium.getText(format(LOC_GROUP_N_TEXT, index));
assertEquals(text, "Group " + index, MSG_NAME_OF_GROUP);
// image after group name
- text = selenium.getAttribute(String.format(LOC_GROUP_N_IMAGE_AFTER,
- index));
- assertTrue(text.contains("PanelMenuIconChevronDown"),
- MSG_IMAGE_AFTER_GROUP_NAME_DOWN);
+ text = selenium.getAttribute(format(LOC_GROUP_N_IMAGE_AFTER, index));
+ assertTrue(text.contains("PanelMenuIconChevronDown"),
MSG_IMAGE_AFTER_GROUP_NAME_DOWN);
for (int i = 1; i < 4; i++) {
- text = selenium.getAttribute(String.format(LOC_ITEM_M_N_STYLE,
- index, i));
- assertFalse(!text.contains("display: none;"), String.format(
- MSG_ITEM_M_N_NOT_VISIBLE, index, i));
+ assertFalse(isDisplayed(format(LOC_ITEM_M_N_STYLE, index, i)),
format(MSG_ITEM_M_N_NOT_VISIBLE, index, i));
}
- selenium.click(String.format(LOC_GROUP_N_TEXT, index));
+ selenium.click(format(LOC_GROUP_N_TEXT, index));
// image after group name
- text = selenium.getAttribute(String.format(LOC_GROUP_N_IMAGE_AFTER,
- index));
- assertTrue(text.contains("PanelMenuIconChevronUp"),
- MSG_IMAGE_AFTER_GROUP_NAME_UP);
+ text = selenium.getAttribute(format(LOC_GROUP_N_IMAGE_AFTER, index));
+ assertTrue(text.contains("PanelMenuIconChevronUp"),
MSG_IMAGE_AFTER_GROUP_NAME_UP);
for (int i = 1; i < 4; i++) {
// check that items are not hidden
- try {
- text = selenium.getAttribute(String.format(LOC_ITEM_M_N_STYLE,
- index, i));
- assertTrue(!text.contains("display: none;"), String.format(
- MSG_ITEM_M_N_VISIBLE, index, i));
- } catch (Exception e) {
- // OK -- there is no style attribute
- }
-
+ assertTrue(isDisplayed(format(LOC_ITEM_M_N_STYLE, index, i)),
format(MSG_ITEM_M_N_VISIBLE, index, i));
+
// check the image left of the item
- text = selenium.getAttribute(String.format(
- LOC_ITEM_M_N_IMAGE_BEFORE, index, i));
- assertTrue(text.contains("PanelMenuIconGrid"),
- MSG_IMAGE_BEFORE_ITEM_GRID);
+ text = selenium.getAttribute(format(LOC_ITEM_M_N_IMAGE_BEFORE, index, i));
+ assertTrue(text.contains("PanelMenuIconGrid"), MSG_IMAGE_BEFORE_ITEM_GRID);
}
}
/**
* Loads the page containing the component.
*/
+ @SuppressWarnings("unused")
@BeforeMethod
private void loadPage() {
-// selenium.allowNativeXpath("true");
- super.loadPage("richOutputs", 5, 1, MSG_COMPONENT_DESCRIPTION);
- scrollIntoView(LOC_EXAMPLE_HEADER, true);
+ openComponent("Panel Menu");
+ scrollIntoView(LOC_EXAMPLE_HEADER, true);
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/pickList/PickListTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/pickList/PickListTestCase.java 2009-09-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/pickList/PickListTestCase.java 2009-09-10
15:46:40 UTC (rev 15532)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
package org.jboss.richfaces.integrationTest.pickList;
import static org.testng.Assert.assertEquals;
@@ -8,267 +30,315 @@
import org.testng.annotations.Test;
/**
+ * Test case for pick list.
*
- * <ul>
- * <li><b>TODO</b> check that buttons are enabled and disabled
properly</li>
- * <li><b>TODO</b> implement tests for multiple files with shift and
control key
- * </li>
- * <li><b>TODO</b> check not only one table, but both</li>
- * <li><b>TODO</b> check the header of panel with capitals</li>
- * </ul>
- *
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
+// TODO check that buttons are enabled and disabled properly
+// TODO implement tests for multiple files with shift and control key
+// TODO check not only one table, but both
+// TODO check the header of panel with capitals
public class PickListTestCase extends AbstractSeleniumRichfacesTestCase {
- private final String leftUpperTable =
"//fieldset[1]/div/table/tbody/tr/td[1]/div/table/tbody/tr/td/div/div/table/tbody";
- private final String upperButtons =
"//fieldset[1]/div/table/tbody/tr/td[2]/div";
- private final String rightUpperTable =
"//fieldset[1]/div/table/tbody/tr/td[3]/div/table/tbody/tr/td/div/div/table/tbody";
+ // locators
+ private final String LOC_FIRST_EXAMPLE_HEADER =
getLoc("FIRST_EXAMPLE_HEADER");
+ private final String LOC_FIRST_LEFT_ITEMS = getLoc("FIRST_LEFT_ITEMS");
+ private final String LOC_FIRST_LEFT_FIRST_ITEM =
getLoc("FIRST_LEFT_FIRST_ITEM");
+ private final String LOC_FIRST_RIGHT_ITEMS = getLoc("FIRST_RIGHT_ITEMS");
+ private final String LOC_FIRST_RIGHT_FIRST_ITEM =
getLoc("FIRST_RIGHT_FIRST_ITEM");
+ private final String LOC_FIRST_BUTTON_COPY_ALL =
getLoc("FIRST_BUTTON_COPY_ALL");
+ private final String LOC_FIRST_BUTTON_COPY = getLoc("FIRST_BUTTON_COPY");
+ private final String LOC_FIRST_BUTTON_REMOVE =
getLoc("FIRST_BUTTON_REMOVE");
+ private final String LOC_FIRST_BUTTON_REMOVE_ALL =
getLoc("FIRST_BUTTON_REMOVE_ALL");
+
+ private final String LOC_SECOND_EXAMPLE_HEADER =
getLoc("SECOND_EXAMPLE_HEADER");
+ private final String LOC_SECOND_LEFT_ITEMS = getLoc("SECOND_LEFT_ITEMS");
+ private final String LOC_SECOND_LEFT_FIRST_ITEM =
getLoc("SECOND_LEFT_FIRST_ITEM");
+ private final String LOC_SECOND_RIGHT_ITEMS =
getLoc("SECOND_RIGHT_ITEMS");
+ private final String LOC_SECOND_RIGHT_FIRST_ITEM =
getLoc("SECOND_RIGHT_FIRST_ITEM");
+ private final String LOC_SECOND_BUTTON_COPY_ALL =
getLoc("SECOND_BUTTON_COPY_ALL");
+ private final String LOC_SECOND_BUTTON_COPY =
getLoc("SECOND_BUTTON_COPY");
+ private final String LOC_SECOND_BUTTON_REMOVE =
getLoc("SECOND_BUTTON_REMOVE");
+ private final String LOC_SECOND_BUTTON_REMOVE_ALL =
getLoc("SECOND_BUTTON_REMOVE_ALL");
+
+ private final String LOC_SECOND_CHOSEN_OPTIONS_UL =
getLoc("SECOND_CHOSEN_OPTIONS_UL");
+ private final String LOC_SECOND_CHOSEN_OPTIONS_LI =
getLoc("SECOND_CHOSEN_OPTIONS_LI");
+ private final String LOC_SECOND_CHOSEN_OPTIONS_LI1 =
getLoc("SECOND_CHOSEN_OPTIONS_LI1");
+
+ /**
+ * Test first pick list. It checks that there are some items on the left and no items
on the right.
+ */
+ @Test
+ public void testFirstPickList() {
+ scrollIntoView(LOC_FIRST_EXAMPLE_HEADER, true);
+
+ int count = selenium.getXpathCount(LOC_FIRST_LEFT_ITEMS).intValue();
+ assertTrue(count > 0, "There are no lines in the upper left
table.");
- private final String leftLowerTable =
"//fieldset[2]/div/form/table/tbody/tr/td[1]/table/tbody/tr/td[1]/div/table/tbody/tr/td/div/div/table/tbody";
- private final String lowerButtons =
"//fieldset[2]/div/form/table/tbody/tr/td[1]/table/tbody/tr/td[2]/div";
- private final String rightLowerTable =
"//fieldset[2]/div/form/table/tbody/tr/td[1]/table/tbody/tr/td[3]/div/table/tbody/tr/td/div/div/table/tbody";
- private final String chosenOptions =
"//fieldset[2]/div/form/table/tbody/tr/td[2]/div/div[2]";
+ count = selenium.getXpathCount(LOC_FIRST_RIGHT_ITEMS).intValue();
+ assertEquals(count, 0, "There should be no lines in the upper right
table.");
+ }
- @Test
- public void testUpperPickList() {
- int count = selenium.getXpathCount(leftUpperTable + "/tr").intValue();
- assertTrue(count > 0, "There are no lines in the upper left table.");
+ /**
+ * Tests the button copy in the first example.
+ */
+ @Test
+ public void testFirstCopySingleItem() {
+ scrollIntoView(LOC_FIRST_EXAMPLE_HEADER, true);
+
+ int count = selenium.getXpathCount(LOC_FIRST_LEFT_ITEMS).intValue();
- count = selenium.getXpathCount(rightUpperTable + "/tr").intValue();
- assertEquals(count, 0,
- "There should be no lines in the upper right table.");
- }
+ selenium.click(LOC_FIRST_LEFT_FIRST_ITEM);
+ selenium.click(LOC_FIRST_BUTTON_COPY);
- @Test
- public void testUpperCopySingleFile() {
- int count = selenium.getXpathCount(leftUpperTable + "/tr").intValue();
+ int newCount = selenium.getXpathCount(LOC_FIRST_LEFT_ITEMS).intValue();
+ assertEquals(newCount, count - 1, "There should be less lines in the left
table.");
+ }
- // click the first line
- selenium.click(leftUpperTable + "/tr[1]");
- // click 'Copy'
- selenium.click(upperButtons + "/div[3]");
+ // @Test
+ // public void testFirstCopyMultipleItemsShift() {
+ // fail("TODO");
+ // }
+ //
+ // @Test
+ // public void testFirstCopyMultipleItemsCtrl() {
+ // fail("TODO");
+ // }
- int newCount = selenium.getXpathCount(leftUpperTable + "/tr")
- .intValue();
- assertEquals(newCount, count - 1,
- "There should be less lines in the left table.");
- }
+ /**
+ * Tests the button copy all in the first example.
+ */
+ @Test
+ public void testFirstCopyAll() {
+ scrollIntoView(LOC_FIRST_EXAMPLE_HEADER, true);
+
+ int count = selenium.getXpathCount(LOC_FIRST_LEFT_ITEMS).intValue();
- // @Test
- // public void testUpperCopyMultipleFilesShift() {
- // fail("TODO");
- // }
- //
- // @Test
- // public void testUpperCopyMultipleFilesCtrl() {
- // fail("TODO");
- // }
+ selenium.click(LOC_FIRST_BUTTON_COPY_ALL);
- @Test
- public void testUpperCopyAll() {
- int count = selenium.getXpathCount(leftUpperTable + "/tr").intValue();
+ int newCount = selenium.getXpathCount(LOC_FIRST_LEFT_ITEMS).intValue();
+ assertEquals(newCount, 0, "There should be no lines in the left
table.");
- // click 'Copy All'
- selenium.click(upperButtons + "/div[1]");
+ newCount = selenium.getXpathCount(LOC_FIRST_RIGHT_ITEMS).intValue();
+ assertEquals(newCount, count, "All items from left table should be now in
the right table.");
+ }
- int newCount = selenium.getXpathCount(leftUpperTable + "/tr")
- .intValue();
- assertEquals(newCount, 0, "There should be no lines in the left table.");
+ /**
+ * Tests the button remove in the first example.
+ */
+ @Test
+ public void testFirstRemoveSingleItem() {
+ scrollIntoView(LOC_FIRST_EXAMPLE_HEADER, true);
+
+ selenium.click(LOC_FIRST_BUTTON_COPY_ALL);
- newCount = selenium.getXpathCount(rightUpperTable + "/tr").intValue();
- assertEquals(newCount, count,
- "All items from left table should be now in the right table.");
- }
+ int count = selenium.getXpathCount(LOC_FIRST_RIGHT_ITEMS).intValue();
- @Test
- public void testUpperRemoveSingleFile() {
- // click 'Copy All'
- selenium.click(upperButtons + "/div[1]");
+ selenium.click(LOC_FIRST_RIGHT_FIRST_ITEM);
+ selenium.click(LOC_FIRST_BUTTON_REMOVE);
- int count = selenium.getXpathCount(rightUpperTable + "/tr").intValue();
+ int newCount = selenium.getXpathCount(LOC_FIRST_RIGHT_ITEMS).intValue();
+ assertEquals(newCount, count - 1, "There should be less lines in the right
table.");
+ }
- // click the first line
- selenium.click(rightUpperTable + "/tr[1]");
- // click 'Remove'
- selenium.click(upperButtons + "/div[5]");
+ // @Test
+ // public void testFirstRemoveMultipleItemsShift() {
+ // fail("TODO");
+ // }
+ //
+ // @Test
+ // public void testFirstRemoveMultipleItemsCtrl() {
+ // fail("TODO");
+ // }
- int newCount = selenium.getXpathCount(rightUpperTable + "/tr")
- .intValue();
- assertEquals(newCount, count - 1,
- "There should be less lines in the right table.");
- }
+ /**
+ * Tests the button remove all in the first example.
+ */
+ @Test
+ public void testFirstRemoveAll() {
+ scrollIntoView(LOC_FIRST_EXAMPLE_HEADER, true);
+
+ int count = selenium.getXpathCount(LOC_FIRST_LEFT_ITEMS).intValue();
- // @Test
- // public void testUpperRemoveMultipleFilesShift() {
- // fail("TODO");
- // }
- //
- // @Test
- // public void testUpperRemoveMultipleFilesCtrl() {
- // fail("TODO");
- // }
+ selenium.click(LOC_FIRST_BUTTON_COPY_ALL);
+ selenium.click(LOC_FIRST_BUTTON_REMOVE_ALL);
- @Test
- public void testUpperRemoveAll() {
- int count = selenium.getXpathCount(leftUpperTable + "/tr").intValue();
+ int newCount = selenium.getXpathCount(LOC_FIRST_RIGHT_ITEMS).intValue();
+ assertEquals(newCount, 0, "There should be no lines in the right
table.");
- // click 'Copy All'
- selenium.click(upperButtons + "/div[1]");
+ newCount = selenium.getXpathCount(LOC_FIRST_LEFT_ITEMS).intValue();
+ assertEquals(newCount, count, "All items from right table should be now in
the left table.");
+ }
- // click 'Remove All'
- selenium.click(upperButtons + "/div[7]");
+ /**
+ * Tests the second pick list. It checks that there is something on the left, nothing
on the right, and "chosen options" is empty.
+ */
+ @Test
+ public void testSecondPickList() {
+ scrollIntoView(LOC_SECOND_EXAMPLE_HEADER, true);
+
+ int count = selenium.getXpathCount(LOC_SECOND_LEFT_ITEMS).intValue();
+ assertTrue(count > 0, "There are no lines in the lower left
table.");
- int newCount = selenium.getXpathCount(rightUpperTable + "/tr")
- .intValue();
- assertEquals(newCount, 0,
- "There should be no lines in the right table.");
+ count = selenium.getXpathCount(LOC_SECOND_RIGHT_ITEMS).intValue();
+ assertEquals(count, 0, "There should be no lines in the lower right
table.");
- newCount = selenium.getXpathCount(leftUpperTable + "/tr").intValue();
- assertEquals(newCount, count,
- "All items from right table should be now in the left table.");
- }
+ boolean empty = !selenium.isElementPresent(LOC_SECOND_CHOSEN_OPTIONS_UL);
+ assertTrue(empty, "Chosen options should not contain any items.");
+ }
- @Test
- public void testLowerPickList() {
- int count = selenium.getXpathCount(leftLowerTable + "/tr").intValue();
- assertTrue(count > 0, "There are no lines in the lower left table.");
+ /**
+ * Tests the button copy in the second example.
+ */
+ @Test
+ public void testSecondCopySingleItem() {
+ scrollIntoView(LOC_SECOND_EXAMPLE_HEADER, true);
+
+ int count = selenium.getXpathCount(LOC_SECOND_LEFT_ITEMS).intValue();
- count = selenium.getXpathCount(rightLowerTable + "/tr").intValue();
- assertEquals(count, 0,
- "There should be no lines in the lower right table.");
+ selenium.click(LOC_SECOND_LEFT_FIRST_ITEM);
+ selenium.click(LOC_SECOND_BUTTON_COPY);
- boolean empty = !selenium.isElementPresent(chosenOptions + "/ul");
- assertTrue(empty, "Chosen options should not contain any items.");
- }
+ int newCount = selenium.getXpathCount(LOC_SECOND_LEFT_ITEMS).intValue();
+ assertEquals(newCount, count - 1, "There should be less lines in the left
table.");
- @Test
- public void testLowerCopySingleFile() {
- int count = selenium.getXpathCount(leftLowerTable + "/tr").intValue();
+ count = selenium.getXpathCount(LOC_SECOND_CHOSEN_OPTIONS_LI).intValue();
+ assertEquals(count, 1, "There should be only one capital city.");
- // click the first line
- selenium.click(leftLowerTable + "/tr[1]");
- // click 'Copy'
- selenium.click(lowerButtons + "/div[3]");
+ String capital = selenium.getText(LOC_SECOND_CHOSEN_OPTIONS_LI1);
+ assertEquals(capital, "Montgomery", "Capital of Alaska.");
+ }
- int newCount = selenium.getXpathCount(leftLowerTable + "/tr")
- .intValue();
- assertEquals(newCount, count - 1,
- "There should be less lines in the left table.");
+ // @Test
+ // public void testSecondCopyMultipleItemsShift() {
+ // fail("TODO");
+ // }
+ //
+ // @Test
+ // public void testSecondCopyMultipleItemsCtrl() {
+ // fail("TODO");
+ // }
- count = selenium.getXpathCount(chosenOptions + "/ul/li").intValue();
- assertEquals(count, 1, "There should be only one capital city.");
+ /**
+ * Tests the button copy all in the second example.
+ */
+ @Test
+ public void testSecondCopyAll() {
+ scrollIntoView(LOC_SECOND_EXAMPLE_HEADER, true);
+
+ int count = selenium.getXpathCount(LOC_SECOND_LEFT_ITEMS).intValue();
- String capital = selenium.getText(chosenOptions + "/ul/li[1]");
- assertEquals(capital, "Montgomery", "Capital of Alaska.");
- }
+ selenium.click(LOC_SECOND_BUTTON_COPY_ALL);
- // @Test
- // public void testLowerCopyMultipleFilesShift() {
- // fail("TODO");
- // }
- //
- // @Test
- // public void testLowerCopyMultipleFilesCtrl() {
- // fail("TODO");
- // }
+ int newCount = selenium.getXpathCount(LOC_SECOND_LEFT_ITEMS).intValue();
+ assertEquals(newCount, 0, "There should be no lines in the left
table.");
- @Test
- public void testLowerCopyAll() {
- int count = selenium.getXpathCount(leftLowerTable + "/tr").intValue();
+ newCount = selenium.getXpathCount(LOC_SECOND_RIGHT_ITEMS).intValue();
+ assertEquals(newCount, count, "All items from left table should be now in
the right table.");
- // click 'Copy All'
- selenium.click(lowerButtons + "/div[1]");
+ newCount = selenium.getXpathCount(LOC_SECOND_CHOSEN_OPTIONS_LI).intValue();
+ assertEquals(newCount, count, "Not all capital cities were displayed in the
panel.");
+ }
- int newCount = selenium.getXpathCount(leftLowerTable + "/tr")
- .intValue();
- assertEquals(newCount, 0, "There should be no lines in the left table.");
+ /**
+ * Tests the button remove in the second example.
+ */
+ @Test
+ public void testSecondRemoveSingleItem() {
+ scrollIntoView(LOC_SECOND_EXAMPLE_HEADER, true);
- newCount = selenium.getXpathCount(rightLowerTable + "/tr").intValue();
- assertEquals(newCount, count,
- "All items from left table should be now in the right table.");
+ selenium.click(LOC_SECOND_BUTTON_COPY_ALL);
- newCount = selenium.getXpathCount(chosenOptions + "/ul/li").intValue();
- assertEquals(newCount, count,
- "Not all capital cities were displayed in the panel.");
- }
+ int count = selenium.getXpathCount(LOC_SECOND_RIGHT_ITEMS).intValue();
- @Test
- public void testLowerRemoveSingleFile() {
- // click 'Copy All'
- selenium.click(lowerButtons + "/div[1]");
+ selenium.click(LOC_SECOND_RIGHT_FIRST_ITEM);
+ selenium.click(LOC_SECOND_BUTTON_REMOVE);
- int count = selenium.getXpathCount(rightLowerTable + "/tr").intValue();
+ int newCount = selenium.getXpathCount(LOC_SECOND_RIGHT_ITEMS).intValue();
+ assertEquals(newCount, count - 1, "There should be less lines in the right
table.");
- // click the first line
- selenium.click(rightLowerTable + "/tr[1]");
- // click 'Remove'
- selenium.click(lowerButtons + "/div[5]");
+ newCount = selenium.getXpathCount(LOC_SECOND_CHOSEN_OPTIONS_LI).intValue();
+ assertEquals(newCount, count - 1, "The capital city was not removed from
panel.");
+ }
- int newCount = selenium.getXpathCount(rightLowerTable + "/tr")
- .intValue();
- assertEquals(newCount, count - 1,
- "There should be less lines in the right table.");
+ // @Test
+ // public void testSecondRemoveMultipleItemsShift() {
+ // fail("TODO");
+ // }
+ //
+ // @Test
+ // public void testSecondRemoveMultipleItemsCtrl() {
+ // fail("TODO");
+ // }
- newCount = selenium.getXpathCount(chosenOptions + "/ul/li").intValue();
- assertEquals(newCount, count - 1,
- "The capital city was not removed from panel.");
- }
+ /**
+ * Tests the button remove all in the second example.
+ */
+ @Test
+ public void testSecondRemoveAll() {
+ scrollIntoView(LOC_SECOND_EXAMPLE_HEADER, true);
- // @Test
- // public void testLowerRemoveMultipleFilesShift() {
- // fail("TODO");
- // }
- //
- // @Test
- // public void testLowerRemoveMultipleFilesCtrl() {
- // fail("TODO");
- // }
+ int count = selenium.getXpathCount(LOC_SECOND_LEFT_ITEMS).intValue();
- @Test
- public void testLowerRemoveAll() {
- int count = selenium.getXpathCount(leftLowerTable + "/tr").intValue();
+ selenium.click(LOC_SECOND_BUTTON_COPY_ALL);
+ selenium.click(LOC_SECOND_BUTTON_REMOVE_ALL);
- // click 'Copy All'
- selenium.click(lowerButtons + "/div[1]");
+ int newCount = selenium.getXpathCount(LOC_SECOND_RIGHT_ITEMS).intValue();
+ assertEquals(newCount, 0, "There should be no lines in the right
table.");
- // click 'Remove All'
- selenium.click(lowerButtons + "/div[7]");
+ newCount = selenium.getXpathCount(LOC_SECOND_LEFT_ITEMS).intValue();
+ assertEquals(newCount, count, "All items from right table should be now in
the left table.");
- int newCount = selenium.getXpathCount(rightLowerTable + "/tr")
- .intValue();
- assertEquals(newCount, 0,
- "There should be no lines in the right table.");
+ count = selenium.getXpathCount(LOC_SECOND_CHOSEN_OPTIONS_LI).intValue();
+ assertEquals(count, 0, "All capitals from the panel should be
removed.");
+ }
- newCount = selenium.getXpathCount(leftLowerTable + "/tr").intValue();
- assertEquals(newCount, count,
- "All items from right table should be now in the left table.");
+ /**
+ * 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 testFirstPickListSource() {
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
"<rich:pickList>",
+ "<f:selectItem itemLabel=\"Option 1\"
itemValue=\"1\"/>",
+ "<f:selectItem itemLabel=\"Option 2\"
itemValue=\"2\"/>",
+ "<f:selectItem itemLabel=\"Option 3\"
itemValue=\"3\"/>",
+ "<f:selectItem itemLabel=\"Option 4\"
itemValue=\"4\"/>",
+ "<f:selectItem itemLabel=\"Option 5\"
itemValue=\"5\"/>", "</rich:pickList>", };
- count = selenium.getXpathCount(chosenOptions + "/ul/li").intValue();
- assertEquals(count, 0, "All capitals from the panel should be removed.");
- }
+ abstractTestSource(1, "View Source", strings);
+ }
- @Test
- public void testUpperPickListSource() {
- abstractTestSource(1, 1, "<", "ui:composition");
- }
+ /**
+ * Tests the "View Source" in the second example. It checks that the
source
+ * code is not visible, clicks on the link, and checks 5 lines of source
+ * code.
+ */
+ @Test
+ public void testSecondPickListSource() {
+ String[] strings = new String[] {
+ "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<h:panelGrid columns=\"2\" columnClasses=\"top,
top\">",
+ "<rich:pickList value=\"#{pickListBean.result}\">
",
+ "<f:selectItems
value=\"#{capitalsBean.capitalsOptions}\"/>",
+ "<a4j:support event=\"onlistchanged\"
reRender=\"result\"/>",
+ "<rich:panel id=\"result\"
bodyClass=\"pbody\">",
+ "<f:facet name=\"header\">",
+ "<h:outputText value=\"#{pickListBean.items} Options
Choosen\"></h:outputText>",
+ "<rich:dataList value=\"#{pickListBean.result}\"
var=\"pickList\" rendered=\"#{pickListBean.items>0}\"> ",
+ "<h:outputText value=\"#{pickList}\"/>", };
- @Test
- public void testLowerPickListSource() {
- abstractTestSource(2, 1, "<", "ui:composition");
- }
+ abstractTestSource(2, "View Source", strings);
+ }
- /**
- * Loads the needed page.
- */
- @BeforeMethod
- private void loadPage() {
- super.loadPage("richSelect", 3,
- "Pick List component is a simple selection component");
-
- // click 'Remove All'
- selenium.click(upperButtons + "/div[7]");
- selenium.click(lowerButtons + "/div[7]");
- }
+ /**
+ * Loads the needed page.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Pick List");
+ }
}
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-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spinner/SpinnerTestCase.java 2009-09-10
15:46:40 UTC (rev 15532)
@@ -1,20 +1,24 @@
/*
* 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
+ * Copyright 2009, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
- * This 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.
- */
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
package org.jboss.richfaces.integrationTest.spinner;
Added:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/listShuttle/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/listShuttle/locators.properties
(rev 0)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/listShuttle/locators.properties 2009-09-10
15:46:40 UTC (rev 15532)
@@ -0,0 +1,16 @@
+EXAMPLE_HEADER=//fieldset/legend
+LEFT_TABLE_LINES=//fieldset/div/form/table[2]/tbody/tr[2]/td[1]/div/table/tbody/tr/td/div/div/table/tbody/tr
+RIGHT_TABLE_LINES=//fieldset/div/form/table[2]/tbody/tr[2]/td[3]/div/table/tbody/tr/td/div/div/table/tbody/tr
+LEFT_TABLE_LINE_1=//fieldset/div/form/table[2]/tbody/tr[2]/td[1]/div/table/tbody/tr/td/div/div/table/tbody/tr[1]
+RIGHT_TABLE_LINE_PREFORMATTED=//fieldset/div/form/table[2]/tbody/tr[2]/td[3]/div/table/tbody/tr/td/div/div/table/tbody/tr[{0}]
+TOOLBAR_ITEMS=//fieldset/div/form/table[1]/tbody/tr[1]/td[contains(@class,'rich-toolbar-item')]
+TOOLBAR_ITEM_PREFORMATTED=//fieldset/div/form/table[1]/tbody/tr/td[{0}*2-1]
+
+COPY_ALL_BUTTON=//fieldset/div/form/table[2]/tbody/tr[2]/td[2]/div/div[1]
+COPY_BUTTON=//fieldset/div/form/table[2]/tbody/tr[2]/td[2]/div/div[3]
+REMOVE_BUTTON=//fieldset/div/form/table[2]/tbody/tr[2]/td[2]/div/div[5]
+REMOVE_ALL_BUTTON=//fieldset/div/form/table[2]/tbody/tr[2]/td[2]/div/div[7]
+FIRST_BUTTON=//fieldset/div/form/table[2]/tbody/tr[2]/td[4]/div/div[1]
+UP_BUTTON=//fieldset/div/form/table[2]/tbody/tr[2]/td[4]/div/div[3]
+DOWN_BUTTON=//fieldset/div/form/table[2]/tbody/tr[2]/td[4]/div/div[5]
+LAST_BUTTON=//fieldset/div/form/table[2]/tbody/tr[2]/td[4]/div/div[7]
Property changes on:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/listShuttle/locators.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/listShuttle/messages.properties
===================================================================
Property changes on:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/listShuttle/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/modalPanel/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/modalPanel/locators.properties 2009-09-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/modalPanel/locators.properties 2009-09-10
15:46:40 UTC (rev 15532)
@@ -1,6 +1,6 @@
FIRST_EXAMPLE_HEADER=//fieldset[1]/legend
FIRST_PANEL=//div[contains(@class, 'rich-modalpanel') and contains(@id,
'panelContainer')]
-FIRST_PANEL_POSITION=//div[contains(@class, 'rich-modalpanel') and contains(@id,
'panelContainer')]/div[2]/div@style
+FIRST_PANEL_POSITION=//div[contains(@class, 'rich-modalpanel') and contains(@id,
'panelContainer')]/div[2]/div
FIRST_PANEL_OPEN=//fieldset[1]/div/a
FIRST_PANEL_CLOSE=//div[contains(@class, 'rich-modalpanel') and contains(@id,
'panelContainer')]/div[2]/div/div[2]/div/img
FIRST_PANEL_HEADER=//div[contains(@class, 'rich-modalpanel') and contains(@id,
'panelContainer')]/div[2]/div/div[2]/table/tbody/tr[1]/td/div
@@ -8,7 +8,7 @@
SECOND_EXAMPLE_HEADER=//fieldset[2]/legend
SECOND_PANEL=//div[@id='mpContainer']
-SECOND_PANEL_POSITION=//div[@id='mpContainer']/div[2]/div@style
+SECOND_PANEL_POSITION=//div[@id='mpContainer']/div[2]/div
SECOND_PANEL_OPEN=//fieldset[2]/div/a
SECOND_PANEL_CLOSE=//div[@id='mpContainer']/div[2]/div/div[2]/table/tbody/tr[2]/td/p[3]/a
SECOND_PANEL_HEADER=//div[@id='mpContainer']/div[2]/div/div[2]/table/tbody/tr[1]/td/div
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/modalPanel/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/modalPanel/messages.properties 2009-09-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/modalPanel/messages.properties 2009-09-10
15:46:40 UTC (rev 15532)
@@ -1,10 +1,4 @@
-COMPONENT_DESCRIPTION=RichFaces Modal Panel is a container that blocks an operation on
the base page when the modal panel is shown.
-FIRST_PANEL_NOT_VISIBLE=The first panel should not be visible.
-FIRST_PANEL_VISIBLE=The first panel should be visible.
-FIRST_PANEL_WRONG_CONTENT=The content of the first panel is wrong.
-FIRST_PANEL_WRONG_HEADER=The header of the first panel is wrong.
-
-SECOND_PANEL_NOT_VISIBLE=The second panel should not be visible.
-SECOND_PANEL_VISIBLE=The second panel should be visible.
-SECOND_PANEL_WRONG_CONTENT=The content of the second panel is wrong.
-SECOND_PANEL_WRONG_HEADER=The header of the second panel is wrong.
\ No newline at end of file
+FIRST_PANEL_HEADER=Modal Panel
+FIRST_PANEL_CONTENT=This panel is called using Component Control Component \nClosure link
(X) works also through Component Control
+SECOND_PANEL_HEADER=Modal Panel Title
+SECOND_PANEL_CONTENT=Any JSF content might be inside the panel.
\ No newline at end of file
Added:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/orderingList/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/orderingList/locators.properties
(rev 0)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/orderingList/locators.properties 2009-09-10
15:46:40 UTC (rev 15532)
@@ -0,0 +1,10 @@
+EXAMPLE_HEADER=//fieldset[1]/legend
+TABLE_LINES=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/table/tbody/tr[2]/td[1]/div/div[2]/table/tbody/tr
+TABLE_LINE_PREFORMATTED=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/table/tbody/tr[2]/td[1]/div/div[2]/table/tbody/tr[{0}]/td[1]
+SELECTION=//fieldset[1]/div/form/table/tbody/tr/td[2]/div/div[2]
+SELECTION_PREFORMATTED=//fieldset[1]/div/form/table/tbody/tr/td[2]/div/div[2]/ul/li[{0}]
+
+BUTTON_FIRST=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/table/tbody/tr[2]/td[2]/div/div[1]
+BUTTON_UP=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/table/tbody/tr[2]/td[2]/div/div[3]
+BUTTON_DOWN=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/table/tbody/tr[2]/td[2]/div/div[5]
+BUTTON_LAST=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/table/tbody/tr[2]/td[2]/div/div[7]
\ No newline at end of file
Property changes on:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/orderingList/locators.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/orderingList/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/orderingList/messages.properties
(rev 0)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/orderingList/messages.properties 2009-09-10
15:46:40 UTC (rev 15532)
@@ -0,0 +1 @@
+ORDERING_LIST_SELECTION=No Songs Selected
\ No newline at end of file
Property changes on:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/orderingList/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/paint2d/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/paint2d/messages.properties 2009-09-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/paint2d/messages.properties 2009-09-10
15:46:40 UTC (rev 15532)
@@ -1,5 +1,47 @@
-TEXT_IN_IMAGE=Text in the image.
-COLOR_OF_IMAGE=Color of the image.
-SHADOW_SIZE=Size of the shadow.
-POSITION_OF_SLIDERS_HANDLE=Position of the slider's handle.
-IMAGE_HASH=Hash of the image.
\ No newline at end of file
+INITIAL_STATE_INPUT_TEXT=Paint 2D
+INITIAL_STATE_INPUT_COLOR=0003e8
+INITIAL_STATE_SHADOW_SLIDER_HANDLE=127
+INITIAL_STATE_HASH=da54ff0e62ee33804e270a863d7001a4
+
+CHANGE_TEXT_HASH_1=490d3b23e3f8c19290d3fbe351409be
+CHANGE_TEXT_HASH_2=f56c23afa5207cfdea008d298480c750
+
+CHANGE_COLOR_HASH_1=8f71bfc38cf5a26cdd548d3bb0f67291
+CHANGE_COLOR_HASH_2=6623c69f0397e00a955ed6bbb41e68e1
+
+CHANGE_SHADOW_SLIDER_HANDLE_1=0
+CHANGE_SHADOW_SLIDER_HANDLE_2=96
+CHANGE_SHADOW_SLIDER_HANDLE_3=191
+CHANGE_SHADOW_HASH_1=6f15cab627ffd32528a66ef9731990a2
+CHANGE_SHADOW_HASH_2=19063b8ea31e2939699abd7dc92cf23e
+CHANGE_SHADOW_HASH_3=d9e5b2f628d230b7dc41b8ece16a83ff
+
+CHANGE_TEXT_AND_COLOR_HASH=a18ff3c5c86154fc1c3ca2a59e60bbbf
+
+CHANGE_TEXT_AND_SHADOW_SLIDER_HANDLE=159
+CHANGE_TEXT_AND_SHADOW_HASH=74e992e595303a2f16c72a178a116189
+
+CHANGE_COLOR_AND_SHADOW_SLIDER_HANDLE=96
+CHANGE_COLOR_AND_SHADOW_HASH=fd6a4503b768b0a197851b78948b497c
+
+CHANGE_ALL_SLIDER_HANDLE=127
+CHANGE_ALL_HASH=f2016d2528b7d288f752bdaaefc7a666
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panel/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panel/messages.properties 2009-09-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panel/messages.properties 2009-09-10
15:46:40 UTC (rev 15532)
@@ -8,9 +8,12 @@
THIRD_HEADER=Header of the main panel in the third examnple.
# second tab
-CUST_PANEL_HEADER=Header of the panel.
-CUST_CLASS_HEADER=The "class" attribute of the header should contain
"rich-panel-header".
-CUST_THIRD_HEADER=Header of the third panel should be green -- its class attribute has to
contain "head2".
-CUST_THIRD_BODY=Body of the third panel should be green -- its class attribute has to
contain "body3".
-CUST_FOURTH_PANEL_BODY_SCROLLABLE=Body of the fourth panel should be scrollable -- its
class attribute has to contain "body3".
-CUST_FIFTH_PANEL_NO_HEADER=The fifth panel should have no header.
\ No newline at end of file
+CUST_FIRST_HEADER=Panel #1. Changing Style Synchronously
+CUST_FIRST_CLASS=rich-panel-header
+CUST_SECOND_HEADER=Panel #2. Changing Style Synchronously
+CUST_SECOND_CLASS=rich-panel-header
+CUST_THIRD_CLASS_1=head2
+CUST_THIRD_CLASS_2=body3
+CUST_FOURTH_HEADER=Scrolling Text Panel
+CUST_FOURTH_CLASS=body3
+CUST_FIFTH_COUNT=1
\ No newline at end of file
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panelMenu/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panelMenu/locators.properties 2009-09-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panelMenu/locators.properties 2009-09-10
15:46:40 UTC (rev 15532)
@@ -1,23 +1,22 @@
EXAMPLE_HEADER=//fieldset/legend
PANEL=//span[@id='form:current']
-GROUP_N_IMAGE_BEFORE=//form[@id='form']/table/tbody/tr/td[1]/div/div[%d]/table/tbody/tr/td[1]/img@src
-GROUP_N_IMAGE_AFTER=//form[@id='form']/table/tbody/tr/td[1]/div/div[%d]/table/tbody/tr/td[3]/img@src
-GROUP_N_TEXT=//form[@id='form']/table/tbody/tr/td[1]/div/div[%d]/table/tbody/tr/td[2]
+GROUP_N_IMAGE_BEFORE=//form[@id='form']/table/tbody/tr/td[1]/div/div[{0}]/table/tbody/tr/td[1]/img@src
+GROUP_N_IMAGE_AFTER=//form[@id='form']/table/tbody/tr/td[1]/div/div[{0}]/table/tbody/tr/td[3]/img@src
+GROUP_N_TEXT=//form[@id='form']/table/tbody/tr/td[1]/div/div[{0}]/table/tbody/tr/td[2]
-ITEM_M_N_IMAGE_BEFORE=//form[@id='form']/table/tbody/tr/td[1]/div/div[%d]/div[%d]/table/tbody/tr/td[1]/img[2]@src
-ITEM_M_N_IMAGE_AFTER=//form[@id='form']/table/tbody/tr/td[1]/div/div[%d]/div[%d]/table/tbody/tr/td[3]/img@src
-ITEM_M_N_TEXT=//form[@id='form']/table/tbody/tr/td[1]/div/div[%d]/div[%d]/table/tbody/tr/td[2]
-ITEM_M_N_STYLE=//form[@id='form']/table/tbody/tr/td[1]/div/div[%d]/div[%d]@style
-SUBITEM_GROUP=//*[@class\='rich-pmenu']/*[contains(@class,'top-group')][2]/div[*[@class\='rich-pmenu-group']]
-
-SUBITEM_M_IMAGE_BEFORE_RELATIVE_TO_GROUP={0}/div[%d]/table/tbody/tr/td[1]/img[3]@src
-SUBITEM_M_TEXT_RELATIVE_TO_GROUP={0}/div[%d]/table/tbody/tr/td[2]
-SUBITEM_M_STYLE_RELATIVE_TO_GROUP={0}/div[%d]@style
+ITEM_M_N_IMAGE_BEFORE=//form[@id='form']/table/tbody/tr/td[1]/div/div[{0}]/div[{1}]/table/tbody/tr/td[1]/img[2]@src
+ITEM_M_N_IMAGE_AFTER=//form[@id='form']/table/tbody/tr/td[1]/div/div[{0}]/div[{1}]/table/tbody/tr/td[3]/img@src
+ITEM_M_N_TEXT=//form[@id='form']/table/tbody/tr/td[1]/div/div[{0}]/div[{1}]/table/tbody/tr/td[2]
+ITEM_M_N_STYLE=//form[@id='form']/table/tbody/tr/td[1]/div/div[{0}]/div[{1}]
+SUBITEM_M_IMAGE=//fieldset//div[contains(@class,'rich-pmenu')]/div[2]/div[4]/div[{0}]/table/tbody/tr/td[1]/img[3]@src
+SUBITEM_M_TEXT=//fieldset//div[contains(@class,'rich-pmenu')]/div[2]/div[4]/div[{0}]/table/tbody/tr/td[2]
+SUBITEM_M_STYLE=//fieldset//div[contains(@class,'rich-pmenu')]/div[2]/div[4]/div[{0}]
+
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panelMenu/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panelMenu/messages.properties 2009-09-10
15:37:39 UTC (rev 15531)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/panelMenu/messages.properties 2009-09-10
15:46:40 UTC (rev 15532)
@@ -1,4 +1,3 @@
-COMPONENT_DESCRIPTION=The rich:panelMenu component is used to define a collapsible
side-menu panel.
CONTENT_OF_PANEL_ON_LOAD=Content of the panel after the page is loaded.
CONTENT_OF_PANEL=Content of the panel.
IMAGE_BEFORE_GROUP_NAME=There should be a spacer before group name.
Added:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/pickList/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/pickList/locators.properties
(rev 0)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/pickList/locators.properties 2009-09-10
15:46:40 UTC (rev 15532)
@@ -0,0 +1,23 @@
+FIRST_EXAMPLE_HEADER=//fieldset[1]/legend
+FIRST_LEFT_ITEMS=//fieldset[1]/div/table/tbody/tr/td[1]/div/table/tbody/tr/td/div/div/table/tbody/tr
+FIRST_LEFT_FIRST_ITEM=//fieldset[1]/div/table/tbody/tr/td[1]/div/table/tbody/tr/td/div/div/table/tbody/tr[1]
+FIRST_RIGHT_ITEMS=//fieldset[1]/div/table/tbody/tr/td[3]/div/table/tbody/tr/td/div/div/table/tbody/tr
+FIRST_RIGHT_FIRST_ITEM=//fieldset[1]/div/table/tbody/tr/td[3]/div/table/tbody/tr/td/div/div/table/tbody/tr[1]
+FIRST_BUTTON_COPY_ALL=//fieldset[1]/div/table/tbody/tr/td[2]/div/div[1]
+FIRST_BUTTON_COPY=//fieldset[1]/div/table/tbody/tr/td[2]/div/div[3]
+FIRST_BUTTON_REMOVE=//fieldset[1]/div/table/tbody/tr/td[2]/div/div[5]
+FIRST_BUTTON_REMOVE_ALL=//fieldset[1]/div/table/tbody/tr/td[2]/div/div[7]
+
+SECOND_EXAMPLE_HEADER=//fieldset[1]/legend
+SECOND_LEFT_ITEMS=//fieldset[2]/div/form/table/tbody/tr/td[1]/table/tbody/tr/td[1]/div/table/tbody/tr/td/div/div/table/tbody/tr
+SECOND_LEFT_FIRST_ITEM=//fieldset[2]/div/form/table/tbody/tr/td[1]/table/tbody/tr/td[1]/div/table/tbody/tr/td/div/div/table/tbody/tr[1]
+SECOND_RIGHT_ITEMS=//fieldset[2]/div/form/table/tbody/tr/td[1]/table/tbody/tr/td[3]/div/table/tbody/tr/td/div/div/table/tbody/tr
+SECOND_RIGHT_FIRST_ITEM=//fieldset[2]/div/form/table/tbody/tr/td[1]/table/tbody/tr/td[3]/div/table/tbody/tr/td/div/div/table/tbody/tr[1]
+SECOND_BUTTON_COPY_ALL=//fieldset[2]/div/form/table/tbody/tr/td[1]/table/tbody/tr/td[2]/div/div[1]
+SECOND_BUTTON_COPY=//fieldset[2]/div/form/table/tbody/tr/td[1]/table/tbody/tr/td[2]/div/div[3]
+SECOND_BUTTON_REMOVE=//fieldset[2]/div/form/table/tbody/tr/td[1]/table/tbody/tr/td[2]/div/div[5]
+SECOND_BUTTON_REMOVE_ALL=//fieldset[2]/div/form/table/tbody/tr/td[1]/table/tbody/tr/td[2]/div/div[7]
+
+SECOND_CHOSEN_OPTIONS_UL=//fieldset[2]/div/form/table/tbody/tr/td[2]/div/div[2]/ul
+SECOND_CHOSEN_OPTIONS_LI=//fieldset[2]/div/form/table/tbody/tr/td[2]/div/div[2]/ul/li
+SECOND_CHOSEN_OPTIONS_LI1=//fieldset[2]/div/form/table/tbody/tr/td[2]/div/div[2]/ul/li[1]
\ No newline at end of file
Property changes on:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/pickList/locators.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/pickList/messages.properties
===================================================================
Property changes on:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/pickList/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain