Author: ppitonak(a)redhat.com
Date: 2009-09-09 09:44:10 -0400 (Wed, 09 Sep 2009)
New Revision: 15505
Added:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dropDownMenu/
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dropDownMenu/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dropDownMenu/messages.properties
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuImageTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuTableTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dropDownMenu/HorizontalMenuTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/AdvancedEditorTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/SimpleEditorTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/fileUpload/FileUploadTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inplaceInput/InplaceInputTestCase.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/contextMenu/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/contextMenu/messages.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/editor/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/editor/messages.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/fileUpload/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/fileUpload/messages.properties
Log:
* SpinnerTestCase, InplaceInputTestCase, FileUploadTestCase, SimpleEditorTestCase,
AdvancedEditorTestCase, HorizontalMenuTestCase, ContextMenuTableTestCase and
ContextMenuImageTestCase refactored
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuImageTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuImageTestCase.java 2009-09-09
13:25:06 UTC (rev 15504)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuImageTestCase.java 2009-09-09
13:44:10 UTC (rev 15505)
@@ -33,11 +33,11 @@
*/
public class ContextMenuImageTestCase extends AbstractSeleniumRichfacesTestCase {
- private final String LOC_HEADER = getLoc("HEADER");
- private final String LOC_IMAGE = getLoc("IMAGE");
- private final String LOC_CONTEXT_MENU = getLoc("CONTEXT_MENU");
- private final String LOC_ZOOM_IN = getLoc("ZOOM_IN");
- private final String LOC_ZOOM_OUT = getLoc("ZOOM_OUT");
+ private final String LOC_FIRST_HEADER = getLoc("FIRST_HEADER");
+ private final String LOC_FIRST_IMAGE = getLoc("FIRST_IMAGE");
+ private final String LOC_FIRST_CONTEXT_MENU =
getLoc("FIRST_CONTEXT_MENU");
+ private final String LOC_FIRST_ZOOM_IN = getLoc("FIRST_ZOOM_IN");
+ private final String LOC_FIRST_ZOOM_OUT = getLoc("FIRST_ZOOM_OUT");
/**
* Clicks into image and verifies that the context menu is displayed.
@@ -45,11 +45,11 @@
@Test
public void testImageContextMenu() {
// open context menu
- selenium.fireEvent(LOC_IMAGE, "contextmenu");
+ selenium.fireEvent(LOC_FIRST_IMAGE, "contextmenu");
// check that context menu is visible
- waitForElement(LOC_CONTEXT_MENU);
- assertTrue(isDisplayed(LOC_CONTEXT_MENU), "Context menu should be
visible.");
+ waitForElement(LOC_FIRST_CONTEXT_MENU);
+ assertTrue(isDisplayed(LOC_FIRST_CONTEXT_MENU), "Context menu should be
visible.");
}
/**
@@ -60,25 +60,25 @@
@Test
public void testZoomIn() {
// get the size of image at the beginning
- int originalWidth = selenium.getElementWidth(LOC_IMAGE).intValue();
- int originalHeight = selenium.getElementHeight(LOC_IMAGE).intValue();
+ int originalWidth = selenium.getElementWidth(LOC_FIRST_IMAGE).intValue();
+ int originalHeight = selenium.getElementHeight(LOC_FIRST_IMAGE).intValue();
// open context menu
- selenium.fireEvent(LOC_IMAGE, "contextmenu");
- waitForElement(LOC_ZOOM_IN);
+ selenium.fireEvent(LOC_FIRST_IMAGE, "contextmenu");
+ waitForElement(LOC_FIRST_ZOOM_IN);
// zoom in
- selenium.click(LOC_ZOOM_IN);
- selenium.click(LOC_ZOOM_IN);
- selenium.click(LOC_ZOOM_IN);
- selenium.click(LOC_ZOOM_IN);
+ selenium.click(LOC_FIRST_ZOOM_IN);
+ selenium.click(LOC_FIRST_ZOOM_IN);
+ selenium.click(LOC_FIRST_ZOOM_IN);
+ selenium.click(LOC_FIRST_ZOOM_IN);
// get the size of image after zooming in
- int width = selenium.getElementWidth(LOC_IMAGE).intValue();
+ int width = selenium.getElementWidth(LOC_FIRST_IMAGE).intValue();
assertTrue(width > originalWidth, format(
"After zooming in, the image should be bigger (width {0}px ->
{1}px).", originalWidth, width));
- int height = selenium.getElementHeight(LOC_IMAGE).intValue();
+ int height = selenium.getElementHeight(LOC_FIRST_IMAGE).intValue();
assertTrue(height > originalHeight, format(
"After zooming in, the image should be bigger (height {0}px ->
{1}px).", originalHeight, height));
}
@@ -91,25 +91,25 @@
@Test
void testZoomOut() {
// get the size of image at the beginning
- int originalWidth = selenium.getElementWidth(LOC_IMAGE).intValue();
- int originalHeight = selenium.getElementHeight(LOC_IMAGE).intValue();
+ int originalWidth = selenium.getElementWidth(LOC_FIRST_IMAGE).intValue();
+ int originalHeight = selenium.getElementHeight(LOC_FIRST_IMAGE).intValue();
// open context menu
- selenium.fireEvent(LOC_IMAGE, "contextmenu");
- waitForElement(LOC_ZOOM_OUT);
+ selenium.fireEvent(LOC_FIRST_IMAGE, "contextmenu");
+ waitForElement(LOC_FIRST_ZOOM_OUT);
// zoom out
- selenium.click(LOC_ZOOM_OUT);
- selenium.click(LOC_ZOOM_OUT);
- selenium.click(LOC_ZOOM_OUT);
- selenium.click(LOC_ZOOM_OUT);
+ selenium.click(LOC_FIRST_ZOOM_OUT);
+ selenium.click(LOC_FIRST_ZOOM_OUT);
+ selenium.click(LOC_FIRST_ZOOM_OUT);
+ selenium.click(LOC_FIRST_ZOOM_OUT);
// get the size of image after zooming out
- int width = selenium.getElementWidth(LOC_IMAGE).intValue();
+ int width = selenium.getElementWidth(LOC_FIRST_IMAGE).intValue();
assertTrue(originalWidth > width, format(
"After zooming out, the image should be smaller (width {0}px ->
{1}px).", originalWidth, width));
- int height = selenium.getElementHeight(LOC_IMAGE).intValue();
+ int height = selenium.getElementHeight(LOC_FIRST_IMAGE).intValue();
assertTrue(originalHeight > height, format(
"After zooming out, the image should be smaller (height {0}px ->
{1}px).", originalHeight, height));
}
@@ -123,24 +123,24 @@
@Test
void testZoomInZoomOut() {
// get the size of image at the beginning
- int originalWidth = selenium.getElementWidth(LOC_IMAGE).intValue();
- int originalHeight = selenium.getElementHeight(LOC_IMAGE).intValue();
+ int originalWidth = selenium.getElementWidth(LOC_FIRST_IMAGE).intValue();
+ int originalHeight = selenium.getElementHeight(LOC_FIRST_IMAGE).intValue();
// open context menu
- selenium.fireEvent(LOC_IMAGE, "contextmenu");
- waitForElement(LOC_ZOOM_IN);
+ selenium.fireEvent(LOC_FIRST_IMAGE, "contextmenu");
+ waitForElement(LOC_FIRST_ZOOM_IN);
- selenium.click(LOC_ZOOM_IN);
- selenium.click(LOC_ZOOM_OUT);
+ selenium.click(LOC_FIRST_ZOOM_IN);
+ selenium.click(LOC_FIRST_ZOOM_OUT);
// get the size of image after zooming in and out
// it does not zoom accurately so there has to be some tolerance
- int width = selenium.getElementWidth(LOC_IMAGE).intValue();
+ int width = selenium.getElementWidth(LOC_FIRST_IMAGE).intValue();
assertTrue(Math.abs(width - originalWidth) < 3, format(
"After zooming in and out, the image should have the same size
(width {0}px -> {1}px).", originalWidth,
width));
- int height = selenium.getElementHeight(LOC_IMAGE).intValue();
+ int height = selenium.getElementHeight(LOC_FIRST_IMAGE).intValue();
assertTrue(Math.abs(height - originalHeight) < 3, format(
"After zooming in and out, the image should have the same size
(height {0}px -> {1}px).",
originalHeight, height));
@@ -168,12 +168,13 @@
/**
* Loads the needed page.
*/
+ @SuppressWarnings("unused")
@BeforeMethod
private void loadPage() {
openComponent("Context Menu");
// XXX: context menu opens in top left corner so it isn't visible if it
// scrolls down
- // scrollIntoView(LOC_HEADER, true);
+ // scrollIntoView(LOC_FIRST_HEADER, true);
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuTableTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuTableTestCase.java 2009-09-09
13:25:06 UTC (rev 15504)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/contextMenu/ContextMenuTableTestCase.java 2009-09-09
13:44:10 UTC (rev 15505)
@@ -1,3 +1,21 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
package org.jboss.richfaces.integrationTest.contextMenu;
import static org.testng.Assert.assertEquals;
@@ -2,2 +20,3 @@
import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
@@ -9,153 +28,179 @@
import org.testng.annotations.Test;
/**
+ * Tests context menu in the example with table.
*
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
public class ContextMenuTableTestCase extends AbstractSeleniumRichfacesTestCase {
- private String xpathPrefix;
+ private final String LOC_SECOND_EXAMPLE_HEADER =
getLoc("SECOND_EXAMPLE_HEADER");
+ private final String LOC_SECOND_CONTEXT_MENU =
getLoc("SECOND_CONTEXT_MENU");
+ private final String LOC_SECOND_LAST_MENU_ACTION =
getLoc("SECOND_LAST_MENU_ACTION");
- @Test
- public void testTableContextMenu() {
- xpathPrefix = "//fieldset[2]/div/form";
+ private final String LOC_SECOND_CAR_DETAILS =
getLoc("SECOND_CAR_DETAILS");
+ private final String LOC_SECOND_ACTIONS = getLoc("SECOND_ACTIONS");
+ private final String LOC_SECOND_ACTION_PREFORMATTED =
getLoc("SECOND_ACTION_PREFORMATTED");
- // check that the context menu is not visible
- boolean present = selenium.isElementPresent(xpathPrefix + "/div/div");
- assertFalse(present, "Context menu should be invisible at start.");
+ private final String LOC_SECOND_LINE_3_COLUMN_1 =
getLoc("SECOND_LINE_3_COLUMN_1");
+ private final String LOC_SECOND_LINE_3_COLUMN_2 =
getLoc("SECOND_LINE_3_COLUMN_2");
+ private final String LOC_SECOND_LINE_6_COLUMN_2 =
getLoc("SECOND_LINE_6_COLUMN_2");
+ private final String LOC_SECOND_LINE_1_COLUMN_3 =
getLoc("SECOND_LINE_1_COLUMN_3");
- // check that the 'Last Menu Action' is empty
- String text = selenium.getText(xpathPrefix
- + "/table/tbody/tr/td[2]/span/div/div[2]");
- assertEquals(text, "", "Last menu action should be empty.");
+ private final String MSG_SECOND_CAR_DETAILS_PREFORMATTED =
getMsg("SECOND_CAR_DETAILS_PREFORMATTED");
+ private final String MSG_SECOND_PUT_PRODUCER_MODEL_TO_BASKET_PREFORMATTED =
getMsg("SECOND_PUT_PRODUCER_MODEL_TO_BASKET_PREFORMATTED");
+ private final String MSG_SECOND_READ_COMMENTS_PREFORMATTED =
getMsg("SECOND_READ_COMMENTS_PREFORMATTED");
+ private final String MSG_SECOND_GO_TO_PRODUCER_SITE_PREFORMATTED =
getMsg("SECOND_GO_TO_PRODUCER_SITE_PREFORMATTED");
- // open context menu on third line, first column
- selenium.click(xpathPrefix
- + "/table/tbody/tr/td[1]/table/tbody/tr[3]/td[1]");
- waitForElement(xpathPrefix + "/div/div/div[1]");
- text = selenium.getAttribute(xpathPrefix + "/div/div/div[1]@style");
- assertFalse(text.contains("display: none;"),
- "Context menu should be visible after clicking on first column.");
+ /**
+ * Tests context menu. It checks that context menu is not visible at start,
+ * clicks into various places in table and checks that menu appeared.
+ */
+ @Test
+ public void testTableContextMenu() {
+ // check that the context menu is not visible
+ boolean present = selenium.isElementPresent(LOC_SECOND_CONTEXT_MENU);
+ assertFalse(present, "Context menu should be invisible at start.");
- // open context menu on sixth line, second column
- selenium.click(xpathPrefix
- + "/table/tbody/tr/td[1]/table/tbody/tr[6]/td[2]");
- waitForElement(xpathPrefix + "/div/div/div[1]");
- text = selenium.getAttribute(xpathPrefix + "/div/div/div[1]@style");
- assertFalse(text.contains("display: none;"),
- "Context menu should be visible after clicking on second column.");
+ // check that the 'Last Menu Action' is empty
+ String text = selenium.getText(LOC_SECOND_LAST_MENU_ACTION);
+ assertEquals(text, "", "Last menu action should be empty.");
- // open context menu on first line, third column (16773)
- selenium.click(xpathPrefix
- + "/table/tbody/tr/td[1]/table/tbody/tr[1]/td[3]");
- waitForElement(xpathPrefix + "/div/div/div[1]");
- text = selenium.getAttribute(xpathPrefix + "/div/div/div[1]@style");
- assertFalse(text.contains("display: none;"),
- "Context menu should be visible after clicking on third column.");
- }
+ // open context menu on third line, first column
+ selenium.click(LOC_SECOND_LINE_3_COLUMN_1);
+ waitForElement(LOC_SECOND_CONTEXT_MENU);
+ assertTrue(isDisplayed(LOC_SECOND_CONTEXT_MENU),
+ "Context menu should be visible after clicking on first
column.");
- @Test
- public void testClickOnCarDetails() {
- xpathPrefix = "//fieldset[2]/div/form";
- String text = null;
+ // open context menu on sixth line, second column
+ selenium.click(LOC_SECOND_LINE_6_COLUMN_2);
+ waitForElement(LOC_SECOND_CONTEXT_MENU);
+ assertTrue(isDisplayed(LOC_SECOND_CONTEXT_MENU),
+ "Context menu should be visible after clicking on second
column.");
- String producer = selenium.getText(xpathPrefix
- + "/table/tbody/tr/td[1]/table/tbody/tr[3]/td[1]");
- String model = selenium.getText(xpathPrefix
- + "/table/tbody/tr/td[1]/table/tbody/tr[3]/td[2]");
+ // open context menu on first line, third column
+ selenium.click(LOC_SECOND_LINE_1_COLUMN_3);
+ waitForElement(LOC_SECOND_CONTEXT_MENU);
+ assertTrue(isDisplayed(LOC_SECOND_CONTEXT_MENU),
+ "Context menu should be visible after clicking on third
column.");
+ }
- // open context menu on third line, first column
- selenium.click(xpathPrefix
- + "/table/tbody/tr/td[1]/table/tbody/tr[3]/td[1]");
- waitForElement(xpathPrefix + "/div/div/div[1]");
- text = selenium.getAttribute(xpathPrefix + "/div/div/div[1]@style");
- assertFalse(text.contains("display: none;"),
- "Context menu should be visible after clicking on first column.");
+ /**
+ * Tests clicking on "Car Details" in context menu".
+ */
+ @Test
+ public void testClickOnCarDetails() {
+ String producer = selenium.getText(LOC_SECOND_LINE_3_COLUMN_1);
+ String model = selenium.getText(LOC_SECOND_LINE_3_COLUMN_2);
- // click '<car> details'
- selenium.click(xpathPrefix + "/div/div/div[1]/div/div[1]/span[2]");
- waitFor(400);
- text = selenium.getText(xpathPrefix
- + "/table/tbody/tr/td[2]/span/div/div[2]");
- assertEquals(text, producer + " " + model + " details",
- "Details of car:");
- }
+ // open context menu on third line, first column
+ selenium.click(LOC_SECOND_LINE_3_COLUMN_1);
+ waitForElement(LOC_SECOND_CONTEXT_MENU);
+ assertTrue(isDisplayed(LOC_SECOND_CONTEXT_MENU),
+ "Context menu should be visible after clicking on first
column.");
- @Test
- public void testClickOnPutCarToBasket() {
- clickAction(1);
- }
+ // click '<car> details'
+ selenium.click(LOC_SECOND_CAR_DETAILS);
+ waitFor(400);
+ String text = selenium.getText(LOC_SECOND_LAST_MENU_ACTION);
+ assertEquals(text, format(MSG_SECOND_CAR_DETAILS_PREFORMATTED, producer, model),
"Details of car.");
+ }
- @Test
- public void testClickOnReadComments() {
- clickAction(2);
- }
+ /**
+ * Tests clicking on "Put Car to Basket" in context menu.
+ */
+ @Test
+ public void testClickOnPutCarToBasket() {
+ clickAction(1);
+ }
- @Test
- public void testClickOnGoToProducerSite() {
- clickAction(3);
- }
+ /**
+ * Tests clicking on "Read Comments" in context menu.
+ */
+ @Test
+ public void testClickOnReadComments() {
+ clickAction(2);
+ }
- @Test
- public void testContextMenuTableSource() {
- abstractTestSource(2, 1, "<", "f:subview");
- }
+ /**
+ * Tests clicking on "Go to Producer Site" in context menu.
+ */
+ @Test
+ public void testClickOnGoToProducerSite() {
+ clickAction(3);
+ }
- private void clickAction(int index) {
- xpathPrefix = "//fieldset[2]/div/form";
- String text = null;
+ /**
+ * Tests the "View Source". It checks that the source code is not visible,
+ * clicks on the link, and checks 15 lines of source code.
+ */
+ @Test
+ public void testContextMenuTableSource() {
+ String[] strings = new String[] { "<f:subview
xmlns=\"http://www.w3.org/1999/xhtml\"", "<h:form
id=\"form\">",
+ "<rich:contextMenu attached=\"false\"
id=\"menu\" submitMode=\"ajax\">",
+ "<rich:menuItem ajaxSingle=\"true\">",
+ "<a4j:actionparam name=\"det\"
assignTo=\"#{ddmenu.current}\" value=\"{car} {model}
details\"/>",
+ "<rich:menuGroup value=\"Actions\"> ",
"<rich:menuItem value=\"Read Comments\"
ajaxSingle=\"true\">",
+ "<rich:dataTable
value=\"#{dataTableScrollerBean.tenRandomCars}\" var=\"car\"
id=\"table\"",
+
"onRowMouseOver=\"this.style.backgroundColor='#F8F8F8'\"",
+
"onRowMouseOut=\"this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'\"
rowClasses=\"cur\">",
+ "<rich:column>", "<rich:componentControl
event=\"onRowClick\" for=\"menu\"
operation=\"show\">",
+ "<f:param value=\"#{car.model}\"
name=\"model\"/>", "<a4j:outputPanel
ajaxRendered=\"true\">",
+ "<f:facet name=\"header\">Last Menu
Action</f:facet>", };
- String producer = selenium.getText(xpathPrefix
- + "/table/tbody/tr/td[1]/table/tbody/tr[3]/td[1]");
- String model = selenium.getText(xpathPrefix
- + "/table/tbody/tr/td[1]/table/tbody/tr[3]/td[2]");
+ abstractTestSource(2, "View Source", strings);
+ }
- // open context menu on third line, first column
- selenium.click(xpathPrefix
- + "/table/tbody/tr/td[1]/table/tbody/tr[3]/td[1]");
- waitForElement(xpathPrefix + "/div/div/div[1]");
- text = selenium.getAttribute(xpathPrefix + "/div/div/div[1]@style");
- assertFalse(text.contains("display: none;"),
- "Context menu should be visible after clicking on first column.");
+ /**
+ * Helper method that performs clicks on items in submenu of context menu.
+ *
+ * @param index
+ * which action should be performed
+ */
+ private void clickAction(int index) {
+ String producer = selenium.getText(LOC_SECOND_LINE_3_COLUMN_1);
+ String model = selenium.getText(LOC_SECOND_LINE_3_COLUMN_2);
- // click 'Actions'
- selenium.click(xpathPrefix + "/div/div/div[2]");
- waitFor(400);
+ // open context menu on third line, first column
+ selenium.click(LOC_SECOND_LINE_3_COLUMN_1);
+ waitForElement(LOC_SECOND_CONTEXT_MENU);
+ assertTrue(isDisplayed(LOC_SECOND_CONTEXT_MENU),
+ "Context menu should be visible after clicking on first
column.");
- // click 'Put <car> To Basket'
- selenium.click(xpathPrefix + "/div/div/div[2]/div/div[" + index
- + "]/span[2]");
- waitFor(400);
- text = selenium.getText(xpathPrefix
- + "/table/tbody/tr/td[2]/span/div/div[2]");
+ // click 'Actions'
+ selenium.click(LOC_SECOND_ACTIONS);
+ waitFor(400);
- switch (index) {
- case 1:
- assertEquals(text, "Put " + producer + " " + model + " To
Basket",
- "Action put to basket:");
- break;
- case 2:
- assertEquals(text, "Read Comments", "Action read comments:");
- break;
- case 3:
- assertEquals(text, "Go to " + producer + " site",
- "Action go to site:");
- break;
- default:
- fail("Wrong index.");
- }
- }
+ // click "Put <car> To Basket", "Read Comments" or
+ // "Go to <producer> site"
+ selenium.click(format(LOC_SECOND_ACTION_PREFORMATTED, index));
+ waitFor(400);
+ String text = selenium.getText(LOC_SECOND_LAST_MENU_ACTION);
- /**
- * Loads the needed page.
- */
- @BeforeMethod
- private void loadPage() {
- super
- .loadPage(
- "richMenu",
- 1,
- "RichFaces Context menu is a component that allows to organize the
hierarchical context menus");
- }
+ switch (index) {
+ case 1:
+ assertEquals(text,
format(MSG_SECOND_PUT_PRODUCER_MODEL_TO_BASKET_PREFORMATTED, producer, model),
+ "Action put to basket:");
+ break;
+ case 2:
+ assertEquals(text, MSG_SECOND_READ_COMMENTS_PREFORMATTED, "Action read
comments:");
+ break;
+ case 3:
+ assertEquals(text, format(MSG_SECOND_GO_TO_PRODUCER_SITE_PREFORMATTED,
producer), "Action go to site:");
+ break;
+ default:
+ fail("Wrong index.");
+ }
+ }
+
+ /**
+ * Loads the needed page.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Context Menu");
+ scrollIntoView(LOC_SECOND_EXAMPLE_HEADER, true);
+ }
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dropDownMenu/HorizontalMenuTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dropDownMenu/HorizontalMenuTestCase.java 2009-09-09
13:25:06 UTC (rev 15504)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dropDownMenu/HorizontalMenuTestCase.java 2009-09-09
13:44:10 UTC (rev 15505)
@@ -1,6 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
package org.jboss.richfaces.integrationTest.dropDownMenu;
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
@@ -8,116 +27,131 @@
import org.testng.annotations.Test;
/**
+ * Test horizontal version of drop down menu.
*
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
public class HorizontalMenuTestCase extends AbstractSeleniumRichfacesTestCase {
- private String xpathPrefix;
+ private final String LOC_FIRST_EXAMPLE_HEADER =
getLoc("FIRST_EXAMPLE_HEADER");
+ private final String LOC_FIRST_CURRENT_SELECTION =
getLoc("FIRST_CURRENT_SELECTION");
+ private final String LOC_FIRST_MENU = getLoc("FIRST_MENU");
+ private final String LOC_FIRST_MENU_NEW = getLoc("FIRST_MENU_NEW");
+ private final String LOC_FIRST_MENU_SAVE_ALL =
getLoc("FIRST_MENU_SAVE_ALL");
+ private final String LOC_FIRST_MENU_SEPARATOR =
getLoc("FIRST_MENU_SEPARATOR");
+ private final String LOC_FIRST_MENU_IMAGE = getLoc("FIRST_MENU_IMAGE");
+ private final String LOC_FIRST_MENU_LINK_HOMEPAGE =
getLoc("FIRST_MENU_LINK_HOMEPAGE");
+ private final String LOC_FIRST_MENU_LINK_FORUM =
getLoc("FIRST_MENU_LINK_FORUM");
- @Test
- public void testHorizontalMenu() {
- xpathPrefix = "//fieldset[1]/div/form/table/tbody/tr/td[1]";
+ private final String MSG_FIRST_INITIAL_CURRENT_SELECTION =
getMsg("FIRST_INITIAL_CURRENT_SELECTION");
+ private final String MSG_FIRST_CURRENT_SELECTION_NEW =
getMsg("FIRST_CURRENT_SELECTION_NEW");
+ private final String MSG_FIRST_CURRENT_SELECTION_SAVE_ALL =
getMsg("FIRST_CURRENT_SELECTION_SAVE_ALL");
- String text = selenium.getAttribute(xpathPrefix
- + "/div/div[2]/div[1]@style");
- assertTrue(text.contains("display: none;"),
- "Menu should not be expanded at start.");
+ /**
+ * Checks that menu is not shown at start and verifies that text in current
+ * selection area is empty.
+ */
+ @Test
+ public void testHorizontalMenu() {
+ assertFalse(isDisplayed(LOC_FIRST_MENU), "Menu should not be expanded at
start.");
- // FIXME menu does not show after click or fireEvent
- // click on 'File'
- // selenium.click(xpathPrefix + "/div/div[1]/img");
- // selenium.fireEvent(xpathPrefix + "/div/div[1]/img", "click");
- // waitFor(1000);
- // text = selenium.getAttribute(xpathPrefix +
- // "/div/div[2]/div[1]@style");
- // System.out.println("------------- " + text + "
------------------");
- // assertFalse(text.contains("display: none;"),
- // "Menu should be expanded after clicking on File.");
+ String text = selenium.getText(LOC_FIRST_CURRENT_SELECTION);
+ assertEquals(text, MSG_FIRST_INITIAL_CURRENT_SELECTION, "Last menu action
should be empty.");
+ }
- // check that the 'Last Menu Action' is empty
- text = selenium.getText("//fieldset[1]/div/span[1]/span[1]");
- assertEquals(text, "", "Last menu action should be empty.");
- }
+ /**
+ * Tests the "New" menu item. It clicks the item and verifies that text is
+ * shown in current selection.
+ */
+ @Test
+ public void testMenuItem() {
+ selenium.click(LOC_FIRST_MENU_NEW);
+ waitFor(400);
- @Test
- public void testMenuItem() {
- xpathPrefix =
"//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div[2]/div/div/div[1]";
- String text = null;
+ String text = selenium.getText(LOC_FIRST_CURRENT_SELECTION);
+ assertEquals(text, MSG_FIRST_CURRENT_SELECTION_NEW, "Text shown in current
selection.");
+ }
- selenium.click(xpathPrefix);
- waitFor(400);
+ /**
+ * Tests menu group. It chooses "Save All" from the group "Save
as...".
+ */
+ @Test
+ public void testMenuGroup() {
+ selenium.click(LOC_FIRST_MENU_SAVE_ALL);
+ waitFor(400);
- text = selenium.getText("//fieldset[1]/div/span/span");
- assertEquals(text, "New", "Text shown in 'Current
Selection:'");
- }
+ String text = selenium.getText(LOC_FIRST_CURRENT_SELECTION);
+ assertEquals(text, MSG_FIRST_CURRENT_SELECTION_SAVE_ALL, "Text shown in
'Current Selection:'");
+ }
- @Test
- public void testMenuGroup() {
- xpathPrefix =
"//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div[2]/div[2]/div/div[2]";
- String text = null;
+ /**
+ * Tests separator in menu.
+ */
+ @Test
+ public void testSeparator() {
+ assertTrue(belongsClass("rich-menu-separator",
LOC_FIRST_MENU_SEPARATOR),
+ "There should be a separator in the menu.");
+ }
- selenium.click(xpathPrefix);
- waitFor(400);
+ /**
+ * Tests icon next to menu item.
+ */
+ @Test
+ public void testIcon() {
+ int width = selenium.getElementWidth(LOC_FIRST_MENU_IMAGE).intValue();
+ int height = selenium.getElementHeight(LOC_FIRST_MENU_IMAGE).intValue();
- text = selenium.getText("//fieldset[1]/div/span/span");
- assertEquals(text, "Save All", "Text shown in 'Current
Selection:'");
- }
+ assertTrue(width > 0, "Menu item \"File\" should have a visible
icon (width > 0).");
+ assertTrue(height > 0, "Menu item \"File\" should have a
visible icon (height > 0).");
+ }
- @Test
- public void testSeparator() {
- xpathPrefix =
"//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div[2]/div[1]/div/div[5]";
- String text = null;
+ /**
+ * Tests link to the RichFaces homepage.
+ */
+ @Test
+ public void testLinkRFHomePage() {
+ String location = selenium.getAttribute(LOC_FIRST_MENU_LINK_HOMEPAGE +
"@href");
+ assertTrue(location.contains("http://"), "Href has to contain
http://");
+ }
- text = selenium.getAttribute(xpathPrefix + "@class");
- assertTrue(text.equals("rich-menu-separator"),
- "There should be a separator in the menu.");
- }
+ /**
+ * Tests link to the RichFaces forum.
+ */
+ @Test
+ public void testLinkRFForum() {
+ String location = selenium.getAttribute(LOC_FIRST_MENU_LINK_FORUM +
"@href");
+ assertTrue(location.contains("http://"), "Href has to contain
http://");
+ }
- @Test
- public void testIcon() {
- xpathPrefix = "//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div[1]/img";
+ /**
+ * Tests the "View Source". It checks that the source code is not visible,
+ * clicks on the link, and checks 17 lines of source code.
+ */
+ @Test
+ public void testHorizontalMenuSource() {
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"", "<h:form>",
+ "<rich:toolBar>", "<rich:dropDownMenu>",
"<f:facet name=\"label\"> ",
+ "<h:graphicImage value=\"/images/icons/copy.gif\"
styleClass=\"pic\"/>",
+ "<rich:menuItem submitMode=\"ajax\"
value=\"New\"",
+ "action=\"#{ddmenu.doNew}\"
icon=\"/images/icons/create_doc.gif\">",
+ "<rich:menuGroup value=\"Save As...\">",
"<rich:menuItem submitMode=\"ajax\" value=\"Save\" ",
+ "action=\"#{ddmenu.doSave}\"
icon=\"/images/icons/save.gif\" />",
+ "<rich:menuItem submitMode=\"ajax\" value=\"Save
All\"", "action=\"#{ddmenu.doSaveAll}\">",
+ "<f:facet name=\"icon\">",
"<h:graphicImage value=\"/images/icons/save_all.gif\" />",
+ "<rich:menuSeparator id=\"menuSeparator11\"
/>",
+ "<h:outputLink
value=\"http://labs.jboss.com/jbossrichfaces/\">", };
- int width = selenium.getElementWidth(xpathPrefix).intValue();
- int height = selenium.getElementHeight(xpathPrefix).intValue();
+ abstractTestSource(1, "View Source", strings);
+ }
- assertTrue(width > 0,
- "Menu item 'File' should have a visible icon (width > 0).");
- assertTrue(height > 0,
- "Menu item 'File' should have a visible icon (height > 0).");
- }
-
- @Test
- public void testLinkRFHomePage() {
- xpathPrefix =
"//fieldset[1]/div/form/table/tbody/tr/td[2]/div/div[2]/div/div/div[1]/span[2]/a";
-
- String location = selenium.getAttribute(xpathPrefix + "@href");
- assertTrue(location.contains("http://"), "Href has to contain
http://");
- }
-
- @Test
- public void testLinkRFForum() {
- xpathPrefix =
"//fieldset[1]/div/form/table/tbody/tr/td[2]/div/div[2]/div/div/div[2]/span[2]/a";
-
- String location = selenium.getAttribute(xpathPrefix + "@href");
- assertTrue(location.contains("http://"), "Href has to contain
http://");
- }
-
- @Test
- public void testListShuttleSource() {
- abstractTestSource(1, 1, "<", "ui:composition");
- }
-
- /**
- * Loads the needed page.
- */
- @BeforeMethod
- private void loadPage() {
- super
- .loadPage(
- "richMenu",
- 2,
- "RichFaces Drop Down menu is a component that allows to organize the
hierarchical menu");
- }
+ /**
+ * Loads the page containing needed component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Drop Down Menu");
+ scrollIntoView(LOC_FIRST_EXAMPLE_HEADER, true);
+ }
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/AdvancedEditorTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/AdvancedEditorTestCase.java 2009-09-09
13:25:06 UTC (rev 15504)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/AdvancedEditorTestCase.java 2009-09-09
13:44:10 UTC (rev 15505)
@@ -1,22 +1,19 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces
- *
- * Copyright (C) 2009 Red Hat, Inc.
- *
- * This code is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this code; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
*/
package org.jboss.richfaces.integrationTest.editor;
@@ -73,7 +70,7 @@
private final String LOC_TEXT_AREA = getLoc("TEXT_AREA");
private final String LOC_IFRAME = getLoc("IFRAME");
private final String LOC_ADV_DIALOG_IFRAME = getLoc("ADV_DIALOG_IFRAME");
-
+
private final String LOC_TEXT_AREA_P = getLoc("TEXT_AREA_P");
private final String LOC_TEXT_AREA_P_A = getLoc("TEXT_AREA_P_A");
private final String LOC_TEXT_AREA_P_IMG = getLoc("TEXT_AREA_P_IMG");
@@ -411,20 +408,20 @@
}
selenium.click(LOC_ADV_ALIGN_LEFT_BUTTON);
- attr = selenium.getAttribute(LOC_TEXT_AREA_P + "@style");
- assertEquals(attr, "text-align: left;",
String.format(MSG_PARAGRAPH_ALIGNED_TO_THE_SIDE_S, "left"));
+ attr = getStyle(LOC_TEXT_AREA_P, "text-align");
+ assertEquals(attr, "left", format(MSG_PARAGRAPH_ALIGNED_TO_THE_SIDE_S,
"left"));
selenium.click(LOC_ADV_ALIGN_RIGHT_BUTTON);
- attr = selenium.getAttribute(LOC_TEXT_AREA_P + "@style");
- assertEquals(attr, "text-align: right;",
String.format(MSG_PARAGRAPH_ALIGNED_TO_THE_SIDE_S, "right"));
+ attr = getStyle(LOC_TEXT_AREA_P, "text-align");
+ assertEquals(attr, "right", format(MSG_PARAGRAPH_ALIGNED_TO_THE_SIDE_S,
"right"));
selenium.click(LOC_ADV_ALIGN_CENTER_BUTTON);
- attr = selenium.getAttribute(LOC_TEXT_AREA_P + "@style");
- assertEquals(attr, "text-align: center;",
String.format(MSG_PARAGRAPH_ALIGNED_TO_THE_SIDE_S, "center"));
+ attr = getStyle(LOC_TEXT_AREA_P, "text-align");
+ assertEquals(attr, "center",
format(MSG_PARAGRAPH_ALIGNED_TO_THE_SIDE_S, "center"));
selenium.click(LOC_ADV_ALIGN_FULL_BUTTON);
- attr = selenium.getAttribute(LOC_TEXT_AREA_P + "@style");
- assertEquals(attr, "text-align: justify;", MSG_PARAGRAPH_JUSTIFIED);
+ attr = getStyle(LOC_TEXT_AREA_P, "text-align");
+ assertEquals(attr, "justify", MSG_PARAGRAPH_JUSTIFIED);
}
/**
@@ -435,43 +432,37 @@
public void testStyles() {
selenium.typeKeys(LOC_TEXT_AREA, "aaa bbb ccc ddd eee fff ggg");
- String attr = null;
try {
- attr = selenium.getAttribute(LOC_TEXT_AREA_P + "@class");
+ selenium.getAttribute(LOC_TEXT_AREA_P + "@class");
fail(MSG_PARAGRAPH_SHOULD_HAVE_NO_STYLE);
} catch (Exception e) {
// OK - there is no attribute
}
selenium.click(LOC_ADV_STYLE_SELECT_BUTTON);
- selenium.click(String.format(LOC_ADV_STYLE_N, 2));
- attr = selenium.getAttribute(LOC_TEXT_AREA_P + "@class");
- assertEquals(attr, "bold-larger", MSG_PARAGRAPHS_CLASS_ATTRIBUTE);
+ selenium.click(format(LOC_ADV_STYLE_N, 2));
+ assertTrue(belongsClass("bold-larger", LOC_TEXT_AREA_P),
MSG_PARAGRAPHS_CLASS_ATTRIBUTE);
selenium.click(LOC_ADV_STYLE_SELECT_BUTTON);
- selenium.click(String.format(LOC_ADV_STYLE_N, 3));
- attr = selenium.getAttribute(LOC_TEXT_AREA_P + "@class");
- assertEquals(attr, "bold-smaller", MSG_PARAGRAPHS_CLASS_ATTRIBUTE);
+ selenium.click(format(LOC_ADV_STYLE_N, 3));
+ assertTrue(belongsClass("bold-smaller", LOC_TEXT_AREA_P),
MSG_PARAGRAPHS_CLASS_ATTRIBUTE);
selenium.click(LOC_ADV_STYLE_SELECT_BUTTON);
- selenium.click(String.format(LOC_ADV_STYLE_N, 4));
- attr = selenium.getAttribute(LOC_TEXT_AREA_P + "@class");
- assertEquals(attr, "red-bold", MSG_PARAGRAPHS_CLASS_ATTRIBUTE);
+ selenium.click(format(LOC_ADV_STYLE_N, 4));
+ assertTrue(belongsClass("red-bold", LOC_TEXT_AREA_P),
MSG_PARAGRAPHS_CLASS_ATTRIBUTE);
selenium.click(LOC_ADV_STYLE_SELECT_BUTTON);
- selenium.click(String.format(LOC_ADV_STYLE_N, 5));
- attr = selenium.getAttribute(LOC_TEXT_AREA_P + "@class");
- assertEquals(attr, "red-bold-larger", MSG_PARAGRAPHS_CLASS_ATTRIBUTE);
+ selenium.click(format(LOC_ADV_STYLE_N, 5));
+ assertTrue(belongsClass("red-bold-larger", LOC_TEXT_AREA_P),
MSG_PARAGRAPHS_CLASS_ATTRIBUTE);
selenium.click(LOC_ADV_STYLE_SELECT_BUTTON);
- selenium.click(String.format(LOC_ADV_STYLE_N, 6));
- attr = selenium.getAttribute(LOC_TEXT_AREA_P + "@class");
- assertEquals(attr, "red-bold-smaller",
MSG_PARAGRAPHS_CLASS_ATTRIBUTE);
+ selenium.click(format(LOC_ADV_STYLE_N, 6));
+ assertTrue(belongsClass("red-bold-smaller", LOC_TEXT_AREA_P),
MSG_PARAGRAPHS_CLASS_ATTRIBUTE);
selenium.click(LOC_ADV_STYLE_SELECT_BUTTON);
- selenium.click(String.format(LOC_ADV_STYLE_N, 1));
+ selenium.click(format(LOC_ADV_STYLE_N, 1));
try {
- attr = selenium.getAttribute(LOC_TEXT_AREA_P + "@class");
+ selenium.getAttribute(LOC_TEXT_AREA_P + "@class");
fail(MSG_PARAGRAPH_SHOULD_HAVE_NO_STYLE);
} catch (Exception e) {
// OK - there is no attribute
@@ -489,60 +480,60 @@
// initial state
selenium.selectFrame(LOC_IFRAME);
int count = selenium.getXpathCount(LOC_TEXT_AREA_P).intValue();
- assertEquals(count, 1, String.format(MSG_TAG_S_SHOULD_BE_IN_EDITOR,
"p"));
+ assertEquals(count, 1, format(MSG_TAG_S_SHOULD_BE_IN_EDITOR, "p"));
String text = selenium.getText(LOC_TEXT_AREA_P);
- assertEquals(text, "aaa bbb ccc ddd eee fff ggg",
String.format(MSG_CONTENT_OF_TAG_S, "p"));
+ assertEquals(text, "aaa bbb ccc ddd eee fff ggg",
format(MSG_CONTENT_OF_TAG_S, "p"));
selenium.selectFrame("relative=top");
// address
selenium.click(LOC_ADV_FORMAT_SELECT_BUTTON);
- selenium.click(String.format(LOC_ADV_FORMAT_N, 3));
+ selenium.click(format(LOC_ADV_FORMAT_N, 3));
selenium.selectFrame(LOC_IFRAME);
count = selenium.getXpathCount(LOC_TEXT_AREA_ADDRESS).intValue();
- assertEquals(count, 1, String.format(MSG_TAG_S_SHOULD_BE_IN_EDITOR,
"address"));
+ assertEquals(count, 1, format(MSG_TAG_S_SHOULD_BE_IN_EDITOR,
"address"));
text = selenium.getText(LOC_TEXT_AREA_ADDRESS);
- assertEquals(text, "aaa bbb ccc ddd eee fff ggg",
String.format(MSG_CONTENT_OF_TAG_S, "address"));
+ assertEquals(text, "aaa bbb ccc ddd eee fff ggg",
format(MSG_CONTENT_OF_TAG_S, "address"));
selenium.selectFrame("relative=top");
// paragraph
selenium.click(LOC_ADV_FORMAT_SELECT_BUTTON);
- selenium.click(String.format(LOC_ADV_FORMAT_N, 2));
+ selenium.click(format(LOC_ADV_FORMAT_N, 2));
selenium.selectFrame(LOC_IFRAME);
count = selenium.getXpathCount(LOC_TEXT_AREA_P).intValue();
- assertEquals(count, 1, String.format(MSG_TAG_S_SHOULD_BE_IN_EDITOR,
"p"));
+ assertEquals(count, 1, format(MSG_TAG_S_SHOULD_BE_IN_EDITOR, "p"));
text = selenium.getText(LOC_TEXT_AREA_P);
- assertEquals(text, "aaa bbb ccc ddd eee fff ggg",
String.format(MSG_CONTENT_OF_TAG_S, "p"));
+ assertEquals(text, "aaa bbb ccc ddd eee fff ggg",
format(MSG_CONTENT_OF_TAG_S, "p"));
selenium.selectFrame("relative=top");
// preformatted
selenium.click(LOC_ADV_FORMAT_SELECT_BUTTON);
- selenium.click(String.format(LOC_ADV_FORMAT_N, 4));
+ selenium.click(format(LOC_ADV_FORMAT_N, 4));
selenium.selectFrame(LOC_IFRAME);
count = selenium.getXpathCount(LOC_TEXT_AREA_PRE).intValue();
- assertEquals(count, 1, String.format(MSG_TAG_S_SHOULD_BE_IN_EDITOR,
"pre"));
+ assertEquals(count, 1, format(MSG_TAG_S_SHOULD_BE_IN_EDITOR, "pre"));
text = selenium.getText(LOC_TEXT_AREA_PRE);
- assertEquals(text, "aaa bbb ccc ddd eee fff ggg",
String.format(MSG_CONTENT_OF_TAG_S, "pre"));
+ assertEquals(text, "aaa bbb ccc ddd eee fff ggg",
format(MSG_CONTENT_OF_TAG_S, "pre"));
selenium.selectFrame("relative=top");
// change back to the initial state by clicking on "Format"
selenium.click(LOC_ADV_FORMAT_SELECT_BUTTON);
- selenium.click(String.format(LOC_ADV_FORMAT_N, 1));
+ selenium.click(format(LOC_ADV_FORMAT_N, 1));
selenium.selectFrame(LOC_IFRAME);
count = selenium.getXpathCount(LOC_TEXT_AREA_P).intValue();
- assertEquals(count, 1, String.format(MSG_TAG_S_SHOULD_BE_IN_EDITOR,
"p"));
+ assertEquals(count, 1, format(MSG_TAG_S_SHOULD_BE_IN_EDITOR, "p"));
text = selenium.getText(LOC_TEXT_AREA_P);
- assertEquals(text, "aaa bbb ccc ddd eee fff ggg",
String.format(MSG_CONTENT_OF_TAG_S, "p"));
+ assertEquals(text, "aaa bbb ccc ddd eee fff ggg",
format(MSG_CONTENT_OF_TAG_S, "p"));
selenium.selectFrame("relative=top");
// heading 1-6
for (int i = 1; i < 7; i++) {
selenium.click(LOC_ADV_FORMAT_SELECT_BUTTON);
- selenium.click(String.format(LOC_ADV_FORMAT_N, 4 + i));
+ selenium.click(format(LOC_ADV_FORMAT_N, 4 + i));
selenium.selectFrame(LOC_IFRAME);
- count = selenium.getXpathCount(String.format(LOC_TEXT_AREA_HN,
i)).intValue();
- assertEquals(count, 1, String.format(MSG_TAG_S_SHOULD_BE_IN_EDITOR,
"h" + i));
- text = selenium.getText(String.format(LOC_TEXT_AREA_HN, i));
- assertEquals(text, "aaa bbb ccc ddd eee fff ggg",
String.format(MSG_CONTENT_OF_TAG_S, "h" + i));
+ count = selenium.getXpathCount(format(LOC_TEXT_AREA_HN, i)).intValue();
+ assertEquals(count, 1, format(MSG_TAG_S_SHOULD_BE_IN_EDITOR, "h" +
i));
+ text = selenium.getText(format(LOC_TEXT_AREA_HN, i));
+ assertEquals(text, "aaa bbb ccc ddd eee fff ggg",
format(MSG_CONTENT_OF_TAG_S, "h" + i));
selenium.selectFrame("relative=top");
}
}
@@ -558,21 +549,18 @@
selenium.typeKeys(LOC_TEXT_AREA, "aaa bbb ccc ddd eee fff ggg");
selenium.click(LOC_ADV_INDENT_BUTTON);
- String attr = selenium.getAttribute(LOC_TEXT_AREA_P + "@style");
- assertEquals(attr, "padding-left: 30px;",
String.format(MSG_PARAGRAPH_INDENTED_BY_N_PX, 30));
+ assertEquals(getStyle(LOC_TEXT_AREA_P, "padding-left"),
"30px", format(MSG_PARAGRAPH_INDENTED_BY_N_PX, 30));
selenium.click(LOC_ADV_INDENT_BUTTON);
- attr = selenium.getAttribute(LOC_TEXT_AREA_P + "@style");
- assertEquals(attr, "padding-left: 60px;",
String.format(MSG_PARAGRAPH_INDENTED_BY_N_PX, 60));
+ assertEquals(getStyle(LOC_TEXT_AREA_P, "padding-left"),
"60px", format(MSG_PARAGRAPH_INDENTED_BY_N_PX, 60));
selenium.click(LOC_ADV_OUTDENT_BUTTON);
- attr = selenium.getAttribute(LOC_TEXT_AREA_P + "@style");
- assertEquals(attr, "padding-left: 30px;",
String.format(MSG_PARAGRAPH_INDENTED_BY_N_PX, 30));
+ assertEquals(getStyle(LOC_TEXT_AREA_P, "padding-left"),
"30px", format(MSG_PARAGRAPH_INDENTED_BY_N_PX, 30));
selenium.click(LOC_ADV_OUTDENT_BUTTON);
try {
- attr = selenium.getAttribute(LOC_TEXT_AREA_P + "@style");
- fail(String.format(MSG_PARAGRAPH_INDENTED_BY_N_PX, 0));
+ selenium.getAttribute(LOC_TEXT_AREA_P + "@style");
+ fail(format(MSG_PARAGRAPH_INDENTED_BY_N_PX, 0));
} catch (Exception e) {
// OK - no attribute
}
@@ -589,7 +577,7 @@
selenium.click(LOC_ADV_HORIZONTAL_RULER_BUTTON);
selenium.selectFrame(LOC_IFRAME);
-
+
Wait.failWith(MSG_NUMBER_OF_RULERS).interval(3000).until(new Condition() {
public boolean isTrue() {
return selenium.getXpathCount(LOC_TEXT_AREA_P_HR).intValue() == 3;
@@ -614,9 +602,9 @@
selenium.selectFrame(LOC_IFRAME);
int count = selenium.getXpathCount(LOC_TEXT_AREA_P2_B).intValue();
- assertEquals(count, 1, String.format(MSG_TAG_S_SHOULD_BE_IN_EDITOR,
"b"));
+ assertEquals(count, 1, format(MSG_TAG_S_SHOULD_BE_IN_EDITOR, "b"));
String text = selenium.getText(LOC_TEXT_AREA_P2_B);
- assertEquals(text, "bbb", String.format(MSG_CONTENT_OF_TAG_S,
"b"));
+ assertEquals(text, "bbb", format(MSG_CONTENT_OF_TAG_S,
"b"));
// press Ctrl+A to select content of the editor
selenium.controlKeyDown();
@@ -627,9 +615,9 @@
selenium.click(LOC_ADV_REMOVE_FORMATTING_BUTTON);
count = selenium.getXpathCount(LOC_TEXT_AREA_P2_B).intValue();
- assertEquals(count, 0, String.format(MSG_TAG_S_SHOULD_NOT_BE_IN_EDITOR,
"b"));
+ assertEquals(count, 0, format(MSG_TAG_S_SHOULD_NOT_BE_IN_EDITOR,
"b"));
text = selenium.getText(LOC_TEXT_AREA_P2);
- assertEquals(text, "bbb", String.format(MSG_CONTENT_OF_TAG_S,
"b"));
+ assertEquals(text, "bbb", format(MSG_CONTENT_OF_TAG_S,
"b"));
}
/**
@@ -701,13 +689,13 @@
String text = selenium.getText(LOC_TEXT_AREA_P_A);
assertEquals(text, "aaa", MSG_LABEL_OF_LINK);
text = selenium.getAttribute(LOC_TEXT_AREA_P_A + "@class");
- assertEquals(text, "red-bold", String.format(MSG_LINK_ATTRIBUTE_S,
"class"));
+ assertEquals(text, "red-bold", format(MSG_LINK_ATTRIBUTE_S,
"class"));
text = selenium.getAttribute(LOC_TEXT_AREA_P_A + "@href");
- assertEquals(text, "http://www.redhat.com",
String.format(MSG_LINK_ATTRIBUTE_S, "href"));
+ assertEquals(text, "http://www.redhat.com",
format(MSG_LINK_ATTRIBUTE_S, "href"));
text = selenium.getAttribute(LOC_TEXT_AREA_P_A + "@title");
- assertEquals(text, "title title", String.format(MSG_LINK_ATTRIBUTE_S,
"title"));
+ assertEquals(text, "title title", format(MSG_LINK_ATTRIBUTE_S,
"title"));
text = selenium.getAttribute(LOC_TEXT_AREA_P_A + "@target");
- assertEquals(text, "_blank", String.format(MSG_LINK_ATTRIBUTE_S,
"target"));
+ assertEquals(text, "_blank", format(MSG_LINK_ATTRIBUTE_S,
"target"));
selenium.selectFrame("relative=top");
@@ -726,7 +714,7 @@
selenium.selectFrame(LOC_IFRAME);
text = selenium.getText(LOC_TEXT_AREA_P_SPAN);
- assertEquals(text, "aaa", String.format(MSG_CONTENT_OF_TAG_S,
"span"));
+ assertEquals(text, "aaa", format(MSG_CONTENT_OF_TAG_S,
"span"));
text = selenium.getAttribute(LOC_TEXT_AREA_P_SPAN + "@class");
assertEquals(text, "red-bold", MSG_CLASS_ATTRIBUTE);
@@ -747,19 +735,19 @@
selenium.click(LOC_ADV_ANCHOR_DLG_INSERT_BUTTON);
String attr = selenium.getAttribute(LOC_TEXT_AREA_P_A + "@name");
- assertEquals(attr, "aaa", String.format(MSG_LINK_ATTRIBUTE_S,
"name"));
+ assertEquals(attr, "aaa", format(MSG_LINK_ATTRIBUTE_S,
"name"));
attr = selenium.getAttribute(LOC_TEXT_AREA_P_A + "@class");
- assertEquals(attr, "mceItemAnchor", String.format(MSG_LINK_ATTRIBUTE_S,
"class"));
+ assertEquals(attr, "mceItemAnchor", format(MSG_LINK_ATTRIBUTE_S,
"class"));
selenium.click(LOC_ADV_TOGGLE_INVISIBLE_BUTTON);
attr = selenium.getAttribute(LOC_TEXT_AREA_P_A + "@name");
- assertEquals(attr, "aaa", String.format(MSG_LINK_ATTRIBUTE_S,
"name"));
+ assertEquals(attr, "aaa", format(MSG_LINK_ATTRIBUTE_S,
"name"));
try {
attr = selenium.getAttribute(LOC_TEXT_AREA_P_A + "@class");
- fail(String.format(MSG_LINK_ATTRIBUTE_S, "class"));
+ fail(format(MSG_LINK_ATTRIBUTE_S, "class"));
} catch (Exception e) {
// OK -- there is no class attribute
}
@@ -793,21 +781,21 @@
waitForElement(LOC_TEXT_AREA_P_IMG);
String attr = selenium.getAttribute(LOC_TEXT_AREA_P_IMG + "@src");
- assertEquals(attr, "../images/cn_Editor.gif",
String.format(MSG_IMG_ATTRIBUTE_S, "src"));
+ assertEquals(attr, "../images/cn_Editor.gif",
format(MSG_IMG_ATTRIBUTE_S, "src"));
attr = selenium.getAttribute(LOC_TEXT_AREA_P_IMG + "@alt");
- assertEquals(attr, "Editor", String.format(MSG_IMG_ATTRIBUTE_S,
"alt"));
+ assertEquals(attr, "Editor", format(MSG_IMG_ATTRIBUTE_S,
"alt"));
attr = selenium.getAttribute(LOC_TEXT_AREA_P_IMG + "@style");
- assertTrue(attr.contains("float: right;"),
String.format(MSG_IMG_ATTRIBUTE_S, "style"));
- assertTrue(attr.contains("border: 3px solid black;"),
String.format(MSG_IMG_ATTRIBUTE_S, "style"));
- assertTrue(attr.contains("margin: 10px 8px"),
String.format(MSG_IMG_ATTRIBUTE_S, "style"));
+ assertTrue(attr.contains("float: right;"), format(MSG_IMG_ATTRIBUTE_S,
"style"));
+ assertTrue(attr.contains("border: 3px solid black;"),
format(MSG_IMG_ATTRIBUTE_S, "style"));
+ assertTrue(attr.contains("margin: 10px 8px"),
format(MSG_IMG_ATTRIBUTE_S, "style"));
attr = selenium.getAttribute(LOC_TEXT_AREA_P_IMG + "@width");
- assertEquals(attr, "192", String.format(MSG_IMG_ATTRIBUTE_S,
"width"));
+ assertEquals(attr, "192", format(MSG_IMG_ATTRIBUTE_S,
"width"));
attr = selenium.getAttribute(LOC_TEXT_AREA_P_IMG + "@height");
- assertEquals(attr, "62", String.format(MSG_IMG_ATTRIBUTE_S,
"height"));
+ assertEquals(attr, "62", format(MSG_IMG_ATTRIBUTE_S,
"height"));
selenium.selectFrame("relative=top");
}
@@ -821,23 +809,23 @@
selenium.click(LOC_ADV_CUSTOM_CHAR_BUTTON);
waitForElement(LOC_ADV_DIALOG_IFRAME);
selenium.selectFrame(LOC_ADV_DIALOG_IFRAME);
- waitForElement(String.format(LOC_ADV_CUSTOM_CHAR_DLG_M_N, 1, 5));
+ waitForElement(format(LOC_ADV_CUSTOM_CHAR_DLG_M_N, 1, 5));
// euro sign
- selenium.click(String.format(LOC_ADV_CUSTOM_CHAR_DLG_M_N, 1, 5));
+ selenium.click(format(LOC_ADV_CUSTOM_CHAR_DLG_M_N, 1, 5));
selenium.click(LOC_ADV_CUSTOM_CHAR_BUTTON);
waitForElement(LOC_ADV_DIALOG_IFRAME);
selenium.selectFrame(LOC_ADV_DIALOG_IFRAME);
- waitForElement(String.format(LOC_ADV_CUSTOM_CHAR_DLG_M_N, 9, 5));
+ waitForElement(format(LOC_ADV_CUSTOM_CHAR_DLG_M_N, 9, 5));
// Omega
- selenium.click(String.format(LOC_ADV_CUSTOM_CHAR_DLG_M_N, 9, 5));
+ selenium.click(format(LOC_ADV_CUSTOM_CHAR_DLG_M_N, 9, 5));
selenium.click(LOC_ADV_CUSTOM_CHAR_BUTTON);
waitForElement(LOC_ADV_DIALOG_IFRAME);
selenium.selectFrame(LOC_ADV_DIALOG_IFRAME);
- waitForElement(String.format(LOC_ADV_CUSTOM_CHAR_DLG_M_N, 10, 18));
+ waitForElement(format(LOC_ADV_CUSTOM_CHAR_DLG_M_N, 10, 18));
// heart suite
- selenium.click(String.format(LOC_ADV_CUSTOM_CHAR_DLG_M_N, 10, 18));
+ selenium.click(format(LOC_ADV_CUSTOM_CHAR_DLG_M_N, 10, 18));
String text = selenium.getText(LOC_TEXT_AREA_P);
assertEquals(text, "€Ω♥", MSG_CONTENT_OF_THE_EDITOR);
@@ -846,10 +834,11 @@
/**
* Loads the page containing the calendar component.
*/
+ @SuppressWarnings("unused")
@BeforeMethod
private void loadPage() {
openComponent("Editor");
-
+
// wait for iframe to load
selenium.click(LOC_ADVANCED_BUTTON);
Wait.until(new Condition() {
@@ -857,7 +846,7 @@
return selenium.isElementPresent(LOC_ADV_ANCHOR_BUTTON);
}
});
-
+
scrollIntoView(LOC_EXAMPLE_HEADER, true);
}
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/SimpleEditorTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/SimpleEditorTestCase.java 2009-09-09
13:25:06 UTC (rev 15504)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/editor/SimpleEditorTestCase.java 2009-09-09
13:44:10 UTC (rev 15505)
@@ -1,3 +1,21 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
package org.jboss.richfaces.integrationTest.editor;
import static org.testng.Assert.assertEquals;
@@ -9,312 +27,329 @@
/**
* Test case that tests the editor component.
- * <ul>
- * <li><b>TODO</b> implement the test for cleaning up</li>
- * </ul>
*
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
+// TODO implement a test for cleaning up
public class SimpleEditorTestCase extends AbstractSeleniumRichfacesTestCase {
- // messages
- private final String MSG_COMPONENT_DESCRIPTION =
getMess("COMPONENT_DESCRIPTION");
- private final String MSG_STRINGS_SHOULD_BE_BOLD =
getMess("STRINGS_SHOULD_BE_BOLD");
- private final String MSG_STRINGS_SHOULD_BE_ITALIC =
getMess("STRINGS_SHOULD_BE_ITALIC");
- private final String MSG_STRINGS_SHOULD_BE_UNDERLINED =
getMess("STRINGS_SHOULD_BE_UNDERLINED");
- private final String MSG_STRINGS_SHOULD_HAVE_A_LINE_THROUGH =
getMess("STRINGS_SHOULD_HAVE_A_LINE_THROUGH");
- private final String MSG_CONTENT_OF_THE_EDITOR =
getMess("CONTENT_OF_THE_EDITOR");
- private final String MSG_EDITOR_SHOULD_CONTAIN_OL =
getMess("EDITOR_SHOULD_CONTAIN_OL");
- private final String MSG_EDITOR_SHOULD_CONTAIN_UL =
getMess("EDITOR_SHOULD_CONTAIN_UL");
- private final String MSG_TWO_LINES_SHOULD_CONTAIN_A_PARAGRAPH =
getMess("TWO_LINES_SHOULD_CONTAIN_A_PARAGRAPH");
- private final String MSG_TWO_LINES_IN_THE_EDITOR =
getMess("TWO_LINES_IN_THE_EDITOR");
- private final String MSG_LIST_SHOULD_CONTAIN_THREE_ITEMS =
getMess("LIST_SHOULD_CONTAIN_THREE_ITEMS");
+ // messages
+ private final String MSG_STRINGS_SHOULD_BE_BOLD =
getMsg("STRINGS_SHOULD_BE_BOLD");
+ private final String MSG_STRINGS_SHOULD_BE_ITALIC =
getMsg("STRINGS_SHOULD_BE_ITALIC");
+ private final String MSG_STRINGS_SHOULD_BE_UNDERLINED =
getMsg("STRINGS_SHOULD_BE_UNDERLINED");
+ private final String MSG_STRINGS_SHOULD_HAVE_A_LINE_THROUGH =
getMsg("STRINGS_SHOULD_HAVE_A_LINE_THROUGH");
+ private final String MSG_CONTENT_OF_THE_EDITOR =
getMsg("CONTENT_OF_THE_EDITOR");
+ private final String MSG_EDITOR_SHOULD_CONTAIN_OL =
getMsg("EDITOR_SHOULD_CONTAIN_OL");
+ private final String MSG_EDITOR_SHOULD_CONTAIN_UL =
getMsg("EDITOR_SHOULD_CONTAIN_UL");
+ private final String MSG_TWO_LINES_SHOULD_CONTAIN_A_PARAGRAPH =
getMsg("TWO_LINES_SHOULD_CONTAIN_A_PARAGRAPH");
+ private final String MSG_TWO_LINES_IN_THE_EDITOR =
getMsg("TWO_LINES_IN_THE_EDITOR");
+ private final String MSG_LIST_SHOULD_CONTAIN_THREE_ITEMS =
getMsg("LIST_SHOULD_CONTAIN_THREE_ITEMS");
- // editor
- private final String LOC_TEXT_AREA = getLoc("TEXT_AREA");
- private final String LOC_IFRAME = getLoc("IFRAME");
- private final String LOC_TEXT_AREA_P = getLoc("TEXT_AREA_P");
- private final String LOC_TEXT_AREA_P2_B = getLoc("TEXT_AREA_P2_B");
- private final String LOC_TEXT_AREA_P2_I = getLoc("TEXT_AREA_P2_I");
- private final String LOC_TEXT_AREA_P2_U = getLoc("TEXT_AREA_P2_U");
- private final String LOC_TEXT_AREA_P2_STRIKE = getLoc("TEXT_AREA_P2_STRIKE");
- private final String LOC_TEXT_AREA_OL = getLoc("TEXT_AREA_OL");
- private final String LOC_TEXT_AREA_OL_LI = getLoc("TEXT_AREA_OL_LI");
- private final String LOC_TEXT_AREA_UL = getLoc("TEXT_AREA_UL");
- private final String LOC_TEXT_AREA_UL_LI = getLoc("TEXT_AREA_UL_LI");
+ // editor
+ private final String LOC_EXAMPLE_HEADER = getLoc("EXAMPLE_HEADER");
+ private final String LOC_TEXT_AREA = getLoc("TEXT_AREA");
+ private final String LOC_IFRAME = getLoc("IFRAME");
+ private final String LOC_TEXT_AREA_P = getLoc("TEXT_AREA_P");
+ private final String LOC_TEXT_AREA_P2_B = getLoc("TEXT_AREA_P2_B");
+ private final String LOC_TEXT_AREA_P2_I = getLoc("TEXT_AREA_P2_I");
+ private final String LOC_TEXT_AREA_P2_U = getLoc("TEXT_AREA_P2_U");
+ private final String LOC_TEXT_AREA_P2_STRIKE =
getLoc("TEXT_AREA_P2_STRIKE");
+ private final String LOC_TEXT_AREA_OL = getLoc("TEXT_AREA_OL");
+ private final String LOC_TEXT_AREA_OL_LI = getLoc("TEXT_AREA_OL_LI");
+ private final String LOC_TEXT_AREA_UL = getLoc("TEXT_AREA_UL");
+ private final String LOC_TEXT_AREA_UL_LI = getLoc("TEXT_AREA_UL_LI");
- // buttons in simple mode
- private final String LOC_BOLD_BUTTON = getLoc("BOLD_BUTTON");
- private final String LOC_ITALIC_BUTTON = getLoc("ITALIC_BUTTON");
- private final String LOC_UNDERLINE_BUTTON = getLoc("UNDERLINE_BUTTON");
- private final String LOC_STRIKETHROUGH_BUTTON =
getLoc("STRIKETHROUGH_BUTTON");
- private final String LOC_UNDO_BUTTON = getLoc("UNDO_BUTTON");
- private final String LOC_REDO_BUTTON = getLoc("REDO_BUTTON");
- private final String LOC_UNORDERED_LIST_BUTTON =
getLoc("UNORDERED_LIST_BUTTON");
- private final String LOC_ORDERED_LIST_BUTTON = getLoc("ORDERED_LIST_BUTTON");
+ // buttons in simple mode
+ private final String LOC_BOLD_BUTTON = getLoc("BOLD_BUTTON");
+ private final String LOC_ITALIC_BUTTON = getLoc("ITALIC_BUTTON");
+ private final String LOC_UNDERLINE_BUTTON = getLoc("UNDERLINE_BUTTON");
+ private final String LOC_STRIKETHROUGH_BUTTON =
getLoc("STRIKETHROUGH_BUTTON");
+ private final String LOC_UNDO_BUTTON = getLoc("UNDO_BUTTON");
+ private final String LOC_REDO_BUTTON = getLoc("REDO_BUTTON");
+ private final String LOC_UNORDERED_LIST_BUTTON =
getLoc("UNORDERED_LIST_BUTTON");
+ private final String LOC_ORDERED_LIST_BUTTON =
getLoc("ORDERED_LIST_BUTTON");
- /**
- * Tests the bold button. It types "aaaa", presses enter followed by the
- * bold button, and types "bbbb ". Then again bold button, "cccc ",
bold
- * button and "dddd ". Then it checks that the editor's text area
contains
- * the entered text. After that, it checks that there are two lines of text
- * in the editor and that the second line contains two bold strings.
- */
- @Test
- public void testBoldButton() {
- selenium.typeKeys(LOC_TEXT_AREA, "aaaa"); // normal text
- selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
+ /**
+ * Tests the bold button. It types "aaaa", presses enter followed by the
+ * bold button, and types "bbbb ". Then again bold button, "cccc
", bold
+ * button and "dddd ". Then it checks that the editor's text area
contains
+ * the entered text. After that, it checks that there are two lines of text
+ * in the editor and that the second line contains two bold strings.
+ */
+ @Test
+ public void testBoldButton() {
+ selenium.typeKeys(LOC_TEXT_AREA, "aaaa"); // normal text
+ selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
- selenium.click(LOC_BOLD_BUTTON);
- selenium.typeKeys(LOC_TEXT_AREA, "bbbb "); // bold text
- selenium.click(LOC_BOLD_BUTTON);
- selenium.typeKeys(LOC_TEXT_AREA, "cccc "); // normal text
- selenium.click(LOC_BOLD_BUTTON);
- selenium.typeKeys(LOC_TEXT_AREA, "dddd "); // bold text
+ selenium.click(LOC_BOLD_BUTTON);
+ selenium.typeKeys(LOC_TEXT_AREA, "bbbb "); // bold text
+ selenium.click(LOC_BOLD_BUTTON);
+ selenium.typeKeys(LOC_TEXT_AREA, "cccc "); // normal text
+ selenium.click(LOC_BOLD_BUTTON);
+ selenium.typeKeys(LOC_TEXT_AREA, "dddd "); // bold text
- String text = selenium.getText(LOC_TEXT_AREA);
- assertEquals(text, "aaaa\nbbbb cccc dddd", MSG_CONTENT_OF_THE_EDITOR);
+ String text = selenium.getText(LOC_TEXT_AREA);
+ assertEquals(text, "aaaa\nbbbb cccc dddd", MSG_CONTENT_OF_THE_EDITOR);
- // select the iframe for Selenium to be able to get iframe's content
- selenium.selectFrame(LOC_IFRAME);
+ // select the iframe for Selenium to be able to get iframe's content
+ selenium.selectFrame(LOC_IFRAME);
- int count = selenium.getXpathCount(LOC_TEXT_AREA_P).intValue();
- assertEquals(count, 2, MSG_TWO_LINES_IN_THE_EDITOR);
+ int count = selenium.getXpathCount(LOC_TEXT_AREA_P).intValue();
+ assertEquals(count, 2, MSG_TWO_LINES_IN_THE_EDITOR);
- count = selenium.getXpathCount(LOC_TEXT_AREA_P2_B).intValue();
- assertEquals(count, 2, MSG_STRINGS_SHOULD_BE_BOLD);
-
- selenium.selectFrame("relative=top");
- }
+ count = selenium.getXpathCount(LOC_TEXT_AREA_P2_B).intValue();
+ assertEquals(count, 2, MSG_STRINGS_SHOULD_BE_BOLD);
- /**
- * Tests the italic button. It types "aaaa", presses enter followed by the
- * italic button, and types "bbbb ". Then again italic button, "cccc
",
- * italic button and "dddd ". Then it checks that the editor's text area
- * contains the entered text. After that, it checks that there are two lines
- * of text in the editor and that the second line contains two italic
- * strings.
- */
- @Test
- public void testItalicButton() {
- selenium.typeKeys(LOC_TEXT_AREA, "aaaa"); // normal text
- selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
+ selenium.selectFrame("relative=top");
+ }
- selenium.click(LOC_ITALIC_BUTTON);
- selenium.typeKeys(LOC_TEXT_AREA, "bbbb "); // italic text
- selenium.click(LOC_ITALIC_BUTTON);
- selenium.typeKeys(LOC_TEXT_AREA, "cccc "); // normal text
- selenium.click(LOC_ITALIC_BUTTON);
- selenium.typeKeys(LOC_TEXT_AREA, "dddd "); // italic text
+ /**
+ * Tests the italic button. It types "aaaa", presses enter followed by the
+ * italic button, and types "bbbb ". Then again italic button, "cccc
",
+ * italic button and "dddd ". Then it checks that the editor's text
area
+ * contains the entered text. After that, it checks that there are two lines
+ * of text in the editor and that the second line contains two italic
+ * strings.
+ */
+ @Test
+ public void testItalicButton() {
+ selenium.typeKeys(LOC_TEXT_AREA, "aaaa"); // normal text
+ selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
- String text = selenium.getText(LOC_TEXT_AREA);
- assertEquals(text, "aaaa\nbbbb cccc dddd", MSG_CONTENT_OF_THE_EDITOR);
+ selenium.click(LOC_ITALIC_BUTTON);
+ selenium.typeKeys(LOC_TEXT_AREA, "bbbb "); // italic text
+ selenium.click(LOC_ITALIC_BUTTON);
+ selenium.typeKeys(LOC_TEXT_AREA, "cccc "); // normal text
+ selenium.click(LOC_ITALIC_BUTTON);
+ selenium.typeKeys(LOC_TEXT_AREA, "dddd "); // italic text
- // select the iframe for Selenium to be able to get iframe's content
- selenium.selectFrame(LOC_IFRAME);
+ String text = selenium.getText(LOC_TEXT_AREA);
+ assertEquals(text, "aaaa\nbbbb cccc dddd", MSG_CONTENT_OF_THE_EDITOR);
- int count = selenium.getXpathCount(LOC_TEXT_AREA_P).intValue();
- assertEquals(count, 2, MSG_TWO_LINES_IN_THE_EDITOR);
+ // select the iframe for Selenium to be able to get iframe's content
+ selenium.selectFrame(LOC_IFRAME);
- count = selenium.getXpathCount(LOC_TEXT_AREA_P2_I).intValue();
- assertEquals(count, 2, MSG_STRINGS_SHOULD_BE_ITALIC);
-
- selenium.selectFrame("relative=top");
- }
+ int count = selenium.getXpathCount(LOC_TEXT_AREA_P).intValue();
+ assertEquals(count, 2, MSG_TWO_LINES_IN_THE_EDITOR);
- /**
- * Tests the underline button. It types "aaaa", presses enter followed by
- * the underline button, and types "bbbb ". Then again underline button,
- * "cccc ", underline button and "dddd ". Then it checks that the
editor's
- * text area contains the entered text. After that, it checks that there are
- * two lines of text in the editor and that the second line contains two
- * underlined strings.
- */
- @Test
- public void testUnderlineButton() {
- selenium.typeKeys(LOC_TEXT_AREA, "aaaa"); // normal text
- selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
+ count = selenium.getXpathCount(LOC_TEXT_AREA_P2_I).intValue();
+ assertEquals(count, 2, MSG_STRINGS_SHOULD_BE_ITALIC);
- selenium.click(LOC_UNDERLINE_BUTTON);
- selenium.typeKeys(LOC_TEXT_AREA, "bbbb "); // underlined text
- selenium.click(LOC_UNDERLINE_BUTTON);
- selenium.typeKeys(LOC_TEXT_AREA, "cccc "); // normal text
- selenium.click(LOC_UNDERLINE_BUTTON);
- selenium.typeKeys(LOC_TEXT_AREA, "dddd "); // underlined text
+ selenium.selectFrame("relative=top");
+ }
- String text = selenium.getText(LOC_TEXT_AREA);
- assertEquals(text, "aaaa\nbbbb cccc dddd", MSG_CONTENT_OF_THE_EDITOR);
+ /**
+ * Tests the underline button. It types "aaaa", presses enter followed by
+ * the underline button, and types "bbbb ". Then again underline button,
+ * "cccc ", underline button and "dddd ". Then it checks that the
editor's
+ * text area contains the entered text. After that, it checks that there are
+ * two lines of text in the editor and that the second line contains two
+ * underlined strings.
+ */
+ @Test
+ public void testUnderlineButton() {
+ selenium.typeKeys(LOC_TEXT_AREA, "aaaa"); // normal text
+ selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
- // select the iframe for Selenium to be able to get iframe's content
- selenium.selectFrame(LOC_IFRAME);
+ selenium.click(LOC_UNDERLINE_BUTTON);
+ selenium.typeKeys(LOC_TEXT_AREA, "bbbb "); // underlined text
+ selenium.click(LOC_UNDERLINE_BUTTON);
+ selenium.typeKeys(LOC_TEXT_AREA, "cccc "); // normal text
+ selenium.click(LOC_UNDERLINE_BUTTON);
+ selenium.typeKeys(LOC_TEXT_AREA, "dddd "); // underlined text
- int count = selenium.getXpathCount(LOC_TEXT_AREA_P).intValue();
- assertEquals(count, 2, MSG_TWO_LINES_IN_THE_EDITOR);
+ String text = selenium.getText(LOC_TEXT_AREA);
+ assertEquals(text, "aaaa\nbbbb cccc dddd", MSG_CONTENT_OF_THE_EDITOR);
- count = selenium.getXpathCount(LOC_TEXT_AREA_P2_U).intValue();
- assertEquals(count, 2, MSG_STRINGS_SHOULD_BE_UNDERLINED);
-
- selenium.selectFrame("relative=top");
- }
+ // select the iframe for Selenium to be able to get iframe's content
+ selenium.selectFrame(LOC_IFRAME);
- /**
- * Tests the strikethrough button. It types "aaaa", presses enter followed
- * by the strikethrough button, and types "bbbb ". Then again strikethrough
- * button, "cccc ", strikethrough button and "dddd ". Then it checks
that
- * the editor's text area contains the entered text. After that, it checks
- * that there are two lines of text in the editor and that the second line
- * contains two strings having a line through.
- */
- @Test
- public void testStrikethroughButton() {
- selenium.typeKeys(LOC_TEXT_AREA, "aaaa"); // normal text
- selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
+ int count = selenium.getXpathCount(LOC_TEXT_AREA_P).intValue();
+ assertEquals(count, 2, MSG_TWO_LINES_IN_THE_EDITOR);
- selenium.click(LOC_STRIKETHROUGH_BUTTON);
- selenium.typeKeys(LOC_TEXT_AREA, "bbbb "); // text with line through
- selenium.click(LOC_STRIKETHROUGH_BUTTON);
- selenium.typeKeys(LOC_TEXT_AREA, "cccc "); // normal text
- selenium.click(LOC_STRIKETHROUGH_BUTTON);
- selenium.typeKeys(LOC_TEXT_AREA, "dddd "); // text with line through
+ count = selenium.getXpathCount(LOC_TEXT_AREA_P2_U).intValue();
+ assertEquals(count, 2, MSG_STRINGS_SHOULD_BE_UNDERLINED);
- String text = selenium.getText(LOC_TEXT_AREA);
- assertEquals(text, "aaaa\nbbbb cccc dddd", MSG_CONTENT_OF_THE_EDITOR);
+ selenium.selectFrame("relative=top");
+ }
- // select the iframe for Selenium to be able to get iframe's content
- selenium.selectFrame(LOC_IFRAME);
+ /**
+ * Tests the strikethrough button. It types "aaaa", presses enter followed
+ * by the strikethrough button, and types "bbbb ". Then again
strikethrough
+ * button, "cccc ", strikethrough button and "dddd ". Then it
checks that
+ * the editor's text area contains the entered text. After that, it checks
+ * that there are two lines of text in the editor and that the second line
+ * contains two strings having a line through.
+ */
+ @Test
+ public void testStrikethroughButton() {
+ selenium.typeKeys(LOC_TEXT_AREA, "aaaa"); // normal text
+ selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
- int count = selenium.getXpathCount(LOC_TEXT_AREA_P).intValue();
- assertEquals(count, 2, MSG_TWO_LINES_IN_THE_EDITOR);
+ selenium.click(LOC_STRIKETHROUGH_BUTTON);
+ selenium.typeKeys(LOC_TEXT_AREA, "bbbb "); // text with line through
+ selenium.click(LOC_STRIKETHROUGH_BUTTON);
+ selenium.typeKeys(LOC_TEXT_AREA, "cccc "); // normal text
+ selenium.click(LOC_STRIKETHROUGH_BUTTON);
+ selenium.typeKeys(LOC_TEXT_AREA, "dddd "); // text with line through
- count = selenium.getXpathCount(LOC_TEXT_AREA_P2_STRIKE).intValue();
- assertEquals(count, 2, MSG_STRINGS_SHOULD_HAVE_A_LINE_THROUGH);
-
- selenium.selectFrame("relative=top");
- }
+ String text = selenium.getText(LOC_TEXT_AREA);
+ assertEquals(text, "aaaa\nbbbb cccc dddd", MSG_CONTENT_OF_THE_EDITOR);
- /**
- * Tests both the undo and redo buttons. It types into text area, checks the
- * content of the editor, reverts changes by clicking on the undo button,
- * and checks the content of the editor again. Then, it clicks on the redo
- * button and checks the text area.
- */
- @Test
- public void testUndoRedo() {
- selenium.typeKeys(LOC_TEXT_AREA, "aaaabbbb");
+ // select the iframe for Selenium to be able to get iframe's content
+ selenium.selectFrame(LOC_IFRAME);
- String text = selenium.getText(LOC_TEXT_AREA);
- assertEquals(text, "aaaabbbb", MSG_CONTENT_OF_THE_EDITOR);
+ int count = selenium.getXpathCount(LOC_TEXT_AREA_P).intValue();
+ assertEquals(count, 2, MSG_TWO_LINES_IN_THE_EDITOR);
- selenium.click(LOC_UNDO_BUTTON);
- text = selenium.getText(LOC_TEXT_AREA);
- assertEquals(text, "", MSG_CONTENT_OF_THE_EDITOR);
+ count = selenium.getXpathCount(LOC_TEXT_AREA_P2_STRIKE).intValue();
+ assertEquals(count, 2, MSG_STRINGS_SHOULD_HAVE_A_LINE_THROUGH);
- selenium.click(LOC_REDO_BUTTON);
- text = selenium.getText(LOC_TEXT_AREA);
- assertEquals(text, "aaaabbbb", MSG_CONTENT_OF_THE_EDITOR);
- }
+ selenium.selectFrame("relative=top");
+ }
- /**
- * Tests the unordered list button. It types a normal string, then clicks on
- * the unordered list button, types three strings, clicks on the unordered
- * list button, and types one more string. Then it checks that the text area
- * contains all strings, then checks that there are two paragraphs, presence
- * of unordered list, and the number of list's items.
- */
- @Test
- public void testUnorderedList() {
- selenium.typeKeys(LOC_TEXT_AREA, "aaaa");
- selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
+ /**
+ * Tests both the undo and redo buttons. It types into text area, checks the
+ * content of the editor, reverts changes by clicking on the undo button,
+ * and checks the content of the editor again. Then, it clicks on the redo
+ * button and checks the text area.
+ */
+ @Test
+ public void testUndoRedo() {
+ selenium.typeKeys(LOC_TEXT_AREA, "aaaabbbb");
- selenium.click(LOC_UNORDERED_LIST_BUTTON);
- selenium.typeKeys(LOC_TEXT_AREA, "bbbb");
- selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
- selenium.typeKeys(LOC_TEXT_AREA, "cccc");
- selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
- selenium.typeKeys(LOC_TEXT_AREA, "dddd");
- selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
- selenium.click(LOC_UNORDERED_LIST_BUTTON);
+ String text = selenium.getText(LOC_TEXT_AREA);
+ assertEquals(text, "aaaabbbb", MSG_CONTENT_OF_THE_EDITOR);
- selenium.typeKeys(LOC_TEXT_AREA, "eeee");
+ selenium.click(LOC_UNDO_BUTTON);
+ text = selenium.getText(LOC_TEXT_AREA);
+ assertEquals(text, "", MSG_CONTENT_OF_THE_EDITOR);
- // select the iframe for Selenium to be able to get iframe's content
- selenium.selectFrame(LOC_IFRAME);
+ selenium.click(LOC_REDO_BUTTON);
+ text = selenium.getText(LOC_TEXT_AREA);
+ assertEquals(text, "aaaabbbb", MSG_CONTENT_OF_THE_EDITOR);
+ }
- String text = selenium.getText(LOC_TEXT_AREA);
- assertEquals(text, "aaaa\nbbbbccccddddeeee", MSG_CONTENT_OF_THE_EDITOR);
+ /**
+ * Tests the unordered list button. It types a normal string, then clicks on
+ * the unordered list button, types three strings, clicks on the unordered
+ * list button, and types one more string. Then it checks that the text area
+ * contains all strings, then checks that there are two paragraphs, presence
+ * of unordered list, and the number of list's items.
+ */
+ @Test
+ public void testUnorderedList() {
+ selenium.typeKeys(LOC_TEXT_AREA, "aaaa");
+ selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
- int count = selenium.getXpathCount(LOC_TEXT_AREA_P).intValue();
- assertEquals(count, 2, MSG_TWO_LINES_SHOULD_CONTAIN_A_PARAGRAPH);
+ selenium.click(LOC_UNORDERED_LIST_BUTTON);
+ selenium.typeKeys(LOC_TEXT_AREA, "bbbb");
+ selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
+ selenium.typeKeys(LOC_TEXT_AREA, "cccc");
+ selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
+ selenium.typeKeys(LOC_TEXT_AREA, "dddd");
+ selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
+ selenium.click(LOC_UNORDERED_LIST_BUTTON);
- boolean isPresent = selenium.isElementPresent(LOC_TEXT_AREA_UL);
- assertTrue(isPresent, MSG_EDITOR_SHOULD_CONTAIN_UL);
+ selenium.typeKeys(LOC_TEXT_AREA, "eeee");
- count = selenium.getXpathCount(LOC_TEXT_AREA_UL_LI).intValue();
- assertEquals(count, 3, MSG_LIST_SHOULD_CONTAIN_THREE_ITEMS);
-
- selenium.selectFrame("relative=top");
- }
+ // select the iframe for Selenium to be able to get iframe's content
+ selenium.selectFrame(LOC_IFRAME);
- /**
- * Tests the ordered list button. It types a normal string, then clicks on
- * the ordered list button, types three strings, clicks on the ordered list
- * button, and types one more string. Then it checks that the text area
- * contains all strings, then checks that there are two paragraphs, presence
- * of ordered list, and the number of list's items.
- */
- @Test
- public void testOrderedList() {
- selenium.typeKeys(LOC_TEXT_AREA, "aaaa");
- selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
+ String text = selenium.getText(LOC_TEXT_AREA);
+ assertEquals(text, "aaaa\nbbbbccccddddeeee",
MSG_CONTENT_OF_THE_EDITOR);
- selenium.click(LOC_ORDERED_LIST_BUTTON);
- selenium.typeKeys(LOC_TEXT_AREA, "bbbb");
- selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
- selenium.typeKeys(LOC_TEXT_AREA, "cccc");
- selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
- selenium.typeKeys(LOC_TEXT_AREA, "dddd");
- selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
- selenium.click(LOC_ORDERED_LIST_BUTTON);
+ int count = selenium.getXpathCount(LOC_TEXT_AREA_P).intValue();
+ assertEquals(count, 2, MSG_TWO_LINES_SHOULD_CONTAIN_A_PARAGRAPH);
- selenium.typeKeys(LOC_TEXT_AREA, "eeee");
+ boolean isPresent = selenium.isElementPresent(LOC_TEXT_AREA_UL);
+ assertTrue(isPresent, MSG_EDITOR_SHOULD_CONTAIN_UL);
- // select the iframe for Selenium to be able to get iframe's content
- selenium.selectFrame(LOC_IFRAME);
+ count = selenium.getXpathCount(LOC_TEXT_AREA_UL_LI).intValue();
+ assertEquals(count, 3, MSG_LIST_SHOULD_CONTAIN_THREE_ITEMS);
- String text = selenium.getText(LOC_TEXT_AREA);
- assertEquals(text, "aaaa\nbbbbccccddddeeee", MSG_CONTENT_OF_THE_EDITOR);
+ selenium.selectFrame("relative=top");
+ }
- int count = selenium.getXpathCount(LOC_TEXT_AREA_P).intValue();
- assertEquals(count, 2, MSG_TWO_LINES_SHOULD_CONTAIN_A_PARAGRAPH);
+ /**
+ * Tests the ordered list button. It types a normal string, then clicks on
+ * the ordered list button, types three strings, clicks on the ordered list
+ * button, and types one more string. Then it checks that the text area
+ * contains all strings, then checks that there are two paragraphs, presence
+ * of ordered list, and the number of list's items.
+ */
+ @Test
+ public void testOrderedList() {
+ selenium.typeKeys(LOC_TEXT_AREA, "aaaa");
+ selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
- boolean isPresent = selenium.isElementPresent(LOC_TEXT_AREA_OL);
- assertTrue(isPresent, MSG_EDITOR_SHOULD_CONTAIN_OL);
+ selenium.click(LOC_ORDERED_LIST_BUTTON);
+ selenium.typeKeys(LOC_TEXT_AREA, "bbbb");
+ selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
+ selenium.typeKeys(LOC_TEXT_AREA, "cccc");
+ selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
+ selenium.typeKeys(LOC_TEXT_AREA, "dddd");
+ selenium.keyPress(LOC_TEXT_AREA, "13"); // press <Enter>
+ selenium.click(LOC_ORDERED_LIST_BUTTON);
- count = selenium.getXpathCount(LOC_TEXT_AREA_OL_LI).intValue();
- assertEquals(count, 3, MSG_LIST_SHOULD_CONTAIN_THREE_ITEMS);
-
- selenium.selectFrame("relative=top");
- }
+ selenium.typeKeys(LOC_TEXT_AREA, "eeee");
- /**
- * Tests the "View Source". It checks that the source code is not visible,
- * clicks on the link, and checks the first 2 components of source code,
- * i.e. that the source code begins with "<ui:composition".
- */
- @Test
- public void testEditorSource() {
- abstractTestSource(1, 1, "<", "ui:composition");
- }
+ // select the iframe for Selenium to be able to get iframe's content
+ selenium.selectFrame(LOC_IFRAME);
- /**
- * Loads the page containing the calendar component.
- */
- @BeforeMethod
- private void loadPage() {
- super.loadPage("richInputs", 4, MSG_COMPONENT_DESCRIPTION);
- // wait for iframe to load
- waitFor(1000);
- scrollIntoView(LOC_TEXT_AREA, true);
- }
+ String text = selenium.getText(LOC_TEXT_AREA);
+ assertEquals(text, "aaaa\nbbbbccccddddeeee",
MSG_CONTENT_OF_THE_EDITOR);
+
+ int count = selenium.getXpathCount(LOC_TEXT_AREA_P).intValue();
+ assertEquals(count, 2, MSG_TWO_LINES_SHOULD_CONTAIN_A_PARAGRAPH);
+
+ boolean isPresent = selenium.isElementPresent(LOC_TEXT_AREA_OL);
+ assertTrue(isPresent, MSG_EDITOR_SHOULD_CONTAIN_OL);
+
+ count = selenium.getXpathCount(LOC_TEXT_AREA_OL_LI).intValue();
+ assertEquals(count, 3, MSG_LIST_SHOULD_CONTAIN_THREE_ITEMS);
+
+ selenium.selectFrame("relative=top");
+ }
+
+ /**
+ * Tests the "View Source". It checks that the source code is not visible,
+ * clicks on the link, and checks 17 lines of source code.
+ */
+ @Test
+ public void testEditorSource() {
+ String[] strings = new String[] {
+ "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<h:form id=\"form\">",
+ "<h:panelGrid columns=\"2\" width=\"100%\"
columnClasses=\"column,column\">",
+ "<h:panelGroup style=\"height:320px;width:400px;\"
layout=\"block\">",
+ "<rich:editor
configuration=\"#{editorBean.currentConfiguration}\"",
+ "id=\"editor\" width=\"400\"
height=\"300\" validator=\"#{editorBean.validate}\"",
+ "viewMode=\"#{editorBean.viewMode}\"
value=\"#{editorBean.value}\"
useSeamText=\"#{editorBean.useSeamText}\">",
+ "<a4j:support event=\"onchange\"
reRender=\"result\" ajaxSingle=\"true\"",
+ "requestDelay=\"1000\" ",
+ "onsubmit=\"if (!#{rich:element('form:editorvalue')}
&& !#{editorBean.useSeamText}) return false;\" />",
+ "<rich:panel id=\"controls\">",
+ "<f:facet name=\"header\">",
+ "<h:panelGrid columns=\"2\">",
+ "<h:selectOneRadio
value=\"#{editorBean.currentConfiguration}\"",
+ " <h:selectBooleanCheckbox
value=\"#{editorBean.liveUpdatesEnabled}\"",
+ "
valueChangeListener=\"#{inputResetBean.processValueChange}\">",
+ "<a4j:support event=\"onclick\"
reRender=\"editor,result,controls\" requestDelay=\"500\"
ajaxSingle=\"true\"", };
+
+ abstractTestSource(1, "View Source", strings);
+ }
+
+ /**
+ * Loads the page containing needed component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Editor");
+ // wait for iframe to load
+ waitFor(1000);
+ scrollIntoView(LOC_EXAMPLE_HEADER, true);
+ }
}
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/fileUpload/FileUploadTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/fileUpload/FileUploadTestCase.java 2009-09-09
13:25:06 UTC (rev 15504)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/fileUpload/FileUploadTestCase.java 2009-09-09
13:44:10 UTC (rev 15505)
@@ -1,22 +1,19 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces
- *
- * Copyright (C) 2009 Red Hat, Inc.
- *
- * This code is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this code; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
*/
package org.jboss.richfaces.integrationTest.fileUpload;
@@ -76,7 +73,7 @@
private final String MSG_RIGHT_PANEL_NUMBER_OF_ITEMS =
getMsg("RIGHT_PANEL_NUMBER_OF_ITEMS");
private final String MSG_RIGHT_PANEL_NAME_N =
getMsg("RIGHT_PANEL_NAME_N");
private final String MSG_RIGHT_PANEL_SIZE_N =
getMsg("RIGHT_PANEL_SIZE_N");
- private final String MSG_RIGHT_PANEL_COLOR_N_X_Y =
getMsg("RIGHT_PANEL_COLOR_N_X_Y");
+ private final String MSG_RIGHT_PANEL_COLOR_X_Y =
getMsg("RIGHT_PANEL_COLOR_X_Y");
private final String MSG_ADD_BUTTON_ENABLED =
getMsg("ADD_BUTTON_ENABLED");
private final String MSG_ADD_BUTTON_NOT_ENABLED =
getMsg("ADD_BUTTON_NOT_ENABLED");
@@ -134,7 +131,7 @@
boolean isPresent = selenium.isElementPresent(LOC_CLEAR_UPLOADED_DATA_BUTTON);
assertFalse(isPresent, MSG_CLEAR_UPLOADED_DATA_BUTTON_NOT_VISIBLE);
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_YELLOW);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_YELLOW);
count = selenium.getXpathCount(LOC_NOT_UPLOADED_LIST_TR).intValue();
assertEquals(count, 1, MSG_LEFT_PANEL_NUMBER_OF_ITEMS);
@@ -169,47 +166,47 @@
int count = selenium.getXpathCount(LOC_NOT_UPLOADED_LIST_TR).intValue();
assertEquals(count, 0, MSG_LEFT_PANEL_NUMBER_OF_ITEMS);
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_YELLOW);
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 2), "file://" +
FILE_BLUE);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_YELLOW);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 2), "file://" +
FILE_BLUE);
count = selenium.getXpathCount(LOC_NOT_UPLOADED_LIST_TR).intValue();
assertEquals(count, 2, MSG_LEFT_PANEL_NUMBER_OF_ITEMS);
- String text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_NAME, 1));
- assertEquals(text, "selenium-test" + Color.YELLOW.getRGB() +
".jpg", String.format(MSG_LEFT_PANEL_NAME_N, 1));
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_NAME, 2));
- assertEquals(text, "selenium-test" + Color.BLUE.getRGB() +
".jpg", String.format(MSG_LEFT_PANEL_NAME_N, 2));
+ String text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_NAME, 1));
+ assertEquals(text, "selenium-test" + Color.YELLOW.getRGB() +
".jpg", format(MSG_LEFT_PANEL_NAME_N, 1));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_NAME, 2));
+ assertEquals(text, "selenium-test" + Color.BLUE.getRGB() +
".jpg", format(MSG_LEFT_PANEL_NAME_N, 2));
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_CANCEL, 1));
- assertEquals(text, "Cancel", String.format(MSG_LEFT_PANEL_CANCEL_N,
1));
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_CANCEL, 2));
- assertEquals(text, "Cancel", String.format(MSG_LEFT_PANEL_CANCEL_N,
2));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_CANCEL, 1));
+ assertEquals(text, "Cancel", format(MSG_LEFT_PANEL_CANCEL_N, 1));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_CANCEL, 2));
+ assertEquals(text, "Cancel", format(MSG_LEFT_PANEL_CANCEL_N, 2));
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_DONE, 1));
- assertEquals(text, "", String.format(MSG_LEFT_PANEL_DONE_N, 1));
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_DONE, 2));
- assertEquals(text, "", String.format(MSG_LEFT_PANEL_DONE_N, 1));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_DONE, 1));
+ assertEquals(text, "", format(MSG_LEFT_PANEL_DONE_N, 1));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_DONE, 2));
+ assertEquals(text, "", format(MSG_LEFT_PANEL_DONE_N, 1));
selenium.click(LOC_UPLOAD_BUTTON);
waitFor(2000);
-
+
count = selenium.getXpathCount(LOC_NOT_UPLOADED_LIST_TR).intValue();
assertEquals(count, 2, MSG_LEFT_PANEL_NUMBER_OF_ITEMS);
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_NAME, 1));
- assertEquals(text, "selenium-test" + Color.YELLOW.getRGB() +
".jpg", String.format(MSG_LEFT_PANEL_NAME_N, 1));
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_NAME, 2));
- assertEquals(text, "selenium-test" + Color.BLUE.getRGB() +
".jpg", String.format(MSG_LEFT_PANEL_NAME_N, 2));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_NAME, 1));
+ assertEquals(text, "selenium-test" + Color.YELLOW.getRGB() +
".jpg", format(MSG_LEFT_PANEL_NAME_N, 1));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_NAME, 2));
+ assertEquals(text, "selenium-test" + Color.BLUE.getRGB() +
".jpg", format(MSG_LEFT_PANEL_NAME_N, 2));
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_CANCEL, 1));
- assertEquals(text, "Clear", String.format(MSG_LEFT_PANEL_CANCEL_N,
1));
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_CANCEL, 2));
- assertEquals(text, "Clear", String.format(MSG_LEFT_PANEL_CANCEL_N,
1));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_CANCEL, 1));
+ assertEquals(text, "Clear", format(MSG_LEFT_PANEL_CANCEL_N, 1));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_CANCEL, 2));
+ assertEquals(text, "Clear", format(MSG_LEFT_PANEL_CANCEL_N, 1));
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_DONE, 1));
- assertEquals(text, "Done", String.format(MSG_LEFT_PANEL_DONE_N, 1));
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_DONE, 2));
- assertEquals(text, "Done", String.format(MSG_LEFT_PANEL_DONE_N, 1));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_DONE, 1));
+ assertEquals(text, "Done", format(MSG_LEFT_PANEL_DONE_N, 1));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_DONE, 2));
+ assertEquals(text, "Done", format(MSG_LEFT_PANEL_DONE_N, 1));
}
/**
@@ -222,36 +219,36 @@
int count = selenium.getXpathCount(LOC_UPLOADED_LIST_TR).intValue();
assertEquals(count, 0, MSG_RIGHT_PANEL_NUMBER_OF_ITEMS);
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_CYAN);
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 2), "file://" +
FILE_ORANGE);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_CYAN);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 2), "file://" +
FILE_ORANGE);
selenium.click(LOC_UPLOAD_BUTTON);
count = selenium.getXpathCount(LOC_UPLOADED_LIST_TR).intValue();
assertEquals(count, 0, MSG_RIGHT_PANEL_NUMBER_OF_ITEMS);
- waitForElement(String.format(LOC_UPLOADED_LIST_N_NAME, 1));
+ waitForElement(format(LOC_UPLOADED_LIST_N_NAME, 1));
- String text = selenium.getText(String.format(LOC_UPLOADED_LIST_N_NAME, 1));
- assertEquals(text, "selenium-test" + Color.CYAN.getRGB() +
".jpg", String.format(MSG_RIGHT_PANEL_NAME_N, 1));
- text = selenium.getText(String.format(LOC_UPLOADED_LIST_N_NAME, 2));
- assertEquals(text, "selenium-test" + Color.ORANGE.getRGB() +
".jpg", String.format(MSG_RIGHT_PANEL_NAME_N, 2));
+ String text = selenium.getText(format(LOC_UPLOADED_LIST_N_NAME, 1));
+ assertEquals(text, "selenium-test" + Color.CYAN.getRGB() +
".jpg", format(MSG_RIGHT_PANEL_NAME_N, 1));
+ text = selenium.getText(format(LOC_UPLOADED_LIST_N_NAME, 2));
+ assertEquals(text, "selenium-test" + Color.ORANGE.getRGB() +
".jpg", format(MSG_RIGHT_PANEL_NAME_N, 2));
- long size1 =
Long.parseLong(selenium.getText(String.format(LOC_UPLOADED_LIST_N_SIZE, 1)));
+ long size1 = Long.parseLong(selenium.getText(format(LOC_UPLOADED_LIST_N_SIZE,
1)));
long size2 = new File(FILE_CYAN).length();
- assertEquals(size1, size2, String.format(MSG_RIGHT_PANEL_SIZE_N, 1));
+ assertEquals(size1, size2, format(MSG_RIGHT_PANEL_SIZE_N, 1));
- size1 = Long.parseLong(selenium.getText(String.format(LOC_UPLOADED_LIST_N_SIZE,
2)));
+ size1 = Long.parseLong(selenium.getText(format(LOC_UPLOADED_LIST_N_SIZE, 2)));
size2 = new File(FILE_ORANGE).length();
- assertEquals(size1, size2, String.format(MSG_RIGHT_PANEL_SIZE_N, 1));
+ assertEquals(size1, size2, format(MSG_RIGHT_PANEL_SIZE_N, 1));
// FIXME it cannot download the image
// String url =
- // selenium.getAttribute(String.format(LOC_UPLOADED_LIST_N_IMG, 1) +
+ // selenium.getAttribute(format(LOC_UPLOADED_LIST_N_IMG, 1) +
// "@src");
// assertImageColorEquals(url, Color.CYAN);
//
- // url = selenium.getAttribute(String.format(LOC_UPLOADED_LIST_N_IMG, 2)
+ // url = selenium.getAttribute(format(LOC_UPLOADED_LIST_N_IMG, 2)
// + "@src");
// assertImageColorEquals(url, Color.BLUE);
}
@@ -268,7 +265,7 @@
int count = selenium.getXpathCount(LOC_UPLOADED_LIST_TR).intValue();
assertEquals(count, 0, MSG_RIGHT_PANEL_NUMBER_OF_ITEMS);
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_CYAN);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_CYAN);
waitForElement(LOC_UPLOADED_LIST_TR);
count = selenium.getXpathCount(LOC_UPLOADED_LIST_TR).intValue();
@@ -282,11 +279,11 @@
public void testUploadFiveFiles() {
assertTrue(!belongsClass("rich-fileupload-button-dis",
LOC_ADD_BUTTON_CLASS), MSG_ADD_BUTTON_ENABLED);
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_YELLOW);
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 2), "file://" +
FILE_BLUE);
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 3), "file://" +
FILE_CYAN);
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 4), "file://" +
FILE_ORANGE);
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 5), "file://" +
FILE_RED);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_YELLOW);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 2), "file://" +
FILE_BLUE);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 3), "file://" +
FILE_CYAN);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 4), "file://" +
FILE_ORANGE);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 5), "file://" +
FILE_RED);
assertFalse(!belongsClass("rich-fileupload-button-dis",
LOC_ADD_BUTTON_CLASS), MSG_ADD_BUTTON_NOT_ENABLED);
}
@@ -298,27 +295,27 @@
*/
@Test
public void testUploadBigFile() {
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_YELLOW);
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 2), "file://" +
FILE_BIG);
-
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_YELLOW);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 2), "file://" +
FILE_BIG);
+
selenium.click(LOC_UPLOAD_BUTTON);
waitFor(2000);
-
- String text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_NAME, 1));
- assertEquals(text, "selenium-test" + Color.YELLOW.getRGB() +
".jpg", String.format(MSG_LEFT_PANEL_NAME_N, 1));
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_NAME, 2));
- assertEquals(text, "selenium-test" + Color.GREEN.getRGB() +
".jpg", String.format(MSG_LEFT_PANEL_NAME_N, 2));
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_CANCEL, 1));
- assertEquals(text, "Clear", String.format(MSG_LEFT_PANEL_CANCEL_N,
1));
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_CANCEL, 2));
- assertEquals(text, "Cancel", String.format(MSG_LEFT_PANEL_CANCEL_N,
2));
+ String text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_NAME, 1));
+ assertEquals(text, "selenium-test" + Color.YELLOW.getRGB() +
".jpg", format(MSG_LEFT_PANEL_NAME_N, 1));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_NAME, 2));
+ assertEquals(text, "selenium-test" + Color.GREEN.getRGB() +
".jpg", format(MSG_LEFT_PANEL_NAME_N, 2));
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_DONE, 1));
- assertEquals(text, "Done", String.format(MSG_LEFT_PANEL_DONE_N, 2));
- text = selenium.getText(String.format(LOC_NOT_UPLOADED_LIST_N_DONE, 2));
- assertEquals(text, "File size restricted",
String.format(MSG_LEFT_PANEL_DONE_N, 2));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_CANCEL, 1));
+ assertEquals(text, "Clear", format(MSG_LEFT_PANEL_CANCEL_N, 1));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_CANCEL, 2));
+ assertEquals(text, "Cancel", format(MSG_LEFT_PANEL_CANCEL_N, 2));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_DONE, 1));
+ assertEquals(text, "Done", format(MSG_LEFT_PANEL_DONE_N, 2));
+ text = selenium.getText(format(LOC_NOT_UPLOADED_LIST_N_DONE, 2));
+ assertEquals(text, "File size restricted",
format(MSG_LEFT_PANEL_DONE_N, 2));
+
int count = selenium.getXpathCount(LOC_UPLOADED_LIST_TR).intValue();
assertEquals(count, 1, MSG_RIGHT_PANEL_NUMBER_OF_ITEMS);
}
@@ -330,8 +327,8 @@
*/
@Test
public void testClearAllButton() {
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_YELLOW);
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 2), "file://" +
FILE_CYAN);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_YELLOW);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 2), "file://" +
FILE_CYAN);
assertFalse(isDisplayed(LOC_CLEAR_ALL_BUTTON_STYLE),
MSG_CLEAR_ALL_BUTTON_NOT_VISIBLE);
@@ -357,8 +354,8 @@
*/
@Test
public void testClearUploadedDataButton() {
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_YELLOW);
- selenium.attachFile(String.format(LOC_ADD_BUTTON_N, 2), "file://" +
FILE_CYAN);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 1), "file://" +
FILE_YELLOW);
+ selenium.attachFile(format(LOC_ADD_BUTTON_N, 2), "file://" +
FILE_CYAN);
assertFalse(selenium.isElementPresent(LOC_CLEAR_UPLOADED_DATA_BUTTON),
MSG_CLEAR_UPLOADED_DATA_BUTTON_NOT_VISIBLE);
@@ -460,13 +457,13 @@
* @param expecteColor
* expected color of the image
*/
- private void assertImageColorEquals(String url, Color expecteColor) {
- assertEquals(getPixelColor(url, 0, 0), expecteColor,
String.format(MSG_RIGHT_PANEL_COLOR_N_X_Y, 0, 0));
- assertEquals(getPixelColor(url, 10, 18), expecteColor,
String.format(MSG_RIGHT_PANEL_COLOR_N_X_Y, 10, 18));
- assertEquals(getPixelColor(url, 120, 4), expecteColor,
String.format(MSG_RIGHT_PANEL_COLOR_N_X_Y, 120, 4));
- assertEquals(getPixelColor(url, 5, 9), expecteColor,
String.format(MSG_RIGHT_PANEL_COLOR_N_X_Y, 5, 9));
- assertEquals(getPixelColor(url, 84, 84), expecteColor,
String.format(MSG_RIGHT_PANEL_COLOR_N_X_Y, 84, 84));
- assertEquals(getPixelColor(url, 71, 55), expecteColor,
String.format(MSG_RIGHT_PANEL_COLOR_N_X_Y, 71, 55));
+ private void assertImageColorEquals(String url, Color expectedColor) {
+ assertEquals(getPixelColor(url, 0, 0), expectedColor,
format(MSG_RIGHT_PANEL_COLOR_X_Y, 0, 0));
+ assertEquals(getPixelColor(url, 10, 18), expectedColor,
format(MSG_RIGHT_PANEL_COLOR_X_Y, 10, 18));
+ assertEquals(getPixelColor(url, 120, 4), expectedColor,
format(MSG_RIGHT_PANEL_COLOR_X_Y, 120, 4));
+ assertEquals(getPixelColor(url, 5, 9), expectedColor,
format(MSG_RIGHT_PANEL_COLOR_X_Y, 5, 9));
+ assertEquals(getPixelColor(url, 84, 84), expectedColor,
format(MSG_RIGHT_PANEL_COLOR_X_Y, 84, 84));
+ assertEquals(getPixelColor(url, 71, 55), expectedColor,
format(MSG_RIGHT_PANEL_COLOR_X_Y, 71, 55));
}
/**
@@ -502,6 +499,7 @@
return new Color(red, green, blue);
}
+ @SuppressWarnings("unused")
@BeforeClass
private void createImages() {
createImage(Color.RED, 128, 128);
@@ -512,6 +510,7 @@
createImage(Color.GREEN, 2000, 3500);
}
+ @SuppressWarnings("unused")
@AfterClass
private void cleanUpImages() {
new File(FILE_RED).delete();
@@ -524,6 +523,7 @@
/**
* Loads the page containing the component.
*/
+ @SuppressWarnings("unused")
@BeforeMethod
private void loadPage() {
openComponent("File Upload");
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inplaceInput/InplaceInputTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inplaceInput/InplaceInputTestCase.java 2009-09-09
13:25:06 UTC (rev 15504)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/inplaceInput/InplaceInputTestCase.java 2009-09-09
13:44:10 UTC (rev 15505)
@@ -1,3 +1,21 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
package org.jboss.richfaces.integrationTest.inplaceInput;
import static org.testng.Assert.assertFalse;
@@ -10,26 +28,24 @@
/**
* Test case that tests the inplace input component.
- * <ul>
- * <li><b>TODO</b> create tests for the fourth example (table)
- * </ul>
- *
+ *
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
+// TODO create tests for the fourth example (table)
public class InplaceInputTestCase extends AbstractSeleniumRichfacesTestCase {
// messages
- private final String MSG_COMPONENT_DESCRIPTION =
getMess("COMPONENT_DESCRIPTION");
- private final String MSG_INITIAL_VALUE_NAME = getMess("INITIAL_VALUE_NAME");
- private final String MSG_INITIAL_VALUE_EMAIL =
getMess("INITIAL_VALUE_EMAIL");
- private final String MSG_NAME_JOHN_SMITH = getMess("NAME_JOHN_SMITH");
- private final String MSG_EMAIL_JOHN_SMITH = getMess("EMAIL_JOHN_SMITH");
- private final String MSG_RICH_INPLACE_VIEW = getMess("RICH_INPLACE_VIEW");
- private final String MSG_RICH_INPLACE_CHANGED =
getMess("RICH_INPLACE_CHANGED");
- private final String MSG_NOT_RICH_INPLACE_CHANGED =
getMess("NOT_RICH_INPLACE_CHANGED");
- private final String MSG_RICH_INPLACE_EDIT = getMess("RICH_INPLACE_EDIT");
- private final String MSG_NOT_RICH_INPLACE_EDIT =
getMess("NOT_RICH_INPLACE_EDIT");
+ private final String MSG_COMPONENT_DESCRIPTION =
getMsg("COMPONENT_DESCRIPTION");
+ private final String MSG_INITIAL_VALUE_NAME = getMsg("INITIAL_VALUE_NAME");
+ private final String MSG_INITIAL_VALUE_EMAIL = getMsg("INITIAL_VALUE_EMAIL");
+ private final String MSG_NAME_JOHN_SMITH = getMsg("NAME_JOHN_SMITH");
+ private final String MSG_EMAIL_JOHN_SMITH = getMsg("EMAIL_JOHN_SMITH");
+ private final String MSG_RICH_INPLACE_VIEW = getMsg("RICH_INPLACE_VIEW");
+ private final String MSG_RICH_INPLACE_CHANGED =
getMsg("RICH_INPLACE_CHANGED");
+ private final String MSG_NOT_RICH_INPLACE_CHANGED =
getMsg("NOT_RICH_INPLACE_CHANGED");
+ private final String MSG_RICH_INPLACE_EDIT = getMsg("RICH_INPLACE_EDIT");
+ private final String MSG_NOT_RICH_INPLACE_EDIT =
getMsg("NOT_RICH_INPLACE_EDIT");
// locators
private final String LOC_FIRST_NAME = getLoc("FIRST_NAME");
@@ -59,30 +75,22 @@
public void testFirstName() {
scrollIntoView(LOC_FIRST_NAME, true);
- String attr = selenium.getAttribute(LOC_FIRST_NAME + "@class");
- assertTrue(attr.contains("rich-inplace-view"), MSG_RICH_INPLACE_VIEW);
- assertFalse(attr.contains("rich-inplace-changed"),
- MSG_NOT_RICH_INPLACE_CHANGED);
- assertFalse(attr.contains("rich-inplace-edit"),
- MSG_NOT_RICH_INPLACE_EDIT);
-
+ assertTrue(belongsClass("rich-inplace-view", LOC_FIRST_NAME),
MSG_RICH_INPLACE_VIEW);
+ assertFalse(belongsClass("rich-inplace-changed", LOC_FIRST_NAME),
MSG_NOT_RICH_INPLACE_CHANGED);
+ assertFalse(belongsClass("rich-inplace-edit", LOC_FIRST_NAME),
MSG_NOT_RICH_INPLACE_EDIT);
+
String text = selenium.getText(LOC_FIRST_NAME);
- assertTrue(text.endsWith("click to enter your name"),
- MSG_INITIAL_VALUE_NAME);
+ assertTrue(text.endsWith("click to enter your name"),
MSG_INITIAL_VALUE_NAME);
selenium.click(LOC_FIRST_NAME);
- attr = selenium.getAttribute(LOC_FIRST_NAME + "@class");
- assertTrue(attr.contains("rich-inplace-edit"), MSG_RICH_INPLACE_EDIT);
+ assertTrue(belongsClass("rich-inplace-edit", LOC_FIRST_NAME),
MSG_RICH_INPLACE_EDIT);
selenium.type(LOC_FIRST_NAME_INPUT, "John Smith");
selenium.fireEvent(LOC_FIRST_NAME_INPUT, "blur");
- attr = selenium.getAttribute(LOC_FIRST_NAME + "@class");
- assertTrue(attr.contains("rich-inplace-changed"),
- MSG_RICH_INPLACE_CHANGED);
- assertFalse(attr.contains("rich-inplace-edit"),
- MSG_NOT_RICH_INPLACE_EDIT);
+ assertTrue(belongsClass("rich-inplace-changed", LOC_FIRST_NAME),
MSG_RICH_INPLACE_CHANGED);
+ assertFalse(belongsClass("rich-inplace-edit", LOC_FIRST_NAME),
MSG_NOT_RICH_INPLACE_EDIT);
text = selenium.getText(LOC_FIRST_NAME);
assertTrue(text.endsWith("John Smith"), MSG_NAME_JOHN_SMITH);
@@ -98,30 +106,22 @@
public void testFirstEmail() {
scrollIntoView(LOC_FIRST_EMAIL, true);
- String attr = selenium.getAttribute(LOC_FIRST_EMAIL + "@class");
- assertTrue(attr.contains("rich-inplace-view"), MSG_RICH_INPLACE_VIEW);
- assertFalse(attr.contains("rich-inplace-changed"),
- MSG_NOT_RICH_INPLACE_CHANGED);
- assertFalse(attr.contains("rich-inplace-edit"),
- MSG_NOT_RICH_INPLACE_EDIT);
+ assertTrue(belongsClass("rich-inplace-view", LOC_FIRST_EMAIL),
MSG_RICH_INPLACE_VIEW);
+ assertFalse(belongsClass("rich-inplace-changed", LOC_FIRST_EMAIL),
MSG_NOT_RICH_INPLACE_CHANGED);
+ assertFalse(belongsClass("rich-inplace-edit", LOC_FIRST_EMAIL),
MSG_NOT_RICH_INPLACE_EDIT);
String text = selenium.getText(LOC_FIRST_EMAIL);
- assertTrue(text.endsWith("click to enter your email"),
- MSG_INITIAL_VALUE_EMAIL);
+ assertTrue(text.endsWith("click to enter your email"),
MSG_INITIAL_VALUE_EMAIL);
selenium.click(LOC_FIRST_EMAIL);
- attr = selenium.getAttribute(LOC_FIRST_EMAIL + "@class");
- assertTrue(attr.contains("rich-inplace-edit"), MSG_RICH_INPLACE_EDIT);
+ assertTrue(belongsClass("rich-inplace-edit", LOC_FIRST_EMAIL),
MSG_RICH_INPLACE_EDIT);
selenium.type(LOC_FIRST_EMAIL_INPUT, "john(a)smith.name");
selenium.fireEvent(LOC_FIRST_EMAIL_INPUT, "blur");
- attr = selenium.getAttribute(LOC_FIRST_EMAIL + "@class");
- assertTrue(attr.contains("rich-inplace-changed"),
- MSG_RICH_INPLACE_CHANGED);
- assertFalse(attr.contains("rich-inplace-edit"),
- MSG_NOT_RICH_INPLACE_EDIT);
+ assertTrue(belongsClass("rich-inplace-changed", LOC_FIRST_EMAIL),
MSG_RICH_INPLACE_CHANGED);
+ assertFalse(belongsClass("rich-inplace-edit", LOC_FIRST_EMAIL),
MSG_NOT_RICH_INPLACE_EDIT);
text = selenium.getText(LOC_FIRST_EMAIL);
assertTrue(text.endsWith("john(a)smith.name"), MSG_EMAIL_JOHN_SMITH);
@@ -137,31 +137,23 @@
public void testSecondName() {
scrollIntoView(LOC_SECOND_NAME, true);
- String attr = selenium.getAttribute(LOC_SECOND_NAME + "@class");
- assertTrue(attr.contains("rich-inplace-view"), MSG_RICH_INPLACE_VIEW);
- assertFalse(attr.contains("rich-inplace-changed"),
- MSG_NOT_RICH_INPLACE_CHANGED);
- assertFalse(attr.contains("rich-inplace-edit"),
- MSG_NOT_RICH_INPLACE_EDIT);
+ assertTrue(belongsClass("rich-inplace-view", LOC_SECOND_NAME),
MSG_RICH_INPLACE_VIEW);
+ assertFalse(belongsClass("rich-inplace-changed", LOC_SECOND_NAME),
MSG_NOT_RICH_INPLACE_CHANGED);
+ assertFalse(belongsClass("rich-inplace-edit", LOC_SECOND_NAME),
MSG_NOT_RICH_INPLACE_EDIT);
String text = selenium.getText(LOC_SECOND_NAME);
- assertTrue(text.endsWith("click to enter your name"),
- MSG_INITIAL_VALUE_NAME);
+ assertTrue(text.endsWith("click to enter your name"),
MSG_INITIAL_VALUE_NAME);
selenium.click(LOC_SECOND_NAME);
- attr = selenium.getAttribute(LOC_SECOND_NAME + "@class");
- assertTrue(attr.contains("rich-inplace-edit"), MSG_RICH_INPLACE_EDIT);
+ assertTrue(belongsClass("rich-inplace-edit", LOC_SECOND_NAME),
MSG_RICH_INPLACE_EDIT);
selenium.type(LOC_SECOND_NAME_INPUT, "John Smith");
// TODO check that the button is visible
selenium.fireEvent(LOC_SECOND_NAME_OK, Event.MOUSEDOWN);
- attr = selenium.getAttribute(LOC_SECOND_NAME + "@class");
- assertTrue(attr.contains("rich-inplace-changed"),
- MSG_RICH_INPLACE_CHANGED);
- assertFalse(attr.contains("rich-inplace-edit"),
- MSG_NOT_RICH_INPLACE_EDIT);
+ assertTrue(belongsClass("rich-inplace-changed", LOC_SECOND_NAME),
MSG_RICH_INPLACE_CHANGED);
+ assertFalse(belongsClass("rich-inplace-edit", LOC_SECOND_NAME),
MSG_NOT_RICH_INPLACE_EDIT);
text = selenium.getText(LOC_SECOND_NAME);
assertTrue(text.endsWith("John Smith"), MSG_NAME_JOHN_SMITH);
@@ -177,31 +169,23 @@
public void testSecondEmail() {
scrollIntoView(LOC_SECOND_EMAIL, true);
- String attr = selenium.getAttribute(LOC_SECOND_EMAIL + "@class");
- assertTrue(attr.contains("rich-inplace-view"), MSG_RICH_INPLACE_VIEW);
- assertFalse(attr.contains("rich-inplace-changed"),
- MSG_NOT_RICH_INPLACE_CHANGED);
- assertFalse(attr.contains("rich-inplace-edit"),
- MSG_NOT_RICH_INPLACE_EDIT);
+ assertTrue(belongsClass("rich-inplace-view", LOC_SECOND_EMAIL),
MSG_RICH_INPLACE_VIEW);
+ assertFalse(belongsClass("rich-inplace-changed", LOC_SECOND_EMAIL),
MSG_NOT_RICH_INPLACE_CHANGED);
+ assertFalse(belongsClass("rich-inplace-edit", LOC_SECOND_EMAIL),
MSG_NOT_RICH_INPLACE_EDIT);
String text = selenium.getText(LOC_SECOND_EMAIL);
- assertTrue(text.endsWith("click to enter your email"),
- MSG_INITIAL_VALUE_EMAIL);
+ assertTrue(text.endsWith("click to enter your email"),
MSG_INITIAL_VALUE_EMAIL);
selenium.click(LOC_SECOND_EMAIL);
- attr = selenium.getAttribute(LOC_SECOND_EMAIL + "@class");
- assertTrue(attr.contains("rich-inplace-edit"), MSG_RICH_INPLACE_EDIT);
+ assertTrue(belongsClass("rich-inplace-edit", LOC_SECOND_EMAIL),
MSG_RICH_INPLACE_EDIT);
selenium.type(LOC_SECOND_EMAIL_INPUT, "john(a)smith.name");
// TODO check that the button is visible
selenium.fireEvent(LOC_SECOND_EMAIL_OK, Event.MOUSEDOWN);
- attr = selenium.getAttribute(LOC_SECOND_EMAIL + "@class");
- assertTrue(attr.contains("rich-inplace-changed"),
- MSG_RICH_INPLACE_CHANGED);
- assertFalse(attr.contains("rich-inplace-edit"),
- MSG_NOT_RICH_INPLACE_EDIT);
+ assertTrue(belongsClass("rich-inplace-changed", LOC_SECOND_EMAIL),
MSG_RICH_INPLACE_CHANGED);
+ assertFalse(belongsClass("rich-inplace-edit", LOC_SECOND_EMAIL),
MSG_NOT_RICH_INPLACE_EDIT);
text = selenium.getText(LOC_SECOND_EMAIL);
assertTrue(text.endsWith("john(a)smith.name"), MSG_EMAIL_JOHN_SMITH);
@@ -217,70 +201,94 @@
public void testThird() {
scrollIntoView(LOC_THIRD, true);
- String attr = selenium.getAttribute(LOC_THIRD + "@class");
- assertTrue(attr.contains("rich-inplace-view"), MSG_RICH_INPLACE_VIEW);
- assertFalse(attr.contains("rich-inplace-changed"),
- MSG_NOT_RICH_INPLACE_CHANGED);
- assertFalse(attr.contains("rich-inplace-edit"),
- MSG_NOT_RICH_INPLACE_EDIT);
+ assertTrue(belongsClass("rich-inplace-view", LOC_THIRD),
MSG_RICH_INPLACE_VIEW);
+ assertFalse(belongsClass("rich-inplace-changed", LOC_THIRD),
MSG_NOT_RICH_INPLACE_CHANGED);
+ assertFalse(belongsClass("rich-inplace-edit", LOC_THIRD),
MSG_NOT_RICH_INPLACE_EDIT);
String text = selenium.getText(LOC_THIRD);
assertTrue(text.endsWith("Click here to edit"), MSG_INITIAL_VALUE_EMAIL);
selenium.click(LOC_THIRD);
- attr = selenium.getAttribute(LOC_THIRD + "@class");
- assertTrue(attr.contains("rich-inplace-edit"), MSG_RICH_INPLACE_EDIT);
+ assertTrue(belongsClass("rich-inplace-edit", LOC_THIRD),
MSG_RICH_INPLACE_EDIT);
selenium.type(LOC_THIRD_INPUT, "John Smith");
// TODO check that the button is visible
selenium.fireEvent(LOC_THIRD_SAVE, Event.MOUSEDOWN);
- attr = selenium.getAttribute(LOC_THIRD + "@class");
- assertTrue(attr.contains("rich-inplace-changed"),
- MSG_RICH_INPLACE_CHANGED);
- assertFalse(attr.contains("rich-inplace-edit"),
- MSG_NOT_RICH_INPLACE_EDIT);
+ assertTrue(belongsClass("rich-inplace-changed", LOC_THIRD),
MSG_RICH_INPLACE_CHANGED);
+ assertFalse(belongsClass("rich-inplace-edit", LOC_THIRD),
MSG_NOT_RICH_INPLACE_EDIT);
text = selenium.getText(LOC_THIRD);
assertTrue(text.endsWith("John Smith"), MSG_NAME_JOHN_SMITH);
}
/**
- * Tests the "View Source". It checks that the source code is not visible,
- * clicks on the link, and checks the first 2 components of source code,
- * i.e. that the source code begins with "<ui:composition".
- */
- @Test
- public void testFirstInputSource() {
- abstractTestSource(1, 2, "<", "ui:composition");
- }
+ * Tests the "View Source" in the first example. It checks that the source
code is not visible,
+ * clicks on the link, and checks 9 lines of source code.
+ */
+ @Test
+ public void testFirstSource() {
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<rich:panel style=\"width:220px;\">",
+ "<f:facet name=\"header\">",
+ "<h:outputText value=\"Person
Info\"></h:outputText>",
+ "<h:panelGrid columns=\"2\">",
+ "<h:outputText value=\"Name: \"/>",
+ "<rich:inplaceInput defaultLabel=\"click to enter your
name\"/>",
+ "<h:outputText value=\"Email:\"/>",
+ "<rich:inplaceInput defaultLabel=\"click to enter your
email\"/>",
+ };
- /**
- * Tests the "View Source". It checks that the source code is not visible,
- * clicks on the link, and checks the first 2 components of source code,
- * i.e. that the source code begins with "<ui:composition".
- */
- @Test
- public void testSecondInputSource() {
- abstractTestSource(2, 2, "<", "ui:composition");
- }
+ abstractTestSource(1, "View Source", strings);
+ }
- /**
- * Tests the "View Source". It checks that the source code is not visible,
- * clicks on the link, and checks the first 2 components of source code,
- * i.e. that the source code begins with "<ui:composition".
- */
- @Test
- public void testThirdInputSource() {
- abstractTestSource(3, 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 9 lines of source code.
+ */
+ @Test
+ public void testSecondSource() {
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<rich:panel style=\"width:220px;\">",
+ "<f:facet name=\"header\">",
+ "<h:outputText value=\"Person Info\"/>",
+ "<h:panelGrid columns=\"2\">",
+ "<h:outputText value=\"Name: \"/>",
+ "<rich:inplaceInput defaultLabel=\"click to enter your
name\" ",
+ "showControls=\"true\"/>",
+ "</h:panelGrid>",
+ };
+ abstractTestSource(2, "View Source", strings);
+ }
+
+ /**
+ * Tests the "View Source" in the third example. It checks that the source
code is not visible,
+ * clicks on the link, and checks 9 lines of source code.
+ */
+ @Test
+ public void testThirdSource() {
+ String[] strings = new String[] { "<ui:composition
xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<rich:inplaceInput defaultLabel=\"Click here to edit\"
showControls=\"true\"",
+ "controlsHorizontalPosition=\"left\"
controlsVerticalPosition=\"bottom\"",
+ "id=\"inplaceInput\">",
+ " <f:facet name=\"controls\">",
+ "<button
onmousedown=\"#{rich:component('inplaceInput')}.save();\"",
+ " type=\"button\">Save</button>",
+ "<button
onmousedown=\"#{rich:component('inplaceInput')}.cancel();\"",
+ "<rich:spacer height=\"25px\"
width=\"100%\"/>",
+ };
+
+ abstractTestSource(3, "View Source", strings);
+ }
+
/**
- * Loads the page containing the calendar component.
- */
- @BeforeMethod
- private void loadPage() {
- super.loadPage("richInputs", 6, MSG_COMPONENT_DESCRIPTION);
- }
+ * Loads the page containing needed component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Inplace Input");
+ }
}
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-09
13:25:06 UTC (rev 15504)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spinner/SpinnerTestCase.java 2009-09-09
13:44:10 UTC (rev 15505)
@@ -295,7 +295,7 @@
}
/**
- * Loads the page containing the calendar component.
+ * Loads the page containing needed component.
*/
@SuppressWarnings("unused")
@BeforeMethod
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/contextMenu/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/contextMenu/locators.properties 2009-09-09
13:25:06 UTC (rev 15504)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/contextMenu/locators.properties 2009-09-09
13:44:10 UTC (rev 15505)
@@ -1,6 +1,20 @@
# ContextMenuImageTestCase
-HEADER=//fieldset[1]/legend
-IMAGE=//fieldset[1]/div/table//tr/td/span/img
-CONTEXT_MENU=//fieldset[1]/div/table//tr/td/span/div/div/div
-ZOOM_IN=//div[@id='zin']
-ZOOM_OUT=//div[@id='zout']
\ No newline at end of file
+FIRST_HEADER=//fieldset[1]/legend
+FIRST_IMAGE=//fieldset[1]/div/table//tr/td/span/img
+FIRST_CONTEXT_MENU=//fieldset[1]/div/table//tr/td/span/div/div/div
+FIRST_ZOOM_IN=//div[@id='zin']
+FIRST_ZOOM_OUT=//div[@id='zout']
+
+# ContextMenuTableTestCase
+SECOND_EXAMPLE_HEADER=//fieldset[2]/legend
+SECOND_CONTEXT_MENU=//fieldset[2]/div/form/div/div/div[1]
+SECOND_LAST_MENU_ACTION=//fieldset[2]/div/form/table/tbody/tr/td[2]/span/div/div[2]
+
+SECOND_CAR_DETAILS=//fieldset[2]/div/form/div/div/div[1]/div/div[1]/span[2]
+SECOND_ACTIONS=//fieldset[2]/div/form/div/div/div[2]
+SECOND_ACTION_PREFORMATTED=//fieldset[2]/div/form/div/div/div[2]/div/div[{0}]/span[2]
+
+SECOND_LINE_3_COLUMN_1=//fieldset[2]/div/form/table/tbody/tr/td[1]/table/tbody/tr[3]/td[1]
+SECOND_LINE_3_COLUMN_2=//fieldset[2]/div/form/table/tbody/tr/td[1]/table/tbody/tr[3]/td[2]
+SECOND_LINE_6_COLUMN_2=//fieldset[2]/div/form/table/tbody/tr/td[1]/table/tbody/tr[6]/td[2]
+SECOND_LINE_1_COLUMN_3=//fieldset[2]/div/form/table/tbody/tr/td[1]/table/tbody/tr[1]/td[3]
\ No newline at end of file
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/contextMenu/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/contextMenu/messages.properties 2009-09-09
13:25:06 UTC (rev 15504)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/contextMenu/messages.properties 2009-09-09
13:44:10 UTC (rev 15505)
@@ -0,0 +1,5 @@
+# ContextMenuTableTestCase
+SECOND_CAR_DETAILS_PREFORMATTED={0} {1} details
+SECOND_PUT_PRODUCER_MODEL_TO_BASKET_PREFORMATTED=Put {0} {1} To Basket
+SECOND_READ_COMMENTS_PREFORMATTED=Read Comments
+SECOND_GO_TO_PRODUCER_SITE_PREFORMATTED=Go to {0} site
\ No newline at end of file
Added:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dropDownMenu/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dropDownMenu/locators.properties
(rev 0)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dropDownMenu/locators.properties 2009-09-09
13:44:10 UTC (rev 15505)
@@ -0,0 +1,9 @@
+FIRST_EXAMPLE_HEADER=//fieldset[1]/legend
+FIRST_CURRENT_SELECTION=//fieldset[1]/div/span/span
+FIRST_MENU=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div[2]/div[1]
+FIRST_MENU_NEW=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div[2]/div/div/div[1]
+FIRST_MENU_SAVE_ALL=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div[2]/div[2]/div/div[2]
+FIRST_MENU_SEPARATOR=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div[2]/div[1]/div/div[5]
+FIRST_MENU_IMAGE=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div[1]/img
+FIRST_MENU_LINK_HOMEPAGE=//fieldset[1]/div/form/table/tbody/tr/td[2]/div/div[2]/div/div/div[1]/span[2]/a
+FIRST_MENU_LINK_FORUM=//fieldset[1]/div/form/table/tbody/tr/td[2]/div/div[2]/div/div/div[2]/span[2]/a
\ 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/dropDownMenu/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/dropDownMenu/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dropDownMenu/messages.properties
(rev 0)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dropDownMenu/messages.properties 2009-09-09
13:44:10 UTC (rev 15505)
@@ -0,0 +1,3 @@
+FIRST_INITIAL_CURRENT_SELECTION=
+FIRST_CURRENT_SELECTION_NEW=New
+FIRST_CURRENT_SELECTION_SAVE_ALL=Save All
\ 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/dropDownMenu/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/editor/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/editor/locators.properties 2009-09-09
13:25:06 UTC (rev 15504)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/editor/locators.properties 2009-09-09
13:44:10 UTC (rev 15505)
@@ -22,7 +22,7 @@
TEXT_AREA_UL_LI=//body[@id='tinymce']/ul/li
TEXT_AREA_ADDRESS=//body[@id='tinymce']/address
TEXT_AREA_PRE=//body[@id='tinymce']/pre
-TEXT_AREA_HN=//body[@id='tinymce']/h%d
+TEXT_AREA_HN=//body[@id='tinymce']/h{0}
# simple editor' buttons
BOLD_BUTTON=id=form:editorTextArea_bold
@@ -43,8 +43,8 @@
ADV_ALIGN_FULL_BUTTON=id=form:editorTextArea_justifyfull
ADV_STYLE_SELECT_BUTTON=id=form:editorTextArea_styleselect_open
ADV_FORMAT_SELECT_BUTTON=id=form:editorTextArea_formatselect_open
-ADV_STYLE_N=//table[@id='menu_form:editorTextArea_form:editorTextArea_styleselect_menu_tbl']/tbody/tr[%d]
-ADV_FORMAT_N=//table[@id='menu_form:editorTextArea_form:editorTextArea_formatselect_menu_tbl']/tbody/tr[%d]
+ADV_STYLE_N=//table[@id='menu_form:editorTextArea_form:editorTextArea_styleselect_menu_tbl']/tbody/tr[{0}]
+ADV_FORMAT_N=//table[@id='menu_form:editorTextArea_form:editorTextArea_formatselect_menu_tbl']/tbody/tr[{0}]
ADV_INDENT_BUTTON=id=form:editorTextArea_indent
ADV_OUTDENT_BUTTON=id=form:editorTextArea_outdent
ADV_HORIZONTAL_RULER_BUTTON=id=form:editorTextArea_hr
@@ -81,7 +81,7 @@
ADV_IMAGE_DLG_INSERT_BUTTON=id=insert
# insert custom character dialog
-ADV_CUSTOM_CHAR_DLG_M_N=//td[@id='charmapView']/table/tbody/tr[%d]/td[%d]/a
+ADV_CUSTOM_CHAR_DLG_M_N=//td[@id='charmapView']/table/tbody/tr[{0}]/td[{1}]/a
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/editor/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/editor/messages.properties 2009-09-09
13:25:06 UTC (rev 15504)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/editor/messages.properties 2009-09-09
13:44:10 UTC (rev 15505)
@@ -1,4 +1,3 @@
-COMPONENT_DESCRIPTION=RichFaces Editor component provides possibility to use tinyMCE
widget
STRINGS_SHOULD_BE_BOLD=The string "bbbb" and "dddd" should be in
bold.
STRINGS_SHOULD_BE_ITALIC=The strings "bbbb" and "dddd" should be in
italic.
STRINGS_SHOULD_BE_UNDERLINED=The strings "bbbb" and "dddd" should be
underlined.
@@ -9,21 +8,21 @@
TWO_LINES_SHOULD_CONTAIN_A_PARAGRAPH=The first and the fifth line should contain a
paragraph.
TWO_LINES_IN_THE_EDITOR=There should be two lines in the editor.
LIST_SHOULD_CONTAIN_THREE_ITEMS=The list should contain three items.
-PARAGRAPH_ALIGNED_TO_THE_SIDE_S=The paragraph should be aligned to the %s.
+PARAGRAPH_ALIGNED_TO_THE_SIDE_S=The paragraph should be aligned to the {0}.
PARAGRAPH_JUSTIFIED=The paragraph should be justified.
PARAGRAPH_SHOULD_HAVE_NO_STYLE=The paragraph should not be styled.
PARAGRAPHS_CLASS_ATTRIBUTE=Paragraph's class attribute.
-TAG_S_SHOULD_BE_IN_EDITOR=Tag %s should appear in the editor.
-TAG_S_SHOULD_NOT_BE_IN_EDITOR=Tag %s should not appear in the editor.
-CONTENT_OF_TAG_S=Content of tag %s.
-PARAGRAPH_INDENTED_BY_N_PX=Paragraph should be indented by %d pixels.
+TAG_S_SHOULD_BE_IN_EDITOR=Tag {0} should appear in the editor.
+TAG_S_SHOULD_NOT_BE_IN_EDITOR=Tag {0} should not appear in the editor.
+CONTENT_OF_TAG_S=Content of tag {0}.
+PARAGRAPH_INDENTED_BY_N_PX=Paragraph should be indented by {0} pixels.
NUMBER_OF_RULERS=The number of horizontal rulers in the editor.
TEXT_IN_SUBSCRIPT=Text written as subscript.
TEXT_IN_SUPERSCRIPT=Text written as superscript.
LABEL_OF_LINK=Label of the link.
-LINK_ATTRIBUTE_S=Attribute %s of the link.
+LINK_ATTRIBUTE_S=Attribute {0} of the link.
CLASS_ATTRIBUTE=Attribute class of the text in the editor.
-IMG_ATTRIBUTE_S=Attribute %s of the image.
+IMG_ATTRIBUTE_S=Attribute {0} of the image.
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/fileUpload/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/fileUpload/locators.properties 2009-09-09
13:25:06 UTC (rev 15504)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/fileUpload/locators.properties 2009-09-09
13:44:10 UTC (rev 15505)
@@ -1,5 +1,5 @@
EXAMPLE_HEADER=//fieldset[1]/legend
-ADD_BUTTON_N=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/table/tbody/tr/td/div[1]/div/div[2]/input[%d]
+ADD_BUTTON_N=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/table/tbody/tr/td/div[1]/div/div[2]/input[{0}]
ADD_BUTTON_CLASS=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/table/tbody/tr/td/div[1]/div
UPLOAD_BUTTON_STYLE=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/table/tbody/tr/td/div[2]
UPLOAD_BUTTON=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/table/tbody/tr/td/div[2]/div
@@ -8,15 +8,15 @@
CLEAR_UPLOADED_DATA_BUTTON=//fieldset[1]/div/form/table/tbody/tr/td[2]/span/input
NOT_UPLOADED_LIST_TR=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div/table/tbody/tr
-NOT_UPLOADED_LIST_N_NAME=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div/table[%d]/tbody/tr/td[1]/div[1]
-NOT_UPLOADED_LIST_N_DONE=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div/table[%d]/tbody/tr/td[1]/div[3]
-NOT_UPLOADED_LIST_N_CANCEL=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div/table[%d]/tbody/tr/td[2]/div/a
+NOT_UPLOADED_LIST_N_NAME=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div/table[{0}]/tbody/tr/td[1]/div[1]
+NOT_UPLOADED_LIST_N_DONE=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div/table[{0}]/tbody/tr/td[1]/div[3]
+NOT_UPLOADED_LIST_N_CANCEL=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/div/table[{0}]/tbody/tr/td[2]/div/a
UPLOADED_FILES_INFO=//fieldset[1]/div/form/table/tbody/tr/td[2]/span/div/div[2]
UPLOADED_LIST_TR=//fieldset[1]/div/form/table/tbody/tr/td[2]/span/div/div[2]/table/tbody/tr
-UPLOADED_LIST_N_IMG=//fieldset[1]/div/form/table/tbody/tr/td[2]/span/div/div[2]/table/tbody/tr[%d]/td/div/div/table/tbody/tr/td[1]/img
-UPLOADED_LIST_N_NAME=//fieldset[1]/div/form/table/tbody/tr/td[2]/span/div/div[2]/table/tbody/tr[%d]/td/div/div/table/tbody/tr/td[2]/table/tbody/tr[1]/td[2]
-UPLOADED_LIST_N_SIZE=//fieldset[1]/div/form/table/tbody/tr/td[2]/span/div/div[2]/table/tbody/tr[%d]/td/div/div/table/tbody/tr/td[2]/table/tbody/tr[2]/td[2]
+UPLOADED_LIST_N_IMG=//fieldset[1]/div/form/table/tbody/tr/td[2]/span/div/div[2]/table/tbody/tr[{0}]/td/div/div/table/tbody/tr/td[1]/img
+UPLOADED_LIST_N_NAME=//fieldset[1]/div/form/table/tbody/tr/td[2]/span/div/div[2]/table/tbody/tr[{0}]/td/div/div/table/tbody/tr/td[2]/table/tbody/tr[1]/td[2]
+UPLOADED_LIST_N_SIZE=//fieldset[1]/div/form/table/tbody/tr/td[2]/span/div/div[2]/table/tbody/tr[{0}]/td/div/div/table/tbody/tr/td[2]/table/tbody/tr[2]/td[2]
AUTOMATIC_UPLOAD=//fieldset[2]/form/table/tbody/tr/td[1]/input
FLASH=//fieldset[2]/form/table/tbody/tr/td[2]/input
\ No newline at end of file
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/fileUpload/messages.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/fileUpload/messages.properties 2009-09-09
13:25:06 UTC (rev 15504)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/fileUpload/messages.properties 2009-09-09
13:44:10 UTC (rev 15505)
@@ -3,15 +3,15 @@
COULD_NOT_READ_IMAGE=Could not read the image from the given URL.
LEFT_PANEL_NUMBER_OF_ITEMS=The number of items in the left panel.
-LEFT_PANEL_NAME_N=The name of the item nr. %d in the left panel.
-LEFT_PANEL_CANCEL_N=The link of the item nr. %d in the left panel.
-LEFT_PANEL_DONE_N=The string under item nr. %d's name in the left panel.
+LEFT_PANEL_NAME_N=The name of the item nr. {0} in the left panel.
+LEFT_PANEL_CANCEL_N=The link of the item nr. {0} in the left panel.
+LEFT_PANEL_DONE_N=The string under item nr. {0}'s name in the left panel.
RIGHT_PANEL_CONTENT=The content of the right panel.
RIGHT_PANEL_NUMBER_OF_ITEMS=The number of items in the right panel.
-RIGHT_PANEL_NAME_N=The name of the item nr. %d in the right panel.
-RIGHT_PANEL_SIZE_N=The size of the item nr. %d in the right panel.
-RIGHT_PANEL_COLOR_N_X_Y=The color of pixel [%d,%d] of image nr. %d in the right panel.
+RIGHT_PANEL_NAME_N=The name of the item nr. {0} in the right panel.
+RIGHT_PANEL_SIZE_N=The size of the item nr. {0} in the right panel.
+RIGHT_PANEL_COLOR_X_Y=The color of pixel [{0},{0}] of image in the right panel.
ADD_BUTTON_ENABLED=The "Add" button should be enabled.
ADD_BUTTON_NOT_ENABLED=The "Add" button should not be enabled.