JBoss Rich Faces SVN: r15502 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest: extendedDataTable and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2009-09-09 04:46:24 -0400 (Wed, 09 Sep 2009)
New Revision: 15502
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/SelectingTestCase.java
Log:
* AbstractSeleniumRichFacesTestCase - add protected Waiting waitForGuiInteraction()
* extendedDataTable/SelectingTestCase - add waiting for GUI rerender when selecting rows
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java 2009-09-09 07:45:43 UTC (rev 15501)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/AbstractSeleniumRichfacesTestCase.java 2009-09-09 08:46:24 UTC (rev 15502)
@@ -51,6 +51,8 @@
* predefined waitings to use in inheritors
*/
protected Waiting waitModelUpdate = Wait.interval(100).timeout(10000);
+ protected Waiting waitGuiInteraction = Wait.interval(100).timeout(500);
+
/**
* Initializes context before each class run.
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/SelectingTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/SelectingTestCase.java 2009-09-09 07:45:43 UTC (rev 15501)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/extendedDataTable/SelectingTestCase.java 2009-09-09 08:46:24 UTC (rev 15502)
@@ -1,26 +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.
-*/
+ * 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.extendedDataTable;
-import static org.testng.Assert.*;
-
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
+import org.jboss.test.selenium.waiting.Condition;
import org.testng.annotations.Test;
/**
@@ -143,19 +142,27 @@
}
private void checkSelection(int[] rows, boolean positiveComparison) {
- String comparison = (positiveComparison) ? "position()=" : "position()!=";
- String conjuction = (positiveComparison) ? " or " : " and ";
- String condition = " and (" + comparison + StringUtils.join(ArrayUtils.toObject(rows), conjuction + comparison)
- + ")";
+ final String condition;
if (rows.length == 0) {
condition = "";
+ } else {
+ String comparison = (positiveComparison) ? "position()=" : "position()!=";
+ String conjuction = (positiveComparison) ? " or " : " and ";
+ condition = " and (" + comparison + StringUtils.join(ArrayUtils.toObject(rows), conjuction + comparison)
+ + ")";
}
- int count = selenium.getXpathCount(format(LOC_TR_SELECTED, condition)).intValue();
+ final int expectedCount = (positiveComparison) ? rows.length : 0;
- assertTrue(positiveComparison ? count == rows.length : count == 0);
+ waitGuiInteraction.timeout(2000).failWith(
+ "In spite of waiting for GUI rendering finish there is wrong number of selected rows").until(
+ new Condition() {
+ public boolean isTrue() {
+ return expectedCount == selenium.getXpathCount(format(LOC_TR_SELECTED, condition)).intValue();
+ }
+ });
}
private int[] getRowSelection(String message) {
15 years, 3 months
JBoss Rich Faces SVN: r15501 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: java/org/jboss/richfaces/integrationTest/colorPicker and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2009-09-09 03:45:43 -0400 (Wed, 09 Sep 2009)
New Revision: 15501
Added:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/comboBox/
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/comboBox/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/comboBox/messages.properties
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarStylingTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/OrganizerTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/colorPicker/ColorPickerTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/comboBox/ComboBoxTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/calendar/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/calendar/messages.properties
Log:
* CalendarStylingTestCase, CalendarTestCase, OrganizerTestCase, ColorPickerTestCase and ComboBoxTestCase refactored
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarStylingTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarStylingTestCase.java 2009-09-08 18:54:35 UTC (rev 15500)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarStylingTestCase.java 2009-09-09 07:45:43 UTC (rev 15501)
@@ -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.calendar;
import static org.testng.Assert.assertTrue;
@@ -14,13 +32,9 @@
*/
public class CalendarStylingTestCase extends AbstractSeleniumRichfacesTestCase {
- // messages
- private final String MSG_COMPONENT_DESCRIPTION_3 = getMsg("COMPONENT_DESCRIPTION_3");
- private final String MSG_EVERY_THIRD_CELL = getMsg("EVERY_THIRD_CELL");
-
// locators
private final String LOC_STYLING_FIELDSET = getLoc("STYLING_FIELDSET");
- private final String LOC_STYLING_CELL_X_Y = getLoc("STYLING_CELL_X_Y");
+ private final String LOC_STYLING_CELL_PREFORMATTED = getLoc("STYLING_CELL_PREFORMATTED");
private final String LOC_STYLING_CALENDAR_BUTTON = getLoc("STYLING_CALENDAR_BUTTON");
private final String LOC_STYLING_RIGHT_ARROW = getLoc("STYLING_RIGHT_ARROW");
@@ -40,12 +54,12 @@
for (int i = 3; i < 9; i++) {
for (int j = 2; j < 9; j++) {
- text = selenium.getText(String.format(LOC_STYLING_CELL_X_Y, i, j));
+ text = selenium.getText(format(LOC_STYLING_CELL_PREFORMATTED, i, j));
date = Integer.parseInt(text);
if (date % 3 == 0) {
- text = selenium.getAttribute(String.format(LOC_STYLING_CELL_X_Y, i, j) + "@class");
+ text = selenium.getAttribute(format(LOC_STYLING_CELL_PREFORMATTED, i, j) + "@class");
assertTrue(text.contains("everyThirdDay") || text.contains("rich-calendar-boundary-dates"),
- MSG_EVERY_THIRD_CELL);
+ "Every third cell should be either disabled (boundary dates) or styled (dates from current month).");
}
}
}
@@ -69,9 +83,11 @@
/**
* Loads the page containing the calendar component.
*/
+ @SuppressWarnings("unused")
@BeforeMethod
private void loadPage() {
- super.loadPage("richInputs", 1, 3, MSG_COMPONENT_DESCRIPTION_3);
+ openComponent("Calendar");
+ openTab("Client Side Disable/Styling");
scrollIntoView(LOC_STYLING_FIELDSET, true);
}
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarTestCase.java 2009-09-08 18:54:35 UTC (rev 15500)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarTestCase.java 2009-09-09 07:45:43 UTC (rev 15501)
@@ -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.calendar;
@@ -350,6 +347,7 @@
/**
* Loads the page containing the calendar component.
*/
+ @SuppressWarnings("unused")
@BeforeMethod
private void loadPage() {
openComponent("Calendar");
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/OrganizerTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/OrganizerTestCase.java 2009-09-08 18:54:35 UTC (rev 15500)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/OrganizerTestCase.java 2009-09-09 07:45:43 UTC (rev 15501)
@@ -38,22 +38,13 @@
*/
public class OrganizerTestCase extends AbstractSeleniumRichfacesTestCase {
- // messages
- private final String MSG_COMPONENT_DESCRIPTION = getMsg("COMPONENT_DESCRIPTION");
- private final String MSG_CLASS_ATTRIBUTE_TODAY = getMsg("CLASS_ATTRIBUTE_TODAY");
- private final String MSG_CLASS_ATTRIBUTE_GREY = getMsg("CLASS_ATTRIBUTE_GREY");
- private final String MSG_DIALOG_VISIBLE = getMsg("DIALOG_VISIBLE");
- private final String MSG_DIALOG_NOT_VISIBLE = getMsg("DIALOG_NOT_VISIBLE");
- private final String MSG_CELL_X_Y_NOTE = getMsg("CELL_X_Y_NOTE");
- private final String MSG_CELL_X_Y_DESC = getMsg("CELL_X_Y_DESC");
-
// locators
private final String LOC_FIELDSET = getLoc("FIELDSET");
- private final String LOC_CELL_X_Y = getLoc("CELL_X_Y");
- private final String LOC_CELL_X_Y_DATE = getLoc("CELL_X_Y_DATE");
- private final String LOC_CELL_X_Y_DESC = getLoc("CELL_X_Y_DESC");
- private final String LOC_CELL_X_Y_NOTE = getLoc("CELL_X_Y_NOTE");
+ private final String LOC_CELL_PREFORMATTED = getLoc("CELL_PREFORMATTED");
+ private final String LOC_CELL_DATE_PREFORMATTED = getLoc("CELL_DATE_PREFORMATTED");
+ private final String LOC_CELL_DESC_PREFORMATTED = getLoc("CELL_DESC_PREFORMATTED");
+ private final String LOC_CELL_NOTE_PREFORMATTED = getLoc("CELL_NOTE_PREFORMATTED");
private final String LOC_DIALOG = getLoc("DIALOG");
private final String LOC_DIALOG_DESCRIPTION = getLoc("DIALOG_DESCRIPTION");
@@ -70,18 +61,18 @@
public void testTodayIsHighlighted() {
String today = Integer.toString(Calendar.getInstance().get(Calendar.DAY_OF_MONTH));
String text = null;
-
+
int fromLine = 3;
if (Integer.parseInt(today) > 15) {
fromLine = 5;
}
-
+
for (int i = fromLine; i < 9; i++) {
for (int j = 1; j < 8; j++) {
- text = selenium.getText(String.format(LOC_CELL_X_Y_DATE, i, j));
+ text = selenium.getText(format(LOC_CELL_DATE_PREFORMATTED, i, j));
if (today.equals(text)) {
- text = selenium.getAttribute(String.format(LOC_CELL_X_Y, i, j) + "@class");
- assertTrue(text.contains("rich-calendar-today"), MSG_CLASS_ATTRIBUTE_TODAY);
+ assertTrue(belongsClass("rich-calendar-today", format(LOC_CELL_PREFORMATTED, i, j)),
+ "Class attribute of the cell with today's date should contain \"rich-calendar-today\".");
return;
}
}
@@ -94,8 +85,8 @@
*/
@Test
public void testLastDayIsGrey() {
- String attr = selenium.getAttribute(String.format(LOC_CELL_X_Y, 8, 7) + "@class");
- assertTrue(attr.contains("rich-calendar-boundary-dates"), MSG_CLASS_ATTRIBUTE_GREY);
+ assertTrue(belongsClass("rich-calendar-boundary-dates", format(LOC_CELL_PREFORMATTED, 8, 7)),
+ "Class attribute of the last cell should contain \"rich-calendar-boundary-dates\".");
}
/**
@@ -107,12 +98,12 @@
*/
@Test
public void testSaveNote() {
- String text = selenium.getText(String.format(LOC_CELL_X_Y_DESC, 4, 3));
- assertEquals(text, "Nothing planned", String.format(MSG_CELL_X_Y_DESC, 4, 3));
+ String text = selenium.getText(format(LOC_CELL_DESC_PREFORMATTED, 4, 3));
+ assertEquals(text, "Nothing planned", "The description in the cell (week 2, day 3).");
- assertFalse(isDisplayed(LOC_DIALOG), MSG_DIALOG_NOT_VISIBLE);
+ assertFalse(isDisplayed(LOC_DIALOG), "Dialog should not be visible.");
- selenium.click(String.format(LOC_CELL_X_Y, 4, 3));
+ selenium.click(format(LOC_CELL_PREFORMATTED, 4, 3));
// wait for JavaScript to show the dialog
Wait.until(new Condition() {
@@ -121,7 +112,7 @@
}
});
- assertTrue(isDisplayed(LOC_DIALOG), MSG_DIALOG_VISIBLE);
+ assertTrue(isDisplayed(LOC_DIALOG), "Dialog should be visible.");
selenium.type(LOC_DIALOG_DESCRIPTION, "some description");
selenium.type(LOC_DIALOG_NOTE, "note note note note note");
@@ -129,18 +120,16 @@
// wait for JavaScript to change the organizer
Wait.until(new Condition() {
-
public boolean isTrue() {
- return !"Nothing planned".equals(selenium.getText(String.format(LOC_CELL_X_Y_DESC, 4, 3)));
+ return !"Nothing planned".equals(selenium.getText(format(LOC_CELL_DESC_PREFORMATTED, 4, 3)));
}
-
});
- text = selenium.getText(String.format(LOC_CELL_X_Y_DESC, 4, 3));
- assertEquals(text, "some description", String.format(MSG_CELL_X_Y_DESC, 2, 3));
+ text = selenium.getText(format(LOC_CELL_DESC_PREFORMATTED, 4, 3));
+ assertEquals(text, "some description", "The description in the cell (week 2, day 3).");
- text = selenium.getText(String.format(LOC_CELL_X_Y_NOTE, 4, 3));
- assertEquals(text, "note note note note note", String.format(MSG_CELL_X_Y_NOTE, 2, 3));
+ text = selenium.getText(format(LOC_CELL_NOTE_PREFORMATTED, 4, 3));
+ assertEquals(text, "note note note note note", "The note in the cell (week 2, day 3).");
}
/**
@@ -151,12 +140,12 @@
*/
@Test
public void testCancelNoteCancelButton() {
- String text = selenium.getText(String.format(LOC_CELL_X_Y_DESC, 5, 3));
- assertEquals(text, "Nothing planned", String.format(MSG_CELL_X_Y_DESC, 3, 3));
+ String text = selenium.getText(format(LOC_CELL_DESC_PREFORMATTED, 5, 3));
+ assertEquals(text, "Nothing planned", "The description in the cell (week 3, day 3).");
- assertFalse(isDisplayed(LOC_DIALOG), MSG_DIALOG_NOT_VISIBLE);
+ assertFalse(isDisplayed(LOC_DIALOG), "Dialog should not be visible.");
- selenium.click(String.format(LOC_CELL_X_Y, 5, 3));
+ selenium.click(format(LOC_CELL_PREFORMATTED, 5, 3));
// wait for JavaScript to show the dialog
Wait.until(new Condition() {
@@ -165,7 +154,7 @@
}
});
- assertTrue(isDisplayed(LOC_DIALOG), MSG_DIALOG_VISIBLE);
+ assertTrue(isDisplayed(LOC_DIALOG), "Dialog should be visible.");
selenium.type(LOC_DIALOG_DESCRIPTION, "some description");
selenium.type(LOC_DIALOG_NOTE, "note note note note note");
@@ -174,11 +163,11 @@
// wait for JavaScript to finish - nothing should change
waitFor(3000);
- text = selenium.getText(String.format(LOC_CELL_X_Y_DESC, 5, 3));
- assertEquals(text, "Nothing planned", String.format(MSG_CELL_X_Y_DESC, 3, 3));
+ text = selenium.getText(format(LOC_CELL_DESC_PREFORMATTED, 5, 3));
+ assertEquals(text, "Nothing planned", "The description in the cell (week 3, day 3).");
- text = selenium.getText(String.format(LOC_CELL_X_Y_NOTE, 5, 3));
- assertEquals(text, "", String.format(MSG_CELL_X_Y_NOTE, 3, 3));
+ text = selenium.getText(format(LOC_CELL_NOTE_PREFORMATTED, 5, 3));
+ assertEquals(text, "", "The note in the cell (week 3, day 3).");
}
/**
@@ -189,12 +178,12 @@
*/
@Test
public void testCancelNoteCrossButton() {
- String text = selenium.getText(String.format(LOC_CELL_X_Y_DESC, 5, 5));
- assertEquals(text, "Nothing planned", String.format(MSG_CELL_X_Y_DESC, 3, 5));
+ String text = selenium.getText(format(LOC_CELL_DESC_PREFORMATTED, 5, 5));
+ assertEquals(text, "Nothing planned", "The description in the cell (week 3, day 5).");
- assertFalse(isDisplayed(LOC_DIALOG), MSG_DIALOG_NOT_VISIBLE);
+ assertFalse(isDisplayed(LOC_DIALOG), "Dialog should be visible.");
- selenium.click(String.format(LOC_CELL_X_Y, 5, 5));
+ selenium.click(format(LOC_CELL_PREFORMATTED, 5, 5));
// wait for JavaScript to show the dialog
Wait.until(new Condition() {
@@ -203,7 +192,7 @@
}
});
- assertTrue(isDisplayed(LOC_DIALOG), MSG_DIALOG_VISIBLE);
+ assertTrue(isDisplayed(LOC_DIALOG), "Dialog should be visible.");
selenium.type(LOC_DIALOG_DESCRIPTION, "some description");
selenium.type(LOC_DIALOG_NOTE, "note note note note note");
@@ -212,11 +201,11 @@
// wait for JavaScript to finish - nothing should change
waitFor(3000);
- text = selenium.getText(String.format(LOC_CELL_X_Y_DESC, 5, 5));
- assertEquals(text, "Nothing planned", String.format(MSG_CELL_X_Y_DESC, 3, 5));
+ text = selenium.getText(format(LOC_CELL_DESC_PREFORMATTED, 5, 5));
+ assertEquals(text, "Nothing planned", "The description in the cell (week 3, day 5).");
- text = selenium.getText(String.format(LOC_CELL_X_Y_NOTE, 5, 5));
- assertEquals(text, "", String.format(MSG_CELL_X_Y_NOTE, 3, 5));
+ text = selenium.getText(format(LOC_CELL_NOTE_PREFORMATTED, 5, 5));
+ assertEquals(text, "", "The note in the cell (week 3, day 5).");
}
/**
@@ -277,6 +266,7 @@
/**
* Loads the page containing the calendar component.
*/
+ @SuppressWarnings("unused")
@BeforeMethod
private void loadPage() {
openComponent("Calendar");
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/colorPicker/ColorPickerTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/colorPicker/ColorPickerTestCase.java 2009-09-08 18:54:35 UTC (rev 15500)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/colorPicker/ColorPickerTestCase.java 2009-09-09 07:45:43 UTC (rev 15501)
@@ -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.colorPicker;
@@ -578,6 +575,7 @@
/**
* Loads the page containing the color picker component.
*/
+ @SuppressWarnings("unused")
@BeforeMethod
private void loadPage() {
openComponent("Color Picker");
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/comboBox/ComboBoxTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/comboBox/ComboBoxTestCase.java 2009-09-08 18:54:35 UTC (rev 15500)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/comboBox/ComboBoxTestCase.java 2009-09-09 07:45:43 UTC (rev 15501)
@@ -1,29 +1,26 @@
-/**
- * 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.comboBox;
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertEqualsNoOrder;
-import static org.testng.Assert.assertTrue;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
import org.testng.annotations.BeforeMethod;
@@ -37,21 +34,39 @@
*/
public class ComboBoxTestCase extends AbstractSeleniumRichfacesTestCase {
- private final String firstComboInput = "//fieldset[1]/div/div[1]/div/div[2]/input[1]";
- private final String firstComboButton = "//fieldset[1]/div/div[1]/div/div[2]/input[3]";
- private final String firstComboConcreteSuggestion = "//body//div[@class='rich-combobox-list-scroll']/span[{0}]";
- private final String firstComboSuggestions = "//body//div[@class='rich-combobox-list-scroll']/span";
+ // locators
+ private final String LOC_FIRST_COMBO_INPUT = getLoc("FIRST_COMBO_INPUT");
+ private final String LOC_FIRST_COMBO_BUTTON = getLoc("FIRST_COMBO_BUTTON");
+ private final String LOC_FIRST_COMBO_CONCRETE_SUGGESTION = getLoc("FIRST_COMBO_CONCRETE_SUGGESTION");
+ private final String LOC_FIRST_COMBO_SUGGESTIONS = getLoc("FIRST_COMBO_SUGGESTIONS");
- private final String secondComboInput = "//fieldset[2]/div/div[1]/div/div[2]/input[1]";
- private final String secondComboButton = "//fieldset[2]/div/div[1]/div/div[2]/input[3]";
- private final String secondComboConcreteSuggestion = "//body//div[@class='rich-combobox-list-scroll']/span[{0}]";
- private final String secondComboSuggestions = "//body//div[@class='rich-combobox-list-scroll']/span";
+ private final String LOC_SECOND_COMBO_INPUT = getLoc("SECOND_COMBO_INPUT");
+ private final String LOC_SECOND_COMBO_BUTTON = getLoc("SECOND_COMBO_BUTTON");
+ private final String LOC_SECOND_COMBO_CONCRETE_SUGGESTION = getLoc("SECOND_COMBO_CONCRETE_SUGGESTION");
+ private final String LOC_SECOND_COMBO_SUGGESTIONS = getLoc("SECOND_COMBO_SUGGESTIONS");
- private final String thirdComboInput = "//fieldset[3]/div/div[1]/div/div[2]/input[1]";
- private final String thirdComboButton = "//fieldset[3]/div/div[1]/div/div[2]/input[3]";
- private final String thirdComboConcreteSuggestion = "//body//div[@class='rich-combobox-list-scroll']/span[{0}]";
- private final String thirdComboSuggestions = "//body//div[@class='rich-combobox-list-scroll']/span";
+ private final String LOC_THIRD_COMBO_INPUT = getLoc("THIRD_COMBO_INPUT");
+ private final String LOC_THIRD_COMBO_BUTTON = getLoc("THIRD_COMBO_BUTTON");
+ private final String LOC_THIRD_COMBO_CONCRETE_SUGGESTION = getLoc("THIRD_COMBO_CONCRETE_SUGGESTION");
+ private final String LOC_THIRD_COMBO_SUGGESTIONS = getLoc("THIRD_COMBO_SUGGESTIONS");
+ // messages
+ private final String MSG_INITIAL_STATE_INITIAL_VALUE_1 = getMsg("INITIAL_STATE_INITIAL_VALUE_1");
+ private final String MSG_INITIAL_STATE_INITIAL_VALUE_2 = getMsg("INITIAL_STATE_INITIAL_VALUE_2");
+ private final String MSG_INITIAL_STATE_INITIAL_VALUE_3 = getMsg("INITIAL_STATE_INITIAL_VALUE_3");
+
+ private final int MSG_SUGGESTIONS_FIRST_COMBO_COUNT_1 = Integer.parseInt(getMsg("SUGGESTIONS_FIRST_COMBO_COUNT_1"));
+ private final int MSG_SUGGESTIONS_FIRST_COMBO_COUNT_2 = Integer.parseInt(getMsg("SUGGESTIONS_FIRST_COMBO_COUNT_2"));
+ private final String MSG_SUGGESTIONS_FIRST_COMBO_INPUT = getMsg("SUGGESTIONS_FIRST_COMBO_INPUT");
+
+ private final int MSG_SUGGESTIONS_SECOND_COMBO_COUNT_1 = Integer.parseInt(getMsg("SUGGESTIONS_SECOND_COMBO_COUNT_1"));
+ private final int MSG_SUGGESTIONS_SECOND_COMBO_COUNT_2 = Integer.parseInt(getMsg("SUGGESTIONS_SECOND_COMBO_COUNT_2"));
+ private final String MSG_SUGGESTIONS_SECOND_COMBO_INPUT = getMsg("SUGGESTIONS_SECOND_COMBO_INPUT");
+
+ private final int MSG_SUGGESTIONS_THIRD_COMBO_COUNT_1 = Integer.parseInt(getMsg("SUGGESTIONS_THIRD_COMBO_COUNT_1"));
+ private final int MSG_SUGGESTIONS_THIRD_COMBO_COUNT_2 = Integer.parseInt(getMsg("SUGGESTIONS_THIRD_COMBO_COUNT_2"));
+ private final String MSG_SUGGESTIONS_THIRD_COMBO_INPUT = getMsg("SUGGESTIONS_THIRD_COMBO_INPUT");
+
/**
* Tests the initial state of the page. It checks that there are all
* necessary component and that all combo boxes contain the string
@@ -59,21 +74,21 @@
*/
@Test
public void testInitialState() {
- assertTrue(selenium.isElementPresent(firstComboInput), "First combo's input is not present.");
- assertTrue(selenium.isElementPresent(firstComboButton), "First combo's button is not present.");
- assertTrue(selenium.isElementPresent(secondComboInput), "Second combo's input is not present.");
- assertTrue(selenium.isElementPresent(secondComboInput), "Second combo's button is not present.");
- assertTrue(selenium.isElementPresent(thirdComboInput), "Third combo's input is not present.");
- assertTrue(selenium.isElementPresent(thirdComboInput), "Third combo's button is not present.");
+ assertTrue(selenium.isElementPresent(LOC_FIRST_COMBO_INPUT), "First combo's input is not present.");
+ assertTrue(selenium.isElementPresent(LOC_FIRST_COMBO_BUTTON), "First combo's button is not present.");
+ assertTrue(selenium.isElementPresent(LOC_SECOND_COMBO_INPUT), "Second combo's input is not present.");
+ assertTrue(selenium.isElementPresent(LOC_SECOND_COMBO_INPUT), "Second combo's button is not present.");
+ assertTrue(selenium.isElementPresent(LOC_THIRD_COMBO_INPUT), "Third combo's input is not present.");
+ assertTrue(selenium.isElementPresent(LOC_THIRD_COMBO_INPUT), "Third combo's button is not present.");
- String text = selenium.getValue(firstComboInput);
- assertEquals(text, "Enter some value", "Text in the first combo box.");
+ String text = selenium.getValue(LOC_FIRST_COMBO_INPUT);
+ assertEquals(text, MSG_INITIAL_STATE_INITIAL_VALUE_1, "Text in the first combo box.");
- text = selenium.getValue(secondComboInput);
- assertEquals(text, "Enter some value", "Text in the second combo box.");
+ text = selenium.getValue(LOC_SECOND_COMBO_INPUT);
+ assertEquals(text, MSG_INITIAL_STATE_INITIAL_VALUE_2, "Text in the second combo box.");
- text = selenium.getValue(thirdComboInput);
- assertEquals(text, "Enter some value", "Text in the third combo box.");
+ text = selenium.getValue(LOC_THIRD_COMBO_INPUT);
+ assertEquals(text, MSG_INITIAL_STATE_INITIAL_VALUE_3, "Text in the third combo box.");
}
/**
@@ -81,48 +96,40 @@
* count of all suggestions. Then it types "su", checks the number of
* suggestions and the content of all suggestions. In the end, it clicks on
* the third suggestion and verifies the combo box's input field.
- *
- * <ul>
- * <li><b>FIXME</b>the div containing suggestions moves out of fieldset</li>
- * <li><b>FIXME</b>"su " has to be clicked instead of "su"</li>
- * <li><b>FIXME</b>it is not possible to click on the third suggestion</li>
- * </ul>
*/
@Test
public void testSuggestionsFirstComboBox() {
- scrollIntoView(firstComboButton, true);
+ scrollIntoView(LOC_FIRST_COMBO_BUTTON, true);
- selenium.click(firstComboButton);
- waitForElement(format(firstComboConcreteSuggestion, 1));
- int count = selenium.getXpathCount(firstComboSuggestions).intValue();
- assertEquals(count, 5, "Number of suggestions after after clicking on button.");
+ selenium.click(LOC_FIRST_COMBO_BUTTON);
+ waitForElement(format(LOC_FIRST_COMBO_CONCRETE_SUGGESTION, 1));
+ int count = selenium.getXpathCount(LOC_FIRST_COMBO_SUGGESTIONS).intValue();
+ assertEquals(count, MSG_SUGGESTIONS_FIRST_COMBO_COUNT_1, "Number of suggestions after after clicking on button.");
- selenium.click(firstComboInput);
- selenium.typeKeys(firstComboInput, "su");
- // FIXME why is this necessary?
- selenium.typeKeys(firstComboInput, " ");
+ selenium.click(LOC_FIRST_COMBO_INPUT);
+ selenium.typeKeys(LOC_FIRST_COMBO_INPUT, "su");
+ selenium.typeKeys(LOC_FIRST_COMBO_INPUT, " ");
- count = selenium.getXpathCount(firstComboSuggestions).intValue();
- assertEquals(count, 5, "Number of suggestions after typing 'su'.");
+ count = selenium.getXpathCount(LOC_FIRST_COMBO_SUGGESTIONS).intValue();
+ assertEquals(count, MSG_SUGGESTIONS_FIRST_COMBO_COUNT_2, "Number of suggestions after typing 'su'.");
String[] suggestions = new String[5];
for (int i = 0; i < 5; i++) {
- suggestions[i] = selenium.getText(format(firstComboConcreteSuggestion, i + 1));
+ suggestions[i] = selenium.getText(format(LOC_FIRST_COMBO_CONCRETE_SUGGESTION, i + 1));
}
- String[] expected = new String[] { "suggestion 1", "suggestion 2", "suggestion 3", "suggestion 4",
- "suggestion 5", };
+ String[] expected = new String[] { "suggestion 1", "suggestion 2", "suggestion 3", "suggestion 4", "suggestion 5", };
assertEqualsNoOrder(suggestions, expected, "Suggestions after typing 'sa'.");
try {
- selenium.clickAt(format(firstComboConcreteSuggestion, 3), "");
+ selenium.clickAt(format(LOC_FIRST_COMBO_CONCRETE_SUGGESTION, 3), "");
} catch (Exception ex) {
- // TODO why the exception is thrown?
+ // why the exception is thrown?
}
waitFor(1000);
- String text = selenium.getValue(firstComboInput);
- assertEquals(text, "suggestion 3", "Third suggestion was chosen.");
+ String text = selenium.getValue(LOC_FIRST_COMBO_INPUT);
+ assertEquals(text, MSG_SUGGESTIONS_FIRST_COMBO_INPUT, "Third suggestion was chosen.");
}
/**
@@ -130,32 +137,26 @@
* count of all suggestions. Then it types "sa", checks the number of
* suggestions and the content of all suggestions. In the end, it clicks on
* the third suggestion and verifies the combo box's input field.
- *
- * <ul>
- * <li><b>FIXME</b>the div containing suggestions moves out of fieldset</li>
- * <li><b>FIXME</b>"sa " has to be clicked instead of "sa"</li>
- * </ul>
*/
@Test
public void testSuggestionsSecondComboBox() {
- scrollIntoView(secondComboButton, true);
+ scrollIntoView(LOC_SECOND_COMBO_BUTTON, true);
- selenium.click(secondComboButton);
- waitForElement(format(secondComboConcreteSuggestion, 1));
- int count = selenium.getXpathCount(secondComboSuggestions).intValue();
- assertEquals(count, 50, "Number of suggestions after after clicking on button.");
+ selenium.click(LOC_SECOND_COMBO_BUTTON);
+ waitForElement(format(LOC_SECOND_COMBO_CONCRETE_SUGGESTION, 1));
+ int count = selenium.getXpathCount(LOC_SECOND_COMBO_SUGGESTIONS).intValue();
+ assertEquals(count, MSG_SUGGESTIONS_SECOND_COMBO_COUNT_1, "Number of suggestions after after clicking on button.");
- selenium.click(secondComboInput);
- selenium.typeKeys(secondComboInput, "sa");
- // FIXME why is this necessary?
- selenium.typeKeys(secondComboInput, " ");
+ selenium.click(LOC_SECOND_COMBO_INPUT);
+ selenium.typeKeys(LOC_SECOND_COMBO_INPUT, "sa");
+ selenium.typeKeys(LOC_SECOND_COMBO_INPUT, " ");
- count = selenium.getXpathCount(secondComboSuggestions).intValue();
- assertEquals(count, 4, "Number of suggestions after typing 'sa'.");
+ count = selenium.getXpathCount(LOC_SECOND_COMBO_SUGGESTIONS).intValue();
+ assertEquals(count, MSG_SUGGESTIONS_SECOND_COMBO_COUNT_2, "Number of suggestions after typing 'sa'.");
String[] suggestions = new String[4];
for (int i = 0; i < 4; i++) {
- suggestions[i] = selenium.getText(format(secondComboConcreteSuggestion, i + 1));
+ suggestions[i] = selenium.getText(format(LOC_SECOND_COMBO_CONCRETE_SUGGESTION, i + 1));
}
String[] expected = new String[] { "Sacramento", "Santa Fe", "Salem", "Salt Lake City" };
@@ -163,14 +164,14 @@
assertEqualsNoOrder(suggestions, expected, "Suggestions after typing 'sa'.");
try {
- selenium.clickAt(format(secondComboConcreteSuggestion, 3), "");
+ selenium.clickAt(format(LOC_SECOND_COMBO_CONCRETE_SUGGESTION, 3), "");
} catch (Exception ex) {
- // TODO why the exception is thrown?
+ // why the exception is thrown?
}
waitFor(1000);
- String text = selenium.getValue(secondComboInput);
- assertEquals(text, "Salem", "Third suggestion was chosen.");
+ String text = selenium.getValue(LOC_SECOND_COMBO_INPUT);
+ assertEquals(text, MSG_SUGGESTIONS_SECOND_COMBO_INPUT, "Third suggestion was chosen.");
}
/**
@@ -178,31 +179,25 @@
* count of all suggestions. Then it types "sa", checks the number of
* suggestions and the content of all suggestions. In the end, it clicks on
* the third suggestion and verifies the combo box's input field.
- *
- * <ul>
- * <li><b>FIXME</b>the div containing suggestions moves out of fieldset</li>
- * <li><b>FIXME</b>"sa " has to be clicked instead of "sa"</li>
- * </ul>
*/
@Test
public void testSuggestionsThirdComboBox() {
- selenium.click(thirdComboButton);
+ selenium.click(LOC_THIRD_COMBO_BUTTON);
- waitForElement(format(thirdComboConcreteSuggestion, 1));
- int count = selenium.getXpathCount(thirdComboSuggestions).intValue();
- assertEquals(count, 50, "Number of suggestions after after clicking on button.");
+ waitForElement(format(LOC_THIRD_COMBO_CONCRETE_SUGGESTION, 1));
+ int count = selenium.getXpathCount(LOC_THIRD_COMBO_SUGGESTIONS).intValue();
+ assertEquals(count, MSG_SUGGESTIONS_THIRD_COMBO_COUNT_1, "Number of suggestions after after clicking on button.");
- selenium.click(thirdComboInput);
- selenium.typeKeys(thirdComboInput, "sa");
- // FIXME why is this necessary?
- selenium.typeKeys(thirdComboInput, " ");
+ selenium.click(LOC_THIRD_COMBO_INPUT);
+ selenium.typeKeys(LOC_THIRD_COMBO_INPUT, "sa");
+ selenium.typeKeys(LOC_THIRD_COMBO_INPUT, " ");
- count = selenium.getXpathCount(thirdComboSuggestions).intValue();
- assertEquals(count, 4, "Number of suggestions after typing 'sa'.");
+ count = selenium.getXpathCount(LOC_THIRD_COMBO_SUGGESTIONS).intValue();
+ assertEquals(count, MSG_SUGGESTIONS_THIRD_COMBO_COUNT_2, "Number of suggestions after typing 'sa'.");
String[] suggestions = new String[4];
for (int i = 0; i < 4; i++) {
- suggestions[i] = selenium.getText(format(thirdComboConcreteSuggestion, i + 1));
+ suggestions[i] = selenium.getText(format(LOC_THIRD_COMBO_CONCRETE_SUGGESTION, i + 1));
}
String[] expected = new String[] { "Sacramento", "Santa Fe", "Salem", "Salt Lake City" };
@@ -210,55 +205,72 @@
assertEqualsNoOrder(suggestions, expected, "Suggestions after typing 'sa'.");
try {
- selenium.clickAt(format(thirdComboConcreteSuggestion, 4), "");
+ selenium.clickAt(format(LOC_THIRD_COMBO_CONCRETE_SUGGESTION, 4), "");
} catch (Exception ex) {
- // TODO why the exception is thrown?
+ // why the exception is thrown?
}
waitFor(1000);
- String text = selenium.getValue(thirdComboInput);
- assertEquals(text, "Salt Lake City", "Third suggestion was chosen.");
+ String text = selenium.getValue(LOC_THIRD_COMBO_INPUT);
+ assertEquals(text, MSG_SUGGESTIONS_THIRD_COMBO_INPUT, "Third suggestion was chosen.");
}
/**
- * 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".
+ * Tests the "View Source" in the first example. It checks that the source code is not visible,
+ * clicks on the link, and checks 8 lines of source code.
*/
@Test
public void testFirstComboBoxSource() {
- // index has to be 2 because the combo box is in a div element
- abstractTestSource(1, 2, "<", "ui:composition");
+ String[] strings = new String[] { "<ui:composition xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<rich:comboBox defaultLabel=\"Enter some value\">",
+ "<f:selectItem itemValue=\"suggestion 1\"/>",
+ "<f:selectItem itemValue=\"suggestion 2\"/>",
+ "<f:selectItem itemValue=\"suggestion 3\"/>",
+ "<f:selectItem itemValue=\"suggestion 4\"/>",
+ "<f:selectItem itemValue=\"suggestion 5\"/>",
+ "</rich:comboBox>",
+ };
+
+ 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".
+ * Tests the "View Source" in the second example. It checks that the source code is not visible,
+ * clicks on the link, and checks 5 lines of source code.
*/
@Test
public void testSecondComboBoxSource() {
- // index has to be 2 because the combo box is in a div element
- abstractTestSource(2, 2, "<", "ui:composition");
+ String[] strings = new String[] { "<ui:composition xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<rich:comboBox selectFirstOnUpdate=\"false\"",
+ "defaultLabel=\"Enter some value\">",
+ "<f:selectItems value=\"#{capitalsBean.capitalsOptions}\" />",
+ "</rich:comboBox>",
+ };
+
+ abstractTestSource(2, "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".
+ * Tests the "View Source" in the third example. It checks that the source code is not visible,
+ * clicks on the link, and checks 3 lines of source code.
*/
@Test
public void testThirdComboBoxSource() {
- // index has to be 2 because the combo box is in a div element
- abstractTestSource(3, 2, "<", "ui:composition");
+ String[] strings = new String[] { "<ui:composition xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<rich:comboBox suggestionValues=\"#{capitalsBean.capitalsNames}\"",
+ "directInputSuggestions=\"true\" defaultLabel=\"Enter some value\" />",
+ };
+
+ abstractTestSource(3, "View Source", strings);
}
-
+
/**
* Loads the page containing the calendar component.
*/
+ @SuppressWarnings("unused")
@BeforeMethod
private void loadPage() {
- super.loadPage("richInputs", 3, "The component provides editable combobox element on the page.");
+ openComponent("Combo Box");
}
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/calendar/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/calendar/locators.properties 2009-09-08 18:54:35 UTC (rev 15500)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/calendar/locators.properties 2009-09-09 07:45:43 UTC (rev 15501)
@@ -23,10 +23,10 @@
# second tab
FIELDSET=//fieldset[1]/legend
-CELL_X_Y=//fieldset[1]/div/form/table/tbody/tr[%d]/td[%d]
-CELL_X_Y_DATE=//fieldset[1]/div/form/table/tbody/tr[%d]/td[%d]/div/div/table/tbody/tr[1]
-CELL_X_Y_DESC=//fieldset[1]/div/form/table/tbody/tr[%d]/td[%d]/div/div/table/tbody/tr[2]
-CELL_X_Y_NOTE=//fieldset[1]/div/form/table/tbody/tr[%d]/td[%d]/div/div/table/tbody/tr[3]
+CELL_PREFORMATTED=//fieldset[1]/div/form/table/tbody/tr[{0}]/td[{1}]
+CELL_DATE_PREFORMATTED=//fieldset[1]/div/form/table/tbody/tr[{0}]/td[{1}]/div/div/table/tbody/tr[1]
+CELL_DESC_PREFORMATTED=//fieldset[1]/div/form/table/tbody/tr[{0}]/td[{1}]/div/div/table/tbody/tr[2]
+CELL_NOTE_PREFORMATTED=//fieldset[1]/div/form/table/tbody/tr[{0}]/td[{1}]/div/div/table/tbody/tr[3]
DIALOG=//div[@id='panelContainer']
DIALOG_DESCRIPTION=//table[@id='panelContentTable']/tbody/tr[2]/td/form/table/tbody/tr[1]/td[2]/input
@@ -37,6 +37,6 @@
# third tab
STYLING_FIELDSET=//fieldset[1]/legend
-STYLING_CELL_X_Y=//fieldset[1]/div/table/tbody/tr[%d]/td[%d]
+STYLING_CELL_PREFORMATTED=//fieldset[1]/div/table/tbody/tr[{0}]/td[{1}]
STYLING_CALENDAR_BUTTON=//fieldset[1]/div/span/img
STYLING_RIGHT_ARROW=//fieldset[1]/div/table/tbody/tr[1]/td[1]/table/tbody/tr[1]/td[4]
\ No newline at end of file
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/calendar/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/calendar/messages.properties 2009-09-08 18:54:35 UTC (rev 15500)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/calendar/messages.properties 2009-09-09 07:45:43 UTC (rev 15501)
@@ -1,13 +0,0 @@
-# second tab
-COMPONENT_DESCRIPTION=This simple example shows the way of calendarDataModel usage for organizer creation.
-
-CLASS_ATTRIBUTE_TODAY=Class attribute of the cell with today's date should contain "rich-calendar-today".
-CLASS_ATTRIBUTE_GREY=Class attribute of the last cell should contain "rich-calendar-boundary-dates".
-DIALOG_VISIBLE=Dialog should be visible.
-DIALOG_NOT_VISIBLE=Dialog should not be visible.
-CELL_X_Y_NOTE=The note in the cell (week %d, day %d).
-CELL_X_Y_DESC=The description in the cell (week %d, day %d).
-
-# third tab
-COMPONENT_DESCRIPTION_3=This simple example shows the way of dates disablement and styling without dataModel usage.
-EVERY_THIRD_CELL=Every third cell should be either disabled (boundary dates) or styled (dates from current month).
\ No newline at end of file
Added: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/comboBox/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/comboBox/locators.properties (rev 0)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/comboBox/locators.properties 2009-09-09 07:45:43 UTC (rev 15501)
@@ -0,0 +1,14 @@
+FIRST_COMBO_INPUT=//fieldset[1]/div/div[1]/div/div[2]/input[1]
+FIRST_COMBO_BUTTON=//fieldset[1]/div/div[1]/div/div[2]/input[3]
+FIRST_COMBO_CONCRETE_SUGGESTION=//body//div[@class='rich-combobox-list-scroll']/span[{0}]
+FIRST_COMBO_SUGGESTIONS=//body//div[@class='rich-combobox-list-scroll']/span
+
+SECOND_COMBO_INPUT=//fieldset[2]/div/div[1]/div/div[2]/input[1]
+SECOND_COMBO_BUTTON=//fieldset[2]/div/div[1]/div/div[2]/input[3]
+SECOND_COMBO_CONCRETE_SUGGESTION=//body//div[@class='rich-combobox-list-scroll']/span[{0}]
+SECOND_COMBO_SUGGESTIONS=//body//div[@class='rich-combobox-list-scroll']/span
+
+THIRD_COMBO_INPUT=//fieldset[3]/div/div[1]/div/div[2]/input[1]
+THIRD_COMBO_BUTTON=//fieldset[3]/div/div[1]/div/div[2]/input[3]
+THIRD_COMBO_CONCRETE_SUGGESTION=//body//div[@class='rich-combobox-list-scroll']/span[{0}]
+THIRD_COMBO_SUGGESTIONS=//body//div[@class='rich-combobox-list-scroll']/span
\ 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/comboBox/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/comboBox/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/comboBox/messages.properties (rev 0)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/comboBox/messages.properties 2009-09-09 07:45:43 UTC (rev 15501)
@@ -0,0 +1,15 @@
+INITIAL_STATE_INITIAL_VALUE_1=Enter some value
+INITIAL_STATE_INITIAL_VALUE_2=Enter some value
+INITIAL_STATE_INITIAL_VALUE_3=Enter some value
+
+SUGGESTIONS_FIRST_COMBO_COUNT_1=5
+SUGGESTIONS_FIRST_COMBO_COUNT_2=5
+SUGGESTIONS_FIRST_COMBO_INPUT=suggestion 3
+
+SUGGESTIONS_SECOND_COMBO_COUNT_1=50
+SUGGESTIONS_SECOND_COMBO_COUNT_2=4
+SUGGESTIONS_SECOND_COMBO_INPUT=Salem
+
+SUGGESTIONS_THIRD_COMBO_COUNT_1=50
+SUGGESTIONS_THIRD_COMBO_COUNT_2=4
+SUGGESTIONS_THIRD_COMBO_INPUT=Salt Lake City
\ 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/comboBox/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 3 months
JBoss Rich Faces SVN: r15500 - branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/testng/hudson.
by richfaces-svn-commits@lists.jboss.org
Author: prabhat.jha(a)jboss.com
Date: 2009-09-08 14:54:35 -0400 (Tue, 08 Sep 2009)
New Revision: 15500
Added:
branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/testng/hudson/testng-def-def-none-parser.xml
Log:
temporarily disabling all parser tests until we have tests passing with one set
Added: branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/testng/hudson/testng-def-def-none-parser.xml
===================================================================
--- branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/testng/hudson/testng-def-def-none-parser.xml (rev 0)
+++ branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/testng/hudson/testng-def-def-none-parser.xml 2009-09-08 18:54:35 UTC (rev 15500)
@@ -0,0 +1,19 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="seleniumTestAANe">
+ <test name="default_default_none">
+ <parameter name="browser" value="*firefox" />
+ <parameter name="loadStyleStrategy" value="DEFAULT" />
+ <parameter name="loadScriptStrategy" value="DEFAULT" />
+ <parameter name="filterPrefix" value="/faces/NONE/" />
+
+ <groups>
+ <run>
+ <exclude name="failures" />
+ </run>
+ </groups>
+
+ <packages>
+ <package name="org.richfaces.testng" />
+ </packages>
+ </test>
+</suite>
15 years, 3 months
JBoss Rich Faces SVN: r15499 - branches/community/3.3.X/test-applications/seleniumTest/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: prabhat.jha(a)jboss.com
Date: 2009-09-08 14:54:19 -0400 (Tue, 08 Sep 2009)
New Revision: 15499
Modified:
branches/community/3.3.X/test-applications/seleniumTest/richfaces/pom.xml
Log:
temporarily disabling all parser tests until we have tests passing with one set
Modified: branches/community/3.3.X/test-applications/seleniumTest/richfaces/pom.xml
===================================================================
--- branches/community/3.3.X/test-applications/seleniumTest/richfaces/pom.xml 2009-09-08 17:44:21 UTC (rev 15498)
+++ branches/community/3.3.X/test-applications/seleniumTest/richfaces/pom.xml 2009-09-08 18:54:19 UTC (rev 15499)
@@ -109,12 +109,17 @@
<!-- Skip the normal tests, we'll run them in the integration-test phase -->
<skip>true</skip>
<suiteXmlFiles>
+ <suiteXmlFile>
+ src/test/testng/hudson/testng-def-def-none-parser.xml
+ </suiteXmlFile>
+ <!--
<suiteXmlFile>
src/test/testng/hudson/testng-failures.xml
</suiteXmlFile>
<suiteXmlFile>
src/test/testng/hudson/testng.xml
</suiteXmlFile>
+ -->
</suiteXmlFiles>
<properties>
<property>
15 years, 3 months
JBoss Rich Faces SVN: r15498 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-09-08 13:44:21 -0400 (Tue, 08 Sep 2009)
New Revision: 15498
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/a4j_form.xml
Log:
https://jira.jboss.org/jira/browse/RF-7275 - a4j:form section restructuring
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/a4j_form.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/a4j_form.xml 2009-09-08 16:02:37 UTC (rev 15497)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/a4j_form.xml 2009-09-08 17:44:21 UTC (rev 15498)
@@ -1,140 +1,214 @@
<section role="NotInToc" id="a4j_form">
- <title>
- <
- a4j:form
- >
- <emphasis role="since">
- <superscript> available since <emphasis role="version">3.0.0</emphasis>
- </superscript>
- </emphasis>
- </title>
- <section>
- <sectioninfo>
- <keywordset>
- <keyword>a4j:form</keyword>
- <keyword>component</keyword>
- </keywordset>
- </sectioninfo>
- <title>Description</title>
+ <title>
+ <
+ a4j:form
+ >
+ <emphasis role="since">
+ <superscript>available since
+ <emphasis role="version">3.0.0</emphasis>
+ </superscript>
+ </emphasis>
+ </title>
+ <section>
+ <sectioninfo>
+ <keywordset>
+ <keyword>a4j:form</keyword>
+ <keyword>component</keyword>
+ </keywordset>
+ </sectioninfo>
+ <title>Description</title>
<para>
- The <emphasis role="bold">
- <property><a4j:form></property>
- </emphasis> component is very similar to JSF <emphasis role="bold">
- <property><h:form></property>
- </emphasis> the only difference is in generation of links inside and possibility of default Ajax submission.
+ The
+ <emphasis role="bold">
+ <property><a4j:form></property>
+ </emphasis>
+ component enhances functionality of the standard JSF
+ <emphasis role="bold">
+ <property><h:form></property>
+ </emphasis>
+ component with possibility of default Ajax submission
+ and fixes the problem with
+ <emphasis role="bold">
+ <property><h:commandLink></property>
+ </emphasis>
+ generation inside the form.
</para>
- </section>
- <section>
- <title>Details of Usage</title>
- <para>
- The difference with the original component is that all hidden fields
- required for command links are always rendered and it doesn't depend
- on links rendering on the initial page. It solves the problem with
- invalid links that weren't rendered on a page immediately, but after
- some Ajax request.</para>
- <para>Beginning with release 1.0.5 additional attributes that make this form
- variant universal have appeared. </para>
- <para> If <emphasis>
- <property>"ajaxSubmit"</property>
- </emphasis> attribute is true, it becomes possible to set Ajax
- submission way for any components inside with the help of the javascript
- <code>A4J.AJAX.Submit(...)</code>call. In this case, the <emphasis>
- <property>"reRender"</property>
- </emphasis> attribute contains a list of Ids of components defined for
- re-rendering. If you have <emphasis role="bold">
- <property><h:commandButton></property>
- </emphasis> or <emphasis role="bold">
- <property><h:commandLink></property>
- </emphasis> inside the form, they work as <emphasis role="bold">
- <property><a4j:commandButton></property>
- </emphasis>. </para>
- <para>
- <emphasis role="bold">Example:</emphasis>
- </para>
- <programlisting role="XML"><![CDATA[<a4j:form id="helloForm" ajaxSubmit="true" reRender="table">
- ...
- <t:dataTable id="table"... >
- ...
- </t:dataTable>
- ...
- <t:datascroller for="table"... >
- ...
- </t:datascroller>
- ...
+ </section>
+ <section>
+ <title>Details of Usage</title>
+ <para>
+ Along with
+ <emphasis role="bold">
+ <property>a4j:htmlCommandLink</property>
+ </emphasis>
+ ,
+ <emphasis role="bold">
+ <property><a4j:form></property>
+ </emphasis>
+ component fixes the problem of
+ <emphasis role="bold">
+ <property><h:commandLink></property>
+ </emphasis>
+ component that cannot be re-rendered
+ without re-rendering the whole form it belongs to. For the further details see the
+ <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/form.jsf?c=form">Ajax Form Usage</ulink>
+ page at RichFaces Livedemo.
+ </para>
+
+ <para>
+ The
+ <emphasis role="bold">
+ <property><a4j:form></property>
+ </emphasis>
+ component adds extra functionality to non-Ajax action/command components: submission is performed
+ via Ajax when
+ <emphasis>
+ <property>"ajaxSubmit"</property>
+ </emphasis>
+ attribute set to "true".
+ </para>
+ <para>
+ If the
+ <emphasis role="bold">
+ <property><a4j:form></property>
+ </emphasis>
+ component
+ works in an Ajax mode, the standard Ajax attributes such as
+ <emphasis>
+ <property>"reRender"</property>
+ </emphasis>
+ ,
+ <emphasis>
+ <property>"limitToList"</property>
+ </emphasis>
+ ,
+ <emphasis>
+ <property>"requestDelay"</property>
+ </emphasis>
+ , etc. can be used.
+ </para>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML"><![CDATA[...
+<a4j:form ajaxSubmit="true" reRender="name">
+ <h:panelGrid>
+ <h:commandButton value="Set Local Name to John (Ajax)" action="#{userBean.nameItJohn}" />
+ <h:outputText id="name" value="Name:#{userBean.name}" />
+ </h:panelGrid>
</a4j:form>
-]]></programlisting>
- <para>
- This example shows that in order to make <emphasis role="bold">
- <property><t:datascroller></property>
- </emphasis> submissions to be Ajax ones it's required only to place this <emphasis role="bold">
- <property><t:datascroller></property>
- </emphasis> into <emphasis role="bold">
- <property><a4j:form></property>
- </emphasis>.
- In the other case it is necessary to redefine renders for its child links elements that are defined as <emphasis role="bold">
- <property><h:commandLink></property>
- </emphasis> and can't be made Ajax ones with using e.g. <emphasis role="bold">
- <property><a4j:support></property>
- </emphasis>.
- </para>
- <para>
- With the help of <emphasis>
- <property>"limitToList"</property>
- </emphasis> attribute you can limit areas, which are updated after the responses.
- If <emphasis>
- <property>"limitToList"</property>
- </emphasis> is true, only the reRender attribute is taken in account.
- Therefore, if you use blocks of text wrapped with <emphasis role="bold">
- <property><a4j:outputPanel></property>
- </emphasis> and <code>ajaxRendered= "true"</code>, blocks of text are ignored.
- </para>
- <para>
- Information about the <emphasis>
- <property>"process"</property>
- </emphasis> attribute usage you can find in the "<link linkend="process">Decide what to process</link>" guide section.
- </para>
- </section>
- <section>
- <title>Reference Data</title>
- <para>
- <ulink url="&tlddoc;a4j/form.html">Table of
- <a4j:form>
- attributes</ulink>.
- </para>
- <table>
- <title>Component Identification Parameters </title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>Name</entry>
- <entry>Value</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>component-type</entry>
- <entry>org.ajax4jsf.Form</entry>
- </row>
- <row>
- <entry>component-family</entry>
- <entry>javax.faces.Form</entry>
- </row>
- <row>
- <entry>component-class</entry>
- <entry>org.ajax4jsf.component.html.AjaxForm</entry>
- </row>
- <row>
- <entry>renderer-type</entry>
- <entry>org.ajax4jsf.FormRenderer</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
- <section>
- <title>Relevant Resources Links</title>
- <para>
- Visit <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/form.jsf?c=form">AjaxForm</ulink> at RichFaces Livedemo for examples of component usage and their sources.
- a</para>
- </section>
+...]]></programlisting>
+ <para>
+ Here is a managed bean:
+ </para>
+ <programlisting role="JAVA"><![CDATA[...
+public class UserBean {
+ private String name="";
+
+ public String nameItJohn() {
+ setName("John");
+ return null;
+ }
+ public String getName() {
+ return this.name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+}
+...]]></programlisting>
+ <para>
+ In the example above the
+ <code>ajaxSubmit="true"</code>,
+ so all standard action components on this form become ajaxable.
+ The
+ <emphasis>
+ <property>"reRender"</property>
+ </emphasis>
+ attribute contains an Id of component for
+ re-rendering after an Ajax response.
+ </para>
+ <tip>
+ <title>Tip:</title>
+ <para>
+ If you have
+ <emphasis role="bold">
+ <property><h:commandButton></property>
+ </emphasis>
+ or
+ <emphasis role="bold">
+ <property><h:commandLink></property>
+ </emphasis>
+ inside a form, they work as
+ <emphasis role="bold">
+ <property><a4j:commandButton></property>
+ </emphasis>
+ .
+ </para>
+ </tip>
+ <note>
+ <title>Note:</title>
+ <para>
+ You should not use
+ <emphasis role="bold">
+ <property><a4j:form></property>
+ </emphasis>
+ component with
+ <code>ajaxSubmit="true"</code>
+ if it contains other Ajax command components.
+ Also, due to the security reason, file upload form element cannot be convertible to the be ajaxable.
+ </para>
+ </note>
+ </section>
+ <section>
+ <title>Reference Data</title>
+ <para>
+ <ulink url="&tlddoc;a4j/form.html">Table of
+ <a4j:form>
+ attributes</ulink>.
+ </para>
+ <table>
+ <title>Component Identification Parameters</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Name</entry>
+ <entry>Value</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>component-type</entry>
+ <entry>org.ajax4jsf.Form</entry>
+ </row>
+ <row>
+ <entry>component-family</entry>
+ <entry>javax.faces.Form</entry>
+ </row>
+ <row>
+ <entry>component-class</entry>
+ <entry>org.ajax4jsf.component.html.AjaxForm</entry>
+ </row>
+ <row>
+ <entry>renderer-type</entry>
+ <entry>org.ajax4jsf.FormRenderer</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+ <section>
+ <title>Relevant Resources Links</title>
+ <para>
+ Visit
+ <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/form.jsf?c=form">Ajax Form</ulink>
+ page
+ at RichFaces Livedemo for examples of component usage and their sources.
+ </para>
+ <para>
+ For additional information about attributes of this component read<ulink
+ url="http://livedemo.exadel.com/richfaces-demo/richfaces/ajaxAttributes.jsf?c=...">'Ajax
+ Attribute' section</ulink>.
+ </para>
+ </section>
</section>
\ No newline at end of file
15 years, 3 months
JBoss Rich Faces SVN: r15496 - branches/community/3.3.X/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: ochikvina
Date: 2009-09-08 10:58:17 -0400 (Tue, 08 Sep 2009)
New Revision: 15496
Removed:
branches/community/3.3.X/docs/userguide/en/src/main/resources/images/fileUpload_cn.png
branches/community/3.3.X/docs/userguide/en/src/main/resources/images/fileUpload_cn2.png
branches/community/3.3.X/docs/userguide/en/src/main/resources/images/fileUpload_oc.png
branches/community/3.3.X/docs/userguide/en/src/main/resources/images/fileUpload_pc.png
Log:
https://jira.jboss.org/jira/browse/RF-7803 - deleting unnecessary images;
Deleted: branches/community/3.3.X/docs/userguide/en/src/main/resources/images/fileUpload_cn.png
===================================================================
(Binary files differ)
Deleted: branches/community/3.3.X/docs/userguide/en/src/main/resources/images/fileUpload_cn2.png
===================================================================
(Binary files differ)
Deleted: branches/community/3.3.X/docs/userguide/en/src/main/resources/images/fileUpload_oc.png
===================================================================
(Binary files differ)
Deleted: branches/community/3.3.X/docs/userguide/en/src/main/resources/images/fileUpload_pc.png
===================================================================
(Binary files differ)
15 years, 3 months
JBoss Rich Faces SVN: r15495 - in branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test: java/org/jboss/richfaces/integrationTest/spinner and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2009-09-08 10:54:18 -0400 (Tue, 08 Sep 2009)
New Revision: 15495
Added:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/messages.properties
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/simpleTogglePanel/SimpleTogglePanelTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spinner/SpinnerTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tabPanel/TabPanelTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/messages.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/messages.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/locators.properties
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/messages.properties
Log:
* SpinnerTestCase, SimpleTogglePanelTestCase, SuggestionBoxTestCase and TabPanelTestCase refactored
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/simpleTogglePanel/SimpleTogglePanelTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/simpleTogglePanel/SimpleTogglePanelTestCase.java 2009-09-08 14:43:30 UTC (rev 15494)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/simpleTogglePanel/SimpleTogglePanelTestCase.java 2009-09-08 14:54:18 UTC (rev 15495)
@@ -1,3 +1,21 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
package org.jboss.richfaces.integrationTest.simpleTogglePanel;
import static org.testng.Assert.assertFalse;
@@ -13,176 +31,158 @@
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
-public class SimpleTogglePanelTestCase extends
- AbstractSeleniumRichfacesTestCase {
+public class SimpleTogglePanelTestCase extends AbstractSeleniumRichfacesTestCase {
- // messages
- private final String MSG_COMPONENT_DESCRIPTION = getMess("COMPONENT_DESCRIPTION");
- private final String MSG_PANEL_HEADER = getMess("PANEL_HEADER");
- private final String MSG_LEFT_ARROWS_SHOULD_BE_VISIBLE = getMess("LEFT_ARROWS_SHOULD_BE_VISIBLE");
- private final String MSG_LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE = getMess("LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE");
- private final String MSG_RIGHT_ARROWS_SHOULD_BE_VISIBLE = getMess("RIGHT_ARROWS_SHOULD_BE_VISIBLE");
- private final String MSG_RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE = getMess("RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE");
- private final String MSG_BODY_SHOULD_BE_VISIBLE = getMess("BODY_SHOULD_BE_VISIBLE");
- private final String MSG_BODY_SHOULD_NOT_BE_VISIBLE = getMess("BODY_SHOULD_NOT_BE_VISIBLE");
+ // messages
+ private final String MSG_PANEL_HEADER = getMsg("PANEL_HEADER");
+ private final String MSG_LEFT_ARROWS_SHOULD_BE_VISIBLE = getMsg("LEFT_ARROWS_SHOULD_BE_VISIBLE");
+ private final String MSG_LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE = getMsg("LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE");
+ private final String MSG_RIGHT_ARROWS_SHOULD_BE_VISIBLE = getMsg("RIGHT_ARROWS_SHOULD_BE_VISIBLE");
+ private final String MSG_RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE = getMsg("RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE");
+ private final String MSG_BODY_SHOULD_BE_VISIBLE = getMsg("BODY_SHOULD_BE_VISIBLE");
+ private final String MSG_BODY_SHOULD_NOT_BE_VISIBLE = getMsg("BODY_SHOULD_NOT_BE_VISIBLE");
- // locators
- private final String LOC_EXAMPLE_1_HEADER = getLoc("EXAMPLE_1_HEADER");
- private final String LOC_EXAMPLE_2_HEADER = getLoc("EXAMPLE_2_HEADER");
- private final String LOC_FIRST_EXAMPLE_HEADER = getLoc("FIRST_EXAMPLE_HEADER");
- private final String LOC_FIRST_EXAMPLE_ARROWS_LEFT = formatLoc("FIRST_EXAMPLE_ARROWS_LEFT_RELATIVE_TO_HEADER", LOC_FIRST_EXAMPLE_HEADER);
- private final String LOC_FIRST_EXAMPLE_ARROWS_RIGHT = formatLoc("FIRST_EXAMPLE_ARROWS_RIGHT_RELATIVE_TO_HEADER", LOC_FIRST_EXAMPLE_HEADER);
- private final String LOC_FIRST_EXAMPLE_BODY = getLoc("FIRST_EXAMPLE_BODY");
- private final String LOC_SECOND_EXAMPLE_N_HEADER = getLoc("SECOND_EXAMPLE_N_HEADER");
- private final String LOC_SECOND_EXAMPLE_N_ARROWS_LEFT = formatLoc("SECOND_EXAMPLE_N_ARROWS_LEFT_RELATIVE_TO_HEADER", LOC_SECOND_EXAMPLE_N_HEADER);
- private final String LOC_SECOND_EXAMPLE_N_ARROWS_RIGHT = formatLoc("SECOND_EXAMPLE_N_ARROWS_RIGHT_RELATIVE_TO_HEADER", LOC_SECOND_EXAMPLE_N_HEADER);
- private final String LOC_SECOND_EXAMPLE_N_BODY = getLoc("SECOND_EXAMPLE_N_BODY");
+ // locators
+ private final String LOC_EXAMPLE_1_HEADER = getLoc("EXAMPLE_1_HEADER");
+ private final String LOC_EXAMPLE_2_HEADER = getLoc("EXAMPLE_2_HEADER");
+ private final String LOC_FIRST_EXAMPLE_HEADER = getLoc("FIRST_EXAMPLE_HEADER");
+ private final String LOC_FIRST_EXAMPLE_ARROWS_LEFT = getLoc("FIRST_EXAMPLE_ARROWS_LEFT");
+ private final String LOC_FIRST_EXAMPLE_ARROWS_RIGHT = getLoc("FIRST_EXAMPLE_ARROWS_RIGHT");
+ private final String LOC_FIRST_EXAMPLE_BODY = getLoc("FIRST_EXAMPLE_BODY");
+ private final String LOC_SECOND_EXAMPLE_N_HEADER = getLoc("SECOND_EXAMPLE_N_HEADER");
+ private final String LOC_SECOND_EXAMPLE_N_ARROWS_LEFT = getLoc("SECOND_EXAMPLE_N_ARROWS_LEFT");
+ private final String LOC_SECOND_EXAMPLE_N_ARROWS_RIGHT = getLoc("SECOND_EXAMPLE_N_ARROWS_RIGHT");
+ private final String LOC_SECOND_EXAMPLE_N_BODY = getLoc("SECOND_EXAMPLE_N_BODY");
- /**
- * Tests the first example. It verifies header's text and checks that there
- * are right arrows displayed in the right side. Then it checks that the
- * panel's content is displayed and clicks header to toggle panel. Then it
- * checks again arrows and verifies that the content is hidden.
- */
- @Test
- public void testFirstExample() {
- scrollIntoView(LOC_EXAMPLE_1_HEADER, true);
- String header = "Add AJAX capability to existing JSF applications";
+ /**
+ * Tests the first example. It verifies header's text and checks that there
+ * are right arrows displayed in the right side. Then it checks that the
+ * panel's content is displayed and clicks header to toggle panel. Then it
+ * checks again arrows and verifies that the content is hidden.
+ */
+ @Test
+ public void testFirstExample() {
+ scrollIntoView(LOC_EXAMPLE_1_HEADER, true);
+ String header = "Add AJAX capability to existing JSF applications";
- String text = selenium.getText(LOC_FIRST_EXAMPLE_HEADER);
- assertTrue(text.contains(header), String.format(MSG_PANEL_HEADER,
- header));
+ String text = selenium.getText(LOC_FIRST_EXAMPLE_HEADER);
+ assertTrue(text.contains(header), format(MSG_PANEL_HEADER, header));
- assertTrue(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_LEFT),
- MSG_LEFT_ARROWS_SHOULD_BE_VISIBLE);
- assertFalse(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_RIGHT),
- MSG_RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE);
- assertTrue(isDisplayed(LOC_FIRST_EXAMPLE_BODY),
- MSG_BODY_SHOULD_BE_VISIBLE);
+ assertTrue(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_LEFT), MSG_LEFT_ARROWS_SHOULD_BE_VISIBLE);
+ assertFalse(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_RIGHT), MSG_RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE);
+ assertTrue(isDisplayed(LOC_FIRST_EXAMPLE_BODY), MSG_BODY_SHOULD_BE_VISIBLE);
- selenium.click(LOC_FIRST_EXAMPLE_HEADER);
+ selenium.click(LOC_FIRST_EXAMPLE_HEADER);
- assertFalse(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_LEFT),
- MSG_LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE);
- assertTrue(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_RIGHT),
- MSG_RIGHT_ARROWS_SHOULD_BE_VISIBLE);
- assertFalse(isDisplayed(LOC_FIRST_EXAMPLE_BODY),
- MSG_BODY_SHOULD_NOT_BE_VISIBLE);
- }
+ assertFalse(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_LEFT), MSG_LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE);
+ assertTrue(isDisplayed(LOC_FIRST_EXAMPLE_ARROWS_RIGHT), MSG_RIGHT_ARROWS_SHOULD_BE_VISIBLE);
+ assertFalse(isDisplayed(LOC_FIRST_EXAMPLE_BODY), MSG_BODY_SHOULD_NOT_BE_VISIBLE);
+ }
- /**
- * Tests the second example -- server switch type. It verifies header's text
- * and checks that there are right arrows displayed in the right side. Then
- * it checks that the panel's content is displayed and clicks header to
- * toggle panel. Then it checks again arrows and verifies that the content
- * is hidden.
- */
- @Test
- public void testSecondExampleServerSwitch() {
- abstractTestPanelInSecondExample(1, "Server Switch Type");
- }
+ /**
+ * Tests the second example -- server switch type. It verifies header's text
+ * and checks that there are right arrows displayed in the right side. Then
+ * it checks that the panel's content is displayed and clicks header to
+ * toggle panel. Then it checks again arrows and verifies that the content
+ * is hidden.
+ */
+ @Test
+ public void testSecondExampleServerSwitch() {
+ abstractTestPanelInSecondExample(1, "Server Switch Type");
+ }
- /**
- * Tests the second example -- ajax switch type. It verifies header's text
- * and checks that there are right arrows displayed in the right side. Then
- * it checks that the panel's content is displayed and clicks header to
- * toggle panel. Then it checks again arrows and verifies that the content
- * is hidden.
- */
- @Test
- public void testSecondExampleAjaxSwitch() {
- abstractTestPanelInSecondExample(2, "Ajax Switch Type");
- }
+ /**
+ * Tests the second example -- ajax switch type. It verifies header's text
+ * and checks that there are right arrows displayed in the right side. Then
+ * it checks that the panel's content is displayed and clicks header to
+ * toggle panel. Then it checks again arrows and verifies that the content
+ * is hidden.
+ */
+ @Test
+ public void testSecondExampleAjaxSwitch() {
+ abstractTestPanelInSecondExample(2, "Ajax Switch Type");
+ }
- /**
- * Tests the second example -- client switch type. It verifies header's text
- * and checks that there are right arrows displayed in the right side. Then
- * it checks that the panel's content is displayed and clicks header to
- * toggle panel. Then it checks again arrows and verifies that the content
- * is hidden.
- */
- @Test
- public void testSecondExampleClientSwitch() {
- abstractTestPanelInSecondExample(3, "Client Switch Type");
- }
+ /**
+ * Tests the second example -- client switch type. It verifies header's text
+ * and checks that there are right arrows displayed in the right side. Then
+ * it checks that the panel's content is displayed and clicks header to
+ * toggle panel. Then it checks again arrows and verifies that the content
+ * is hidden.
+ */
+ @Test
+ public void testSecondExampleClientSwitch() {
+ abstractTestPanelInSecondExample(3, "Client Switch Type");
+ }
- /**
- * Tests the "View Source" in the first example. It checks that the source
- * code is not visible, clicks on the link, and checks 5 lines of source
- * code.
- */
- @Test
- public void testFirstExampleSource() {
- String[] strings = new String[] {
- "<ui:composition xmlns=\"http://www.w3.org/1999/xhtml\"",
- "<rich:simpleTogglePanel switchType=\"client\" label=\"Add AJAX capability to existing JSF applications\">",
- "The framework is implemented by using a component library. The library",
- "</rich:simpleTogglePanel>", "</ui:composition>", };
+ /**
+ * Tests the "View Source" in the first example. It checks that the source
+ * code is not visible, clicks on the link, and checks 5 lines of source
+ * code.
+ */
+ @Test
+ public void testFirstExampleSource() {
+ String[] strings = new String[] {
+ "<ui:composition xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<rich:simpleTogglePanel switchType=\"client\" label=\"Add AJAX capability to existing JSF applications\">",
+ "The framework is implemented by using a component library. The library", "</rich:simpleTogglePanel>",
+ "</ui:composition>", };
- abstractTestSource(1, "View Source", strings);
- }
+ abstractTestSource(1, "View Source", strings);
+ }
- /**
- * Tests the "View Source" in the second example. It checks that the source
- * code is not visible, clicks on the link, and checks 7 lines of source
- * code.
- */
- @Test
- public void testSecondExampleSource() {
- String[] strings = new String[] {
- "<ui:composition xmlns=\"http://www.w3.org/1999/xhtml\"",
- "<h:form>",
- "<h:panelGrid columns=\"3\" width=\"100%\" columnClasses=\"tpanels,tpanels,tpanels\">",
- "<rich:simpleTogglePanel switchType=\"server\" label=\"Server Switch Type\" height=\"90px\">",
- "<rich:simpleTogglePanel switchType=\"ajax\" label=\"Ajax Switch Type\" height=\"90px\">",
- "<rich:simpleTogglePanel switchType=\"client\" label=\"Client Switch Type\" height=\"90px\">",
- "</rich:simpleTogglePanel>", };
+ /**
+ * Tests the "View Source" in the second example. It checks that the source
+ * code is not visible, clicks on the link, and checks 7 lines of source
+ * code.
+ */
+ @Test
+ public void testSecondExampleSource() {
+ String[] strings = new String[] { "<ui:composition xmlns=\"http://www.w3.org/1999/xhtml\"", "<h:form>",
+ "<h:panelGrid columns=\"3\" width=\"100%\" columnClasses=\"tpanels,tpanels,tpanels\">",
+ "<rich:simpleTogglePanel switchType=\"server\" label=\"Server Switch Type\" height=\"90px\">",
+ "<rich:simpleTogglePanel switchType=\"ajax\" label=\"Ajax Switch Type\" height=\"90px\">",
+ "<rich:simpleTogglePanel switchType=\"client\" label=\"Client Switch Type\" height=\"90px\">",
+ "</rich:simpleTogglePanel>", };
- abstractTestSource(2, "View Source", strings);
- }
+ abstractTestSource(2, "View Source", strings);
+ }
- /**
- * Abstract method that is parametrized in tests.
- *
- * @param index
- * which panel should be tested
- * @param header
- * a string appearing in panel's header
- */
- private void abstractTestPanelInSecondExample(int index, String header) {
- scrollIntoView(LOC_EXAMPLE_2_HEADER, true);
+ /**
+ * Abstract method that is parametrized in tests.
+ *
+ * @param index
+ * which panel should be tested
+ * @param header
+ * a string appearing in panel's header
+ */
+ private void abstractTestPanelInSecondExample(int index, String header) {
+ scrollIntoView(LOC_EXAMPLE_2_HEADER, true);
- String text = selenium.getText(String.format(
- LOC_SECOND_EXAMPLE_N_HEADER, index));
- assertTrue(text.contains(header), String.format(MSG_PANEL_HEADER,
- header));
+ String text = selenium.getText(format(LOC_SECOND_EXAMPLE_N_HEADER, index));
+ assertTrue(text.contains(header), format(MSG_PANEL_HEADER, header));
- assertTrue(isDisplayed(String.format(LOC_SECOND_EXAMPLE_N_ARROWS_LEFT,
- index)), MSG_LEFT_ARROWS_SHOULD_BE_VISIBLE);
- assertFalse(isDisplayed(String.format(
- LOC_SECOND_EXAMPLE_N_ARROWS_RIGHT, index)),
- MSG_RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE);
- // client type is a bit different
- assertTrue(isDisplayed(String.format(LOC_SECOND_EXAMPLE_N_BODY, index,
- index == 3 ? 3 : 2)), MSG_BODY_SHOULD_BE_VISIBLE);
+ assertTrue(isDisplayed(format(LOC_SECOND_EXAMPLE_N_ARROWS_LEFT, index)), MSG_LEFT_ARROWS_SHOULD_BE_VISIBLE);
+ assertFalse(isDisplayed(format(LOC_SECOND_EXAMPLE_N_ARROWS_RIGHT, index)),
+ MSG_RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE);
+ // client type is a bit different
+ assertTrue(isDisplayed(format(LOC_SECOND_EXAMPLE_N_BODY, index)), MSG_BODY_SHOULD_BE_VISIBLE);
- selenium.click(String.format(LOC_SECOND_EXAMPLE_N_HEADER, index));
- waitFor(2000);
+ selenium.click(format(LOC_SECOND_EXAMPLE_N_HEADER, index));
+ waitFor(2000);
- assertFalse(isDisplayed(String.format(LOC_SECOND_EXAMPLE_N_ARROWS_LEFT,
- index)), MSG_LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE);
- assertTrue(isDisplayed(String.format(LOC_SECOND_EXAMPLE_N_ARROWS_RIGHT,
- index)), MSG_RIGHT_ARROWS_SHOULD_BE_VISIBLE);
- // client type is a bit different
- assertFalse(isDisplayed(String.format(LOC_SECOND_EXAMPLE_N_BODY, index,
- index == 3 ? 3 : 2)), MSG_BODY_SHOULD_NOT_BE_VISIBLE);
- }
+ assertFalse(isDisplayed(format(LOC_SECOND_EXAMPLE_N_ARROWS_LEFT, index)), MSG_LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE);
+ assertTrue(isDisplayed(format(LOC_SECOND_EXAMPLE_N_ARROWS_RIGHT, index)), MSG_RIGHT_ARROWS_SHOULD_BE_VISIBLE);
+ // client type is a bit different
+ assertFalse(isDisplayed(format(LOC_SECOND_EXAMPLE_N_BODY, index)), MSG_BODY_SHOULD_NOT_BE_VISIBLE);
+ }
- /**
- * Loads the page containing the component.
- */
- @BeforeMethod
- private void loadPage() {
- super.loadPage("richOutputs", 8, 1, MSG_COMPONENT_DESCRIPTION);
- }
+ /**
+ * Loads the page containing the component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Simple Toggle Panel");
+ }
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spinner/SpinnerTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spinner/SpinnerTestCase.java 2009-09-08 14:43:30 UTC (rev 15494)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/spinner/SpinnerTestCase.java 2009-09-08 14:54:18 UTC (rev 15495)
@@ -1,3 +1,21 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
package org.jboss.richfaces.integrationTest.spinner;
import static org.testng.Assert.assertEquals;
@@ -13,244 +31,277 @@
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
-public class SpinnerTestCase extends
- AbstractSeleniumRichfacesTestCase {
+public class SpinnerTestCase extends AbstractSeleniumRichfacesTestCase {
- // upper spinner
- private final String upperInput = "//fieldset[1]/div/form/table[1]/tbody/tr/td[1]/input";
- private final String upperUpArrow = "//fieldset[1]/div/form/table[1]/tbody/tr/td[2]/table/tbody/tr[1]/td/input";
- private final String upperDownArrow = "//fieldset[1]/div/form/table[1]/tbody/tr/td[2]/table/tbody/tr[2]/td/input";
+ // locators
+ private final String LOC_EXAMPLE_HEADER = getLoc("EXAMPLE_HEADER");
+ private final String LOC_UPPER_SPINNER_INPUT = getLoc("UPPER_SPINNER_INPUT");
+ private final String LOC_UPPER_SPINNER_UP = getLoc("UPPER_SPINNER_UP");
+ private final String LOC_UPPER_SPINNER_DOWN = getLoc("UPPER_SPINNER_DOWN");
+ private final String LOC_LOWER_SPINNER_INPUT = getLoc("LOWER_SPINNER_INPUT");
+ private final String LOC_LOWER_SPINNER_UP = getLoc("LOWER_SPINNER_UP");
+ private final String LOC_LOWER_SPINNER_DOWN = getLoc("LOWER_SPINNER_DOWN");
- // lower spinner
- private final String lowerInput = "//fieldset[1]/div/form/table[2]/tbody/tr/td[1]/input";
- private final String lowerUpArrow = "//fieldset[1]/div/form/table[2]/tbody/tr/td[2]/table/tbody/tr[1]/td/input";
- private final String lowerDownArrow = "//fieldset[1]/div/form/table[2]/tbody/tr/td[2]/table/tbody/tr[2]/td/input";
+ // messages
+ private final int MSG_INITIAL_STATE_UPPER = Integer.parseInt(getMsg("INITIAL_STATE_UPPER"));
+ private final int MSG_INITIAL_STATE_LOWER = Integer.parseInt(getMsg("INITIAL_STATE_LOWER"));
- /**
- * Tests the initial state of both spinners. Both should be set to 50.
- */
- @Test
- public void testInitialState() {
- assertTrue(selenium.isElementPresent(upperInput),
- "Upper input field is not present.");
- assertTrue(selenium.isElementPresent(upperUpArrow),
- "Upper arrow up is not present.");
- assertTrue(selenium.isElementPresent(upperDownArrow),
- "Upper arrow down is not present.");
- assertTrue(selenium.isElementPresent(lowerInput),
- "Lower input field is not present.");
- assertTrue(selenium.isElementPresent(lowerUpArrow),
- "Lower arrow up is not present.");
- assertTrue(selenium.isElementPresent(lowerDownArrow),
- "Lower arrow down is not present.");
+ private final String MSG_TYPE_TO_UPPER_FIRST_TYPED = getMsg("TYPE_TO_UPPER_FIRST_TYPED");
+ private final int MSG_TYPE_TO_UPPER_FIRST_EXPECTED = Integer.parseInt(getMsg("TYPE_TO_UPPER_FIRST_EXPECTED"));
+ private final String MSG_TYPE_TO_UPPER_SECOND_TYPED = getMsg("TYPE_TO_UPPER_SECOND_TYPED");
+ private final int MSG_TYPE_TO_UPPER_SECOND_EXPECTED = Integer.parseInt(getMsg("TYPE_TO_UPPER_SECOND_EXPECTED"));
+ private final String MSG_TYPE_TO_UPPER_THIRD_TYPED = getMsg("TYPE_TO_UPPER_THIRD_TYPED");
+ private final int MSG_TYPE_TO_UPPER_THIRD_EXPECTED = Integer.parseInt(getMsg("TYPE_TO_UPPER_THIRD_EXPECTED"));
+ private final String MSG_TYPE_TO_UPPER_FOURTH_TYPED = getMsg("TYPE_TO_UPPER_FOURTH_TYPED");
+ private final double MSG_TYPE_TO_UPPER_FOURTH_EXPECTED = Double
+ .parseDouble(getMsg("TYPE_TO_UPPER_FOURTH_EXPECTED"));
+ private final String MSG_TYPE_TO_UPPER_FIFTH_TYPED = getMsg("TYPE_TO_UPPER_FIFTH_TYPED");
+ private final double MSG_TYPE_TO_UPPER_FIFTH_EXPECTED = Double.parseDouble(getMsg("TYPE_TO_UPPER_FIFTH_EXPECTED"));
- int number = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(number, 50, "Content of upper spinner.");
+ private final String MSG_TYPE_TO_LOWER_FIRST_TYPED = getMsg("TYPE_TO_LOWER_FIRST_TYPED");
+ private final int MSG_TYPE_TO_LOWER_FIRST_EXPECTED = Integer.parseInt(getMsg("TYPE_TO_LOWER_FIRST_EXPECTED"));
+ private final String MSG_TYPE_TO_LOWER_SECOND_TYPED = getMsg("TYPE_TO_LOWER_SECOND_TYPED");
+ private final int MSG_TYPE_TO_LOWER_SECOND_EXPECTED = Integer.parseInt(getMsg("TYPE_TO_LOWER_SECOND_EXPECTED"));
+ private final String MSG_TYPE_TO_LOWER_THIRD_TYPED = getMsg("TYPE_TO_LOWER_THIRD_TYPED");
+ private final int MSG_TYPE_TO_LOWER_THIRD_EXPECTED = Integer.parseInt(getMsg("TYPE_TO_LOWER_THIRD_EXPECTED"));
+ private final String MSG_TYPE_TO_LOWER_FOURTH_TYPED = getMsg("TYPE_TO_LOWER_FOURTH_TYPED");
+ private final double MSG_TYPE_TO_LOWER_FOURTH_EXPECTED = Double
+ .parseDouble(getMsg("TYPE_TO_LOWER_FOURTH_EXPECTED"));
+ private final String MSG_TYPE_TO_LOWER_FIFTH_TYPED = getMsg("TYPE_TO_LOWER_FIFTH_TYPED");
+ private final double MSG_TYPE_TO_LOWER_FIFTH_EXPECTED = Double.parseDouble(getMsg("TYPE_TO_LOWER_FIFTH_EXPECTED"));
- number = Integer.parseInt(selenium.getValue(lowerInput));
- assertEquals(number, 50, "Content of lower spinner.");
- }
+ private final int MSG_OVERFLOW_UPPER = Integer.parseInt(getMsg("OVERFLOW_UPPER"));
+ private final int MSG_OVERFLOW_LOWER = Integer.parseInt(getMsg("OVERFLOW_LOWER"));
+ private final int MSG_UNDERFLOW_UPPER = Integer.parseInt(getMsg("UNDERFLOW_UPPER"));
+ private final int MSG_UNDERFLOW_LOWER = Integer.parseInt(getMsg("UNDERFLOW_LOWER"));
- /**
- * Tests clicking on the up arrow of the upper spinner.
- */
- @Test
- public void testUpperClickUp() {
- int oldValue = Integer.parseInt(selenium.getValue(upperInput));
+ /**
+ * Tests the initial state of both spinners. Both should be set to 50.
+ */
+ @Test
+ public void testInitialState() {
+ assertTrue(selenium.isElementPresent(LOC_UPPER_SPINNER_INPUT), "Upper input field is not present.");
+ assertTrue(selenium.isElementPresent(LOC_UPPER_SPINNER_UP), "Upper arrow up is not present.");
+ assertTrue(selenium.isElementPresent(LOC_UPPER_SPINNER_DOWN), "Upper arrow down is not present.");
+ assertTrue(selenium.isElementPresent(LOC_LOWER_SPINNER_INPUT), "Lower input field is not present.");
+ assertTrue(selenium.isElementPresent(LOC_LOWER_SPINNER_UP), "Lower arrow up is not present.");
+ assertTrue(selenium.isElementPresent(LOC_LOWER_SPINNER_DOWN), "Lower arrow down is not present.");
- selenium.clickAt(upperUpArrow, "0,0");
+ int number = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(number, MSG_INITIAL_STATE_UPPER, "Content of upper spinner.");
- int newValue = Integer.parseInt(selenium.getValue(upperInput));
+ number = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(number, MSG_INITIAL_STATE_LOWER, "Content of lower spinner.");
+ }
- assertEquals(newValue, oldValue + 1,
- "The value should increase by 1 after clicking on up arrow.");
- }
+ /**
+ * Tests clicking on the up arrow of the upper spinner.
+ */
+ @Test
+ public void testUpperClickUp() {
+ int oldValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
- /**
- * Tests clicking on the down arrow of the upper spinner.
- */
- @Test
- public void testUpperClickDown() {
- int oldValue = Integer.parseInt(selenium.getValue(upperInput));
+ selenium.clickAt(LOC_UPPER_SPINNER_UP, "0,0");
- selenium.clickAt(upperDownArrow, "0,0");
+ int newValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, oldValue + 1, "The value should increase by 1 after clicking on up arrow.");
+ }
- int newValue = Integer.parseInt(selenium.getValue(upperInput));
+ /**
+ * Tests clicking on the down arrow of the upper spinner.
+ */
+ @Test
+ public void testUpperClickDown() {
+ int oldValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
- assertEquals(newValue, oldValue - 1,
- "The value should decrease by 1 after clicking on down arrow.");
+ selenium.clickAt(LOC_UPPER_SPINNER_DOWN, "0,0");
- }
+ int newValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, oldValue - 1, "The value should decrease by 1 after clicking on down arrow.");
- /**
- * Tests clicking on the up arrow of the lower spinner.
- */
- @Test
- public void testLowerClickUp() {
- int oldValue = Integer.parseInt(selenium.getValue(lowerInput));
+ }
- selenium.clickAt(lowerUpArrow, "0,0");
+ /**
+ * Tests clicking on the up arrow of the lower spinner.
+ */
+ @Test
+ public void testLowerClickUp() {
+ int oldValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
- int newValue = Integer.parseInt(selenium.getValue(lowerInput));
+ selenium.clickAt(LOC_LOWER_SPINNER_UP, "0,0");
- assertEquals(newValue, oldValue + 10,
- "The value should increase by 10 after clicking on up arrow.");
- }
+ int newValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, oldValue + 10, "The value should increase by 10 after clicking on up arrow.");
+ }
- /**
- * Tests clicking on the down arrow of the lower spinner.
- */
- @Test
- public void testLowerClickDown() {
- int oldValue = Integer.parseInt(selenium.getValue(lowerInput));
+ /**
+ * Tests clicking on the down arrow of the lower spinner.
+ */
+ @Test
+ public void testLowerClickDown() {
+ int oldValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
- selenium.clickAt(lowerDownArrow, "0,0");
+ selenium.clickAt(LOC_LOWER_SPINNER_DOWN, "0,0");
- int newValue = Integer.parseInt(selenium.getValue(lowerInput));
+ int newValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, oldValue - 10, "The value should decrease by 10 after clicking on down arrow.");
+ }
- assertEquals(newValue, oldValue - 10,
- "The value should decrease by 10 after clicking on down arrow.");
- }
+ /**
+ * Tests typing into the upper spinner. In the beginning it tries valid
+ * value (20), then a value bigger than maximum (2000), a value lower than
+ * minimum (-23), a decimal value (34.5), and a string ("aaa").
+ */
+ @Test
+ public void testTypeToUpper() {
+ selenium.type(LOC_UPPER_SPINNER_INPUT, MSG_TYPE_TO_UPPER_FIRST_TYPED);
+ Number newValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_LOWER_FIRST_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.", MSG_TYPE_TO_UPPER_FIRST_EXPECTED,
+ MSG_TYPE_TO_UPPER_FIRST_TYPED));
- /**
- * Tests typing into the upper spinner. In the beginning it tries valid
- * value (20), then a value bigger than maximum (2000), a value lower than
- * minimum (-23), a decimal value (34.5), and a string ("aaa").
- */
- @Test
- public void testTypeToUpper() {
- selenium.type(upperInput, "20");
- Number newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 20, "Value in the input field did not change.");
+ selenium.type(LOC_UPPER_SPINNER_INPUT, MSG_TYPE_TO_UPPER_SECOND_TYPED);
+ newValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_UPPER_SECOND_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.", MSG_TYPE_TO_UPPER_SECOND_EXPECTED,
+ MSG_TYPE_TO_UPPER_SECOND_TYPED));
- selenium.type(upperInput, "2000");
- newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 100,
- "Input field should contain 100 after 2000 was typed.");
+ selenium.type(LOC_UPPER_SPINNER_INPUT, MSG_TYPE_TO_UPPER_THIRD_TYPED);
+ newValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_UPPER_THIRD_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.", MSG_TYPE_TO_UPPER_THIRD_EXPECTED,
+ MSG_TYPE_TO_UPPER_THIRD_TYPED));
- selenium.type(upperInput, "-23");
- newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 0,
- "Input field should contain 0 after -23 was typed.");
+ selenium.type(LOC_UPPER_SPINNER_INPUT, MSG_TYPE_TO_UPPER_FOURTH_TYPED);
+ newValue = Double.parseDouble(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_UPPER_FOURTH_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.", MSG_TYPE_TO_UPPER_FOURTH_EXPECTED,
+ MSG_TYPE_TO_UPPER_FOURTH_TYPED));
- selenium.type(upperInput, "34.5");
- newValue = Double.parseDouble(selenium.getValue(upperInput));
- assertEquals(newValue, 34.5,
- "Input field should contain 34.5 after 34.5 was typed.");
+ selenium.type(LOC_UPPER_SPINNER_INPUT, MSG_TYPE_TO_UPPER_FIFTH_TYPED);
+ newValue = Double.parseDouble(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_UPPER_FIFTH_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.", MSG_TYPE_TO_UPPER_FIFTH_EXPECTED,
+ MSG_TYPE_TO_UPPER_FIFTH_TYPED));
+ }
- Number oldValue = Double.parseDouble(selenium.getValue(upperInput));
- selenium.type(upperInput, "aaa");
- newValue = Double.parseDouble(selenium.getValue(upperInput));
- assertEquals(newValue, oldValue, "Input field should contain "
- + oldValue + " after 'aaa' was typed.");
- }
+ /**
+ * Tests typing into the lower spinner. In the beginning it tries valid
+ * value (20), then a value bigger than maximum (2000), a value lower than
+ * minimum (-23), a decimal value (34.5), and a string ("aaa").
+ */
+ @Test
+ public void testTypeToLower() {
+ selenium.type(LOC_LOWER_SPINNER_INPUT, MSG_TYPE_TO_LOWER_FIRST_TYPED);
+ Number newValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_LOWER_FIRST_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.", MSG_TYPE_TO_LOWER_FIRST_EXPECTED,
+ MSG_TYPE_TO_LOWER_FIRST_TYPED));
- /**
- * Tests typing into the lower spinner. In the beginning it tries valid
- * value (20), then a value bigger than maximum (2000), a value lower than
- * minimum (-23), a decimal value (34.5), and a string ("aaa").
- */
- @Test
- public void testTypeToLower() {
- selenium.type(upperInput, "20");
- Number newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 20, "Value in the input field did not change.");
+ selenium.type(LOC_LOWER_SPINNER_INPUT, MSG_TYPE_TO_LOWER_SECOND_TYPED);
+ newValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_LOWER_SECOND_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.", MSG_TYPE_TO_LOWER_SECOND_EXPECTED,
+ MSG_TYPE_TO_LOWER_SECOND_TYPED));
- selenium.type(upperInput, "2000");
- newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 100,
- "Input field should contain 100 after 2000 was typed.");
+ selenium.type(LOC_LOWER_SPINNER_INPUT, MSG_TYPE_TO_LOWER_THIRD_TYPED);
+ newValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_LOWER_THIRD_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.", MSG_TYPE_TO_LOWER_THIRD_EXPECTED,
+ MSG_TYPE_TO_LOWER_THIRD_TYPED));
- selenium.type(upperInput, "-23");
- newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 0,
- "Input field should contain 0 after -23 was typed.");
+ selenium.type(LOC_LOWER_SPINNER_INPUT, MSG_TYPE_TO_LOWER_FOURTH_TYPED);
+ newValue = Double.parseDouble(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_LOWER_FOURTH_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.", MSG_TYPE_TO_LOWER_FOURTH_EXPECTED,
+ MSG_TYPE_TO_LOWER_FOURTH_TYPED));
- selenium.type(upperInput, "34.5");
- newValue = Double.parseDouble(selenium.getValue(upperInput));
- assertEquals(newValue, 34.5,
- "Input field should contain 34.5 after 34.5 was typed.");
+ selenium.type(LOC_LOWER_SPINNER_INPUT, MSG_TYPE_TO_LOWER_FIFTH_TYPED);
+ newValue = Double.parseDouble(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_TYPE_TO_LOWER_FIFTH_EXPECTED, format(
+ "Input field should contain {0} after {1} was typed.", MSG_TYPE_TO_LOWER_FIFTH_EXPECTED,
+ MSG_TYPE_TO_LOWER_FIFTH_TYPED));
+ }
- Number oldValue = Double.parseDouble(selenium.getValue(upperInput));
- selenium.type(upperInput, "aaa");
- newValue = Double.parseDouble(selenium.getValue(upperInput));
- assertEquals(newValue, oldValue, "Input field should contain "
- + oldValue + " after 'aaa' was typed.");
- }
+ /**
+ * Tests value overflow. It clicks 51 times on the up button of the upper
+ * spinner and verifies that the value changed to 0. Then it clicks 6 times
+ * on the up button of the lower spinner and checks that the value changed
+ * to 0.
+ */
+ @Test
+ public void testOverflow() {
+ // it starts at 50, maximum is 100, increment 1, it will try to click 51
+ // times
+ for (int i = 0; i < 51; i++) {
+ selenium.clickAt(LOC_UPPER_SPINNER_UP, "0,0");
+ }
- /**
- * Tests value overflow. It clicks 51 times on the up button of the upper
- * spinner and verifies that the value changed to 0. Then it clicks 6 times
- * on the up button of the lower spinner and checks that the value changed
- * to 0.
- */
- @Test
- public void testOverflow() {
- // it starts at 50, maximum is 100, increment 1, it will try to click 51
- // times
- for (int i = 0; i < 51; i++) {
- selenium.clickAt(upperUpArrow, "0,0");
- }
+ int newValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_OVERFLOW_UPPER, format("The value should change to {0} at overflow.",
+ MSG_OVERFLOW_UPPER));
- int newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 0, "The value should change to 0 at overflow.");
+ // it starts at 50, maximum is 100, increment 10, it will try to click 6
+ // times
+ for (int i = 0; i < 6; i++) {
+ selenium.clickAt(LOC_LOWER_SPINNER_UP, "0,0");
+ }
- // it starts at 50, maximum is 100, increment 10, it will try to click 6
- // times
- for (int i = 0; i < 6; i++) {
- selenium.clickAt(lowerUpArrow, "0,0");
- }
+ newValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_OVERFLOW_LOWER, format("The value should change to {0} at overflow.",
+ MSG_OVERFLOW_LOWER));
+ }
- newValue = Integer.parseInt(selenium.getValue(lowerInput));
- assertEquals(newValue, 0, "The value should change to 0 at overflow.");
- }
+ /**
+ * Tests value underflow. It clicks 51 times on the down button of the lower
+ * spinner and verifies that the value changed to 100. Then it clicks 6
+ * times on the down button of the lower spinner and checks that the value
+ * changed to 100.
+ */
+ @Test
+ public void testUnderflow() {
+ // it starts at 50, minimum is 0, increment 1, it will try to click 51
+ // times
+ for (int i = 0; i < 51; i++) {
+ selenium.clickAt(LOC_UPPER_SPINNER_DOWN, "0,0");
+ }
- /**
- * Tests value underflow. It clicks 51 times on the down button of the lower
- * spinner and verifies that the value changed to 100. Then it clicks 6
- * times on the down button of the lower spinner and checks that the value
- * changed to 100.
- */
- @Test
- public void testUnderflow() {
- // it starts at 50, minimum is 0, increment 1, it will try to click 51
- // times
- for (int i = 0; i < 51; i++) {
- selenium.clickAt(upperDownArrow, "0,0");
- }
+ int newValue = Integer.parseInt(selenium.getValue(LOC_UPPER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_UNDERFLOW_UPPER, format("The value should change to {0} at underflow.",
+ MSG_UNDERFLOW_UPPER));
- int newValue = Integer.parseInt(selenium.getValue(upperInput));
- assertEquals(newValue, 100,
- "The value should change to 100 at underflow.");
+ // it starts at 50, minimum is 0, increment 10, it will try to click 6
+ // times
+ for (int i = 0; i < 6; i++) {
+ selenium.clickAt(LOC_LOWER_SPINNER_DOWN, "0,0");
+ }
- // it starts at 50, minimum is 0, increment 10, it will try to click 6
- // times
- for (int i = 0; i < 6; i++) {
- selenium.clickAt(lowerDownArrow, "0,0");
- }
+ newValue = Integer.parseInt(selenium.getValue(LOC_LOWER_SPINNER_INPUT));
+ assertEquals(newValue, MSG_UNDERFLOW_LOWER, format("The value should change to {0} at underflow.",
+ MSG_UNDERFLOW_LOWER));
+ }
- newValue = Integer.parseInt(selenium.getValue(lowerInput));
- assertEquals(newValue, 100,
- "The value should change to 100 at underflow.");
- }
+ /**
+ * Tests the "View Source". It checks that the source code is not visible,
+ * clicks on the link, and checks 5 lines of source code.
+ */
+ @Test
+ public void testSpinnerSource() {
+ String[] strings = new String[] { "<ui:composition xmlns=\"http://www.w3.org/1999/xhtml\"",
+ "<a4j:form ajaxSubmit=\"true\">", "Here is an example of default inputNumberSpinner:",
+ "<rich:inputNumberSpinner value=\"50\"/>", "<rich:inputNumberSpinner value=\"50\" step=\"10\"/>", };
- /**
- * Tests the "View Source". It checks that the source code is not visible,
- * clicks on the link, and checks the first 2 components of source code,
- * i.e. that the source code begins with "<ui:composition".
- */
- @Test
- public void testSpinnerSource() {
- abstractTestSource(1, 1, "<", "ui:composition");
- }
+ abstractTestSource(1, "View Source", strings);
+ }
- /**
- * Loads the page containing the calendar component.
- */
- @BeforeMethod
- private void loadPage() {
- super.loadPage("richInputs", 9,
- "InputNumberSpinner is a highly customizable component");
- }
+ /**
+ * Loads the page containing the calendar component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Input Number Spinner");
+ scrollIntoView(LOC_EXAMPLE_HEADER, true);
+ }
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java 2009-09-08 14:43:30 UTC (rev 15494)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/suggestionBox/SuggestionBoxTestCase.java 2009-09-08 14:54:18 UTC (rev 15495)
@@ -1,3 +1,21 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
package org.jboss.richfaces.integrationTest.suggestionBox;
import static org.testng.Assert.assertEquals;
@@ -14,403 +32,385 @@
*/
public class SuggestionBoxTestCase extends AbstractSeleniumRichfacesTestCase {
- // messages
- private final String MSG_COMPONENT_DESCRIPTION = getMsg("COMPONENT_DESCRIPTION");
- private final String MSG_TABLE_M_N = getMsg("TABLE_M_N");
- private final String MSG_NO_CAPITALS_FOUND = getMsg("NO_CAPITALS_FOUND");
- private final String MSG_SUGGESTION_BOX_BORDER = getMsg("SUGGESTION_BOX_BORDER");
- private final String MSG_SUGGESTION_BOX_WIDTH = getMsg("SUGGESTION_BOX_WIDTH");
- private final String MSG_SUGGESTION_BOX_HEIGHT = getMsg("SUGGESTION_BOX_HEIGHT");
- private final String MSG_SUGGESTION_BOX_SHADOW_DEPTH = getMsg("SUGGESTION_BOX_SHADOW_DEPTH");
- private final String MSG_SUGGESTION_BOX_SHADOW_OPACITY = getMsg("SUGGESTION_BOX_SHADOW_OPACITY");
- private final String MSG_SUGGESTION_BOX_CELLPADDING = getMsg("SUGGESTION_BOX_CELLPADDING");
- private final String MSG_COUNT_OF_ALL_SUGGESTIONS = getMsg("COUNT_OF_ALL_SUGGESTIONS");
- private final String MSG_AUGUSTA_MAINE = getMsg("AUGUSTA_MAINE");
- private final String MSG_AUGUSTA_MADISON_MAINE_WISCONSIN = getMsg("AUGUSTA_MADISON_MAINE_WISCONSIN");
+ // messages
+ private final String MSG_TABLE_PREFORMATTED = getMsg("TABLE_PREFORMATTED");
+ private final String MSG_PREFORMATTEDO_CAPITALS_FOUND = getMsg("NO_CAPITALS_FOUND");
+ private final String MSG_SUGGESTION_BOX_BORDER_PREFORMATTED = getMsg("SUGGESTION_BOX_BORDER_PREFORMATTED");
+ private final String MSG_SUGGESTION_BOX_WIDTH_PREFORMATTED = getMsg("SUGGESTION_BOX_WIDTH_PREFORMATTED");
+ private final String MSG_SUGGESTION_BOX_HEIGHT_PREFORMATTED = getMsg("SUGGESTION_BOX_HEIGHT_PREFORMATTED");
+ private final String MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED = getMsg("SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED");
+ private final String MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED = getMsg("SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED");
+ private final String MSG_SUGGESTION_BOX_CELLPADDING_PREFORMATTED = getMsg("SUGGESTION_BOX_CELLPADDING_PREFORMATTED");
+ private final String MSG_COUNT_OF_ALL_SUGGESTIONS = getMsg("COUNT_OF_ALL_SUGGESTIONS");
+ private final String MSG_AUGUSTA_MAINE = getMsg("AUGUSTA_MAINE");
+ private final String MSG_AUGUSTA_MADISON_MAINE_WISCONSIN = getMsg("AUGUSTA_MADISON_MAINE_WISCONSIN");
- // locators
- private final String LOC_FIRST_SUGGESTION_BOX_N = getLoc("FIRST_SUGGESTION_BOX_N");
- private final String LOC_FIRST_TOWN_TABLE_M_N = getLoc("FIRST_TOWN_TABLE_M_N");
+ // locators
+ private final String LOC_FIRST_SUGGESTION_BOX_PREFORMATTED = getLoc("FIRST_SUGGESTION_BOX_PREFORMATTED");
+ private final String LOC_FIRST_TOWN_TABLE_PREFORMATTED = getLoc("FIRST_TOWN_TABLE_PREFORMATTED");
- private final String LOC_FIRST_INPUT = getLoc("FIRST_INPUT");
- private final String LOC_FIRST_BORDER_INPUT = getLoc("FIRST_BORDER_INPUT");
- private final String LOC_FIRST_WIDTH_INPUT = getLoc("FIRST_WIDTH_INPUT");
- private final String LOC_FIRST_HEIGHT_INPUT = getLoc("FIRST_HEIGHT_INPUT");
- private final String LOC_FIRST_SHADOW_DEPTH_INPUT = getLoc("FIRST_SHADOW_DEPTH_INPUT");
- private final String LOC_FIRST_SHADOW_OPACITY_INPUT = getLoc("FIRST_SHADOW_OPACITY_INPUT");
- private final String LOC_FIRST_CELLPADDING_INPUT = getLoc("FIRST_CELLPADDING_INPUT");
+ private final String LOC_FIRST_INPUT = getLoc("FIRST_INPUT");
+ private final String LOC_FIRST_BORDER_INPUT = getLoc("FIRST_BORDER_INPUT");
+ private final String LOC_FIRST_WIDTH_INPUT = getLoc("FIRST_WIDTH_INPUT");
+ private final String LOC_FIRST_HEIGHT_INPUT = getLoc("FIRST_HEIGHT_INPUT");
+ private final String LOC_FIRST_SHADOW_DEPTH_INPUT = getLoc("FIRST_SHADOW_DEPTH_INPUT");
+ private final String LOC_FIRST_SHADOW_OPACITY_INPUT = getLoc("FIRST_SHADOW_OPACITY_INPUT");
+ private final String LOC_FIRST_CELLPADDING_INPUT = getLoc("FIRST_CELLPADDING_INPUT");
- private final String LOC_FIRST_BORDER_STYLE = getLoc("FIRST_BORDER_STYLE");
- private final String LOC_FIRST_WIDTH_STYLE = getLoc("FIRST_WIDTH_STYLE");
- private final String LOC_FIRST_HEIGHT_STYLE = getLoc("FIRST_HEIGHT_STYLE");
- private final String LOC_FIRST_SHADOW_DEPTH_STYLE = getLoc("FIRST_SHADOW_DEPTH_STYLE");
- private final String LOC_FIRST_SHADOW_OPACITY_STYLE = getLoc("FIRST_SHADOW_OPACITY_STYLE");
- private final String LOC_FIRST_CELLPADDING = getLoc("FIRST_CELLPADDING");
+ private final String LOC_FIRST_BORDER_STYLE = getLoc("FIRST_BORDER_STYLE");
+ private final String LOC_FIRST_WIDTH_STYLE = getLoc("FIRST_WIDTH_STYLE");
+ private final String LOC_FIRST_HEIGHT_STYLE = getLoc("FIRST_HEIGHT_STYLE");
+ private final String LOC_FIRST_SHADOW_DEPTH_STYLE = getLoc("FIRST_SHADOW_DEPTH_STYLE");
+ private final String LOC_FIRST_SHADOW_OPACITY_STYLE = getLoc("FIRST_SHADOW_OPACITY_STYLE");
+ private final String LOC_FIRST_CELLPADDING = getLoc("FIRST_CELLPADDING");
- private final String LOC_SECOND_INPUT = getLoc("SECOND_INPUT");
- private final String LOC_SECOND_BUTTON = getLoc("SECOND_BUTTON");
- private final String LOC_SECOND_SUGGESTION_LINES = getLoc("SECOND_SUGGESTION_LINES");
- private final String LOC_SECOND_SUGGESTION_BOX_N = getLoc("SECOND_SUGGESTION_BOX_N");
- private final String LOC_SECOND_STATE = getLoc("SECOND_STATE");
+ private final String LOC_SECOND_INPUT = getLoc("SECOND_INPUT");
+ private final String LOC_SECOND_BUTTON = getLoc("SECOND_BUTTON");
+ private final String LOC_SECOND_SUGGESTION_LINES = getLoc("SECOND_SUGGESTION_LINES");
+ private final String LOC_SECOND_SUGGESTION_BOX_PREFORMATTED = getLoc("SECOND_SUGGESTION_BOX_PREFORMATTED");
+ private final String LOC_SECOND_STATE = getLoc("SECOND_STATE");
- /**
- * Tests inputting two cities separated by a comma. First it chooses Atlanta and Madison. Then
- * it checks all items in the table on the right.
- */
- @Test
- public void testCommaSeparatedTowns() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ /**
+ * Tests inputting two cities separated by a comma. First it chooses Atlanta
+ * and Madison. Then it checks all items in the table on the right.
+ */
+ @Test
+ public void testCommaSeparatedTowns() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- // select Atlanta
- selenium.typeKeys(LOC_FIRST_INPUT, "at");
- waitForElement(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1));
+ // select Atlanta
+ selenium.typeKeys(LOC_FIRST_INPUT, "at");
+ waitForElement(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1));
- selenium.click(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1));
+ selenium.click(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1));
- // select Madison
- selenium.typeKeys(LOC_FIRST_INPUT, ",ma");
-
- waitForTextEquals(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1),
- "MadisonWisconsin");
- selenium.click(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1));
+ // select Madison
+ selenium.typeKeys(LOC_FIRST_INPUT, ",ma");
- String text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N,
- 1, 1));
- assertEquals(text, "Georgia", String.format(MSG_TABLE_M_N, 1, 1));
+ waitForTextEquals(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1), "MadisonWisconsin");
+ selenium.click(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 1, 2));
- assertEquals(text, "Atlanta", String.format(MSG_TABLE_M_N, 1, 2));
+ String text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 1));
+ assertEquals(text, "Georgia", format(MSG_TABLE_PREFORMATTED, 1, 1));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 1, 3));
- assertEquals(text, "Augusta", String.format(MSG_TABLE_M_N, 1, 3));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 2));
+ assertEquals(text, "Atlanta", format(MSG_TABLE_PREFORMATTED, 1, 2));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 1, 4));
- assertEquals(text, "Columbus", String.format(MSG_TABLE_M_N, 1, 4));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 3));
+ assertEquals(text, "Augusta", format(MSG_TABLE_PREFORMATTED, 1, 3));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 1));
- assertEquals(text, "Wisconsin", String.format(MSG_TABLE_M_N, 2, 1));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 4));
+ assertEquals(text, "Columbus", format(MSG_TABLE_PREFORMATTED, 1, 4));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 2));
- assertEquals(text, "Milwaukee", String.format(MSG_TABLE_M_N, 2, 2));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 1));
+ assertEquals(text, "Wisconsin", format(MSG_TABLE_PREFORMATTED, 2, 1));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 3));
- assertEquals(text, "Madison", String.format(MSG_TABLE_M_N, 2, 3));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 2));
+ assertEquals(text, "Milwaukee", format(MSG_TABLE_PREFORMATTED, 2, 2));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 4));
- assertEquals(text, "Green Bay", String.format(MSG_TABLE_M_N, 2, 4));
- }
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 3));
+ assertEquals(text, "Madison", format(MSG_TABLE_PREFORMATTED, 2, 3));
- /**
- * Tests inputting two cities separated by square brackets. First it chooses Atlanta and Madison. Then
- * it checks all items in the table on the right.
- */
- @Test
- public void testSquareBracketsSeparatedTowns() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 4));
+ assertEquals(text, "Green Bay", format(MSG_TABLE_PREFORMATTED, 2, 4));
+ }
- // select Atlanta
- selenium.typeKeys(LOC_FIRST_INPUT, "[at");
- waitForElement(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1));
+ /**
+ * Tests inputting two cities separated by square brackets. First it chooses
+ * Atlanta and Madison. Then it checks all items in the table on the right.
+ */
+ @Test
+ public void testSquareBracketsSeparatedTowns() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.click(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1));
- selenium.typeKeys(LOC_FIRST_INPUT, "]");
+ // select Atlanta
+ selenium.typeKeys(LOC_FIRST_INPUT, "[at");
+ waitForElement(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1));
- // select Madison
- selenium.typeKeys(LOC_FIRST_INPUT, "[ma");
- waitForTextEquals(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1),
- "MadisonWisconsin");
- selenium.click(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1));
- selenium.typeKeys(LOC_FIRST_INPUT, "]");
-
- String text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N,
- 1, 1));
- assertEquals(text, "Georgia", String.format(MSG_TABLE_M_N, 1, 1));
+ selenium.click(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1));
+ selenium.typeKeys(LOC_FIRST_INPUT, "]");
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 1, 2));
- assertEquals(text, "Atlanta", String.format(MSG_TABLE_M_N, 1, 2));
+ // select Madison
+ selenium.typeKeys(LOC_FIRST_INPUT, "[ma");
+ waitForTextEquals(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1), "MadisonWisconsin");
+ selenium.click(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1));
+ selenium.typeKeys(LOC_FIRST_INPUT, "]");
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 1, 3));
- assertEquals(text, "Augusta", String.format(MSG_TABLE_M_N, 1, 3));
+ String text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 1));
+ assertEquals(text, "Georgia", format(MSG_TABLE_PREFORMATTED, 1, 1));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 1, 4));
- assertEquals(text, "Columbus", String.format(MSG_TABLE_M_N, 1, 4));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 2));
+ assertEquals(text, "Atlanta", format(MSG_TABLE_PREFORMATTED, 1, 2));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 1));
- assertEquals(text, "Wisconsin", String.format(MSG_TABLE_M_N, 2, 1));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 3));
+ assertEquals(text, "Augusta", format(MSG_TABLE_PREFORMATTED, 1, 3));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 2));
- assertEquals(text, "Milwaukee", String.format(MSG_TABLE_M_N, 2, 2));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 1, 4));
+ assertEquals(text, "Columbus", format(MSG_TABLE_PREFORMATTED, 1, 4));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 3));
- assertEquals(text, "Madison", String.format(MSG_TABLE_M_N, 2, 3));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 1));
+ assertEquals(text, "Wisconsin", format(MSG_TABLE_PREFORMATTED, 2, 1));
- text = selenium.getText(String.format(LOC_FIRST_TOWN_TABLE_M_N, 2, 4));
- assertEquals(text, "Green Bay", String.format(MSG_TABLE_M_N, 2, 4));
- }
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 2));
+ assertEquals(text, "Milwaukee", format(MSG_TABLE_PREFORMATTED, 2, 2));
- /**
- * Tests typing in a non-existing city ('aaa'). It checks that the string "No capitals found" is shown.
- */
- @Test
- public void testNonExisting() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 3));
+ assertEquals(text, "Madison", format(MSG_TABLE_PREFORMATTED, 2, 3));
- // select aaa
- selenium.typeKeys(LOC_FIRST_INPUT, "aaa");
-
- waitForElement(String.format(LOC_FIRST_SUGGESTION_BOX_N, 1));
+ text = selenium.getText(format(LOC_FIRST_TOWN_TABLE_PREFORMATTED, 2, 4));
+ assertEquals(text, "Green Bay", format(MSG_TABLE_PREFORMATTED, 2, 4));
+ }
- String text = selenium.getText(String.format(
- LOC_FIRST_SUGGESTION_BOX_N, 1));
+ /**
+ * Tests typing in a non-existing city ('aaa'). It checks that the string
+ * "No capitals found" is shown.
+ */
+ @Test
+ public void testNonExisting() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- assertEquals(text, "No capitals found", MSG_NO_CAPITALS_FOUND);
- }
+ // select aaa
+ selenium.typeKeys(LOC_FIRST_INPUT, "aaa");
- /**
- * Tests the "Border" slider. It tests values 3, 5, and 7.
- */
- @Test
- public void testBorder() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ waitForElement(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1));
+ String text = selenium.getText(format(LOC_FIRST_SUGGESTION_BOX_PREFORMATTED, 1));
+ assertEquals(text, "No capitals found", MSG_PREFORMATTEDO_CAPITALS_FOUND);
+ }
- selenium.type(LOC_FIRST_BORDER_INPUT, "3");
- waitFor(1500);
- int width = getValue(LOC_FIRST_BORDER_STYLE, "border-width");
- assertEquals(width, 3, String.format(MSG_SUGGESTION_BOX_BORDER, 3));
+ /**
+ * Tests the "Border" slider. It tests values 3, 5, and 7.
+ */
+ @Test
+ public void testBorder() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_BORDER_INPUT, "5");
- waitFor(1500);
- width = getValue(LOC_FIRST_BORDER_STYLE, "border-width");
- assertEquals(width, 5, String.format(MSG_SUGGESTION_BOX_BORDER, 5));
+ selenium.type(LOC_FIRST_BORDER_INPUT, "3");
+ waitFor(1500);
+ int width = getValue(LOC_FIRST_BORDER_STYLE, "border-width");
+ assertEquals(width, 3, format(MSG_SUGGESTION_BOX_BORDER_PREFORMATTED, 3));
- selenium.type(LOC_FIRST_BORDER_INPUT, "7"); // 7 -> 5
- waitFor(1500);
- width = getValue(LOC_FIRST_BORDER_STYLE, "border-width");
- assertEquals(width, 5, String.format(MSG_SUGGESTION_BOX_BORDER, 7));
- }
+ selenium.type(LOC_FIRST_BORDER_INPUT, "5");
+ waitFor(1500);
+ width = getValue(LOC_FIRST_BORDER_STYLE, "border-width");
+ assertEquals(width, 5, format(MSG_SUGGESTION_BOX_BORDER_PREFORMATTED, 5));
- /**
- * Tests the "Width" slider. It tests values 150, 350, 400, and 176.
- */
- @Test
- public void testWidth() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ selenium.type(LOC_FIRST_BORDER_INPUT, "7"); // 7 -> 5
+ waitFor(1500);
+ width = getValue(LOC_FIRST_BORDER_STYLE, "border-width");
+ assertEquals(width, 5, format(MSG_SUGGESTION_BOX_BORDER_PREFORMATTED, 7));
+ }
- selenium.type(LOC_FIRST_WIDTH_INPUT, "150");
- waitFor(1500);
- int width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
- assertEquals(width, 150, String.format(MSG_SUGGESTION_BOX_WIDTH, 150));
+ /**
+ * Tests the "Width" slider. It tests values 150, 350, 400, and 176.
+ */
+ @Test
+ public void testWidth() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_WIDTH_INPUT, "350");
- waitFor(1500);
- width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
- assertEquals(width, 350, String.format(MSG_SUGGESTION_BOX_WIDTH, 350));
+ selenium.type(LOC_FIRST_WIDTH_INPUT, "150");
+ waitFor(1500);
+ int width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
+ assertEquals(width, 150, format(MSG_SUGGESTION_BOX_WIDTH_PREFORMATTED, 150));
- selenium.type(LOC_FIRST_WIDTH_INPUT, "400"); // 400 -> 350
- waitFor(1500);
- width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
- assertEquals(width, 350, String.format(MSG_SUGGESTION_BOX_WIDTH, 400));
+ selenium.type(LOC_FIRST_WIDTH_INPUT, "350");
+ waitFor(1500);
+ width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
+ assertEquals(width, 350, format(MSG_SUGGESTION_BOX_WIDTH_PREFORMATTED, 350));
- selenium.type(LOC_FIRST_WIDTH_INPUT, "176"); // 176 -> 200
- waitFor(1500);
- width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
- assertEquals(width, 200, String.format(MSG_SUGGESTION_BOX_WIDTH, 176));
- }
+ selenium.type(LOC_FIRST_WIDTH_INPUT, "400"); // 400 -> 350
+ waitFor(1500);
+ width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
+ assertEquals(width, 350, format(MSG_SUGGESTION_BOX_WIDTH_PREFORMATTED, 400));
- /**
- * Tests the "Height" slider. It tests values 100, 300, 400, and 176.
- */
- @Test
- public void testHeight() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ selenium.type(LOC_FIRST_WIDTH_INPUT, "176"); // 176 -> 200
+ waitFor(1500);
+ width = getValue(LOC_FIRST_WIDTH_STYLE, "width");
+ assertEquals(width, 200, format(MSG_SUGGESTION_BOX_WIDTH_PREFORMATTED, 176));
+ }
- selenium.type(LOC_FIRST_HEIGHT_INPUT, "100");
- waitFor(1500);
- int height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
- assertEquals(height, 100, String.format(MSG_SUGGESTION_BOX_HEIGHT, 100));
+ /**
+ * Tests the "Height" slider. It tests values 100, 300, 400, and 176.
+ */
+ @Test
+ public void testHeight() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_HEIGHT_INPUT, "300");
- waitFor(1500);
- height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
- assertEquals(height, 300, String.format(MSG_SUGGESTION_BOX_HEIGHT, 300));
+ selenium.type(LOC_FIRST_HEIGHT_INPUT, "100");
+ waitFor(1500);
+ int height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
+ assertEquals(height, 100, format(MSG_SUGGESTION_BOX_HEIGHT_PREFORMATTED, 100));
- selenium.type(LOC_FIRST_HEIGHT_INPUT, "400"); // 400 -> 300
- waitFor(1500);
- height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
- assertEquals(height, 300, String.format(MSG_SUGGESTION_BOX_HEIGHT, 400));
+ selenium.type(LOC_FIRST_HEIGHT_INPUT, "300");
+ waitFor(1500);
+ height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
+ assertEquals(height, 300, format(MSG_SUGGESTION_BOX_HEIGHT_PREFORMATTED, 300));
- selenium.type(LOC_FIRST_HEIGHT_INPUT, "176"); // 176 -> 200
- waitFor(1500);
- height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
- assertEquals(height, 200, String.format(MSG_SUGGESTION_BOX_HEIGHT, 176));
- }
+ selenium.type(LOC_FIRST_HEIGHT_INPUT, "400"); // 400 -> 300
+ waitFor(1500);
+ height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
+ assertEquals(height, 300, format(MSG_SUGGESTION_BOX_HEIGHT_PREFORMATTED, 400));
- /**
- * Tests the "Shadow Depth" slider. It tests values 3, 5, 6, and 7. It test both top and left offset.
- */
- @Test
- public void testShadowDepth() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ selenium.type(LOC_FIRST_HEIGHT_INPUT, "176"); // 176 -> 200
+ waitFor(1500);
+ height = getValue(LOC_FIRST_HEIGHT_STYLE, "height");
+ assertEquals(height, 200, format(MSG_SUGGESTION_BOX_HEIGHT_PREFORMATTED, 176));
+ }
- selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "3");
- waitFor(1500);
- int top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
- assertEquals(top, 3, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 3));
- int left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
- assertEquals(left, 3, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 3));
+ /**
+ * Tests the "Shadow Depth" slider. It tests values 3, 5, 6, and 7. It test
+ * both top and left offset.
+ */
+ @Test
+ public void testShadowDepth() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "5");
- waitFor(1500);
- top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
- assertEquals(top, 5, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 5));
- left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
- assertEquals(left, 5, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 5));
+ selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "3");
+ waitFor(1500);
+ int top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
+ assertEquals(top, 3, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 3));
+ int left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
+ assertEquals(left, 3, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 3));
- selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "6");
- waitFor(1500);
- top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
- assertEquals(top, 6, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 6));
- left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
- assertEquals(left, 6, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 6));
+ selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "5");
+ waitFor(1500);
+ top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
+ assertEquals(top, 5, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 5));
+ left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
+ assertEquals(left, 5, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 5));
- selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "7"); // 7 -> 6
- waitFor(1500);
- top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
- assertEquals(top, 6, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 7));
- left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
- assertEquals(left, 6, String.format(MSG_SUGGESTION_BOX_SHADOW_DEPTH, 7));
- }
+ selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "6");
+ waitFor(1500);
+ top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
+ assertEquals(top, 6, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 6));
+ left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
+ assertEquals(left, 6, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 6));
- /**
- * Tests the "Shadow Opacity" slider. It tests values 1, 5, 9, and 11.
- */
- @Test
- public void testShadowOpacity() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ selenium.type(LOC_FIRST_SHADOW_DEPTH_INPUT, "7"); // 7 -> 6
+ waitFor(1500);
+ top = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "top");
+ assertEquals(top, 6, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 7));
+ left = getValue(LOC_FIRST_SHADOW_DEPTH_STYLE, "left");
+ assertEquals(left, 6, format(MSG_SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED, 7));
+ }
- selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "1");
- waitFor(1500);
- double opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
- assertEquals(opacity, 0.1, String.format(
- MSG_SUGGESTION_BOX_SHADOW_OPACITY, 1));
+ /**
+ * Tests the "Shadow Opacity" slider. It tests values 1, 5, 9, and 11.
+ */
+ @Test
+ public void testShadowOpacity() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "5");
- waitFor(1500);
- opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
- assertEquals(opacity, 0.5, String.format(
- MSG_SUGGESTION_BOX_SHADOW_OPACITY, 5));
+ selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "1");
+ waitFor(1500);
+ double opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
+ assertEquals(opacity, 0.1, format(MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED, 1));
- selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "9");
- waitFor(1500);
- opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
- assertEquals(opacity, 0.9, String.format(
- MSG_SUGGESTION_BOX_SHADOW_OPACITY, 9));
+ selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "5");
+ waitFor(1500);
+ opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
+ assertEquals(opacity, 0.5, format(MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED, 5));
- selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "11"); // 11 -> 9
- waitFor(1500);
- opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
- assertEquals(opacity, 0.9, String.format(
- MSG_SUGGESTION_BOX_SHADOW_OPACITY, 11));
- }
+ selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "9");
+ waitFor(1500);
+ opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
+ assertEquals(opacity, 0.9, format(MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED, 9));
- /**
- * Tests the "Cellpadding" slider. It tests values 1, 10, 20, and 25.
- */
- @Test
- public void testCellpadding() {
- scrollIntoView(LOC_FIRST_INPUT, true);
+ selenium.type(LOC_FIRST_SHADOW_OPACITY_INPUT, "11"); // 11 -> 9
+ waitFor(1500);
+ opacity = getOpacity(LOC_FIRST_SHADOW_OPACITY_STYLE);
+ assertEquals(opacity, 0.9, format(MSG_SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED, 11));
+ }
- selenium.type(LOC_FIRST_CELLPADDING_INPUT, "1");
- waitFor(1500);
- int cellpadding = Integer.parseInt(selenium
- .getAttribute(LOC_FIRST_CELLPADDING));
- assertEquals(cellpadding, 1, String.format(
- MSG_SUGGESTION_BOX_CELLPADDING, 1));
+ /**
+ * Tests the "Cellpadding" slider. It tests values 1, 10, 20, and 25.
+ */
+ @Test
+ public void testCellpadding() {
+ scrollIntoView(LOC_FIRST_INPUT, true);
- selenium.type(LOC_FIRST_CELLPADDING_INPUT, "10");
- waitFor(1500);
- cellpadding = Integer.parseInt(selenium
- .getAttribute(LOC_FIRST_CELLPADDING));
- assertEquals(cellpadding, 10, String.format(
- MSG_SUGGESTION_BOX_CELLPADDING, 10));
+ selenium.type(LOC_FIRST_CELLPADDING_INPUT, "1");
+ waitFor(1500);
+ int cellpadding = Integer.parseInt(selenium.getAttribute(LOC_FIRST_CELLPADDING));
+ assertEquals(cellpadding, 1, format(MSG_SUGGESTION_BOX_CELLPADDING_PREFORMATTED, 1));
- selenium.type(LOC_FIRST_CELLPADDING_INPUT, "20");
- waitFor(1500);
- cellpadding = Integer.parseInt(selenium
- .getAttribute(LOC_FIRST_CELLPADDING));
- assertEquals(cellpadding, 20, String.format(
- MSG_SUGGESTION_BOX_CELLPADDING, 20));
+ selenium.type(LOC_FIRST_CELLPADDING_INPUT, "10");
+ waitFor(1500);
+ cellpadding = Integer.parseInt(selenium.getAttribute(LOC_FIRST_CELLPADDING));
+ assertEquals(cellpadding, 10, format(MSG_SUGGESTION_BOX_CELLPADDING_PREFORMATTED, 10));
- selenium.type(LOC_FIRST_CELLPADDING_INPUT, "25"); // 25 -> 20
- waitFor(1500);
- cellpadding = Integer.parseInt(selenium
- .getAttribute(LOC_FIRST_CELLPADDING));
- assertEquals(cellpadding, 20, String.format(
- MSG_SUGGESTION_BOX_CELLPADDING, 25));
- }
+ selenium.type(LOC_FIRST_CELLPADDING_INPUT, "20");
+ waitFor(1500);
+ cellpadding = Integer.parseInt(selenium.getAttribute(LOC_FIRST_CELLPADDING));
+ assertEquals(cellpadding, 20, format(MSG_SUGGESTION_BOX_CELLPADDING_PREFORMATTED, 20));
- /**
- * Tests the button with arrow in the second example. It checks that there are 50 suggestions.
- */
- @Test
- void testSecondExampleButton() {
- scrollIntoView(LOC_SECOND_INPUT, true);
+ selenium.type(LOC_FIRST_CELLPADDING_INPUT, "25"); // 25 -> 20
+ waitFor(1500);
+ cellpadding = Integer.parseInt(selenium.getAttribute(LOC_FIRST_CELLPADDING));
+ assertEquals(cellpadding, 20, format(MSG_SUGGESTION_BOX_CELLPADDING_PREFORMATTED, 25));
+ }
- selenium.click(LOC_SECOND_BUTTON);
- waitForElement(LOC_SECOND_SUGGESTION_LINES);
+ /**
+ * Tests the button with arrow in the second example. It checks that there
+ * are 50 suggestions.
+ */
+ @Test
+ void testSecondExampleButton() {
+ scrollIntoView(LOC_SECOND_INPUT, true);
- int count = selenium.getXpathCount(LOC_SECOND_SUGGESTION_LINES)
- .intValue();
- assertEquals(count, 50, MSG_COUNT_OF_ALL_SUGGESTIONS);
- }
+ selenium.click(LOC_SECOND_BUTTON);
+ waitForElement(LOC_SECOND_SUGGESTION_LINES);
- /**
- * Tests inputting one city in the second example. It presses 'a' and clicks on the second suggestion.
- */
- @Test
- public void testSecondExampleOneCity() {
- scrollIntoView(LOC_SECOND_INPUT, true);
+ int count = selenium.getXpathCount(LOC_SECOND_SUGGESTION_LINES).intValue();
+ assertEquals(count, 50, MSG_COUNT_OF_ALL_SUGGESTIONS);
+ }
- selenium.typeKeys(LOC_SECOND_INPUT, "a");
- waitForElement(String.format(LOC_SECOND_SUGGESTION_BOX_N, 2));
- selenium.click(String.format(LOC_SECOND_SUGGESTION_BOX_N, 2)); // Augusta
+ /**
+ * Tests inputting one city in the second example. It presses 'a' and clicks
+ * on the second suggestion.
+ */
+ @Test
+ public void testSecondExampleOneCity() {
+ scrollIntoView(LOC_SECOND_INPUT, true);
- String state = selenium.getText(LOC_SECOND_STATE);
- assertEquals(state, "Maine", MSG_AUGUSTA_MAINE);
- }
+ selenium.typeKeys(LOC_SECOND_INPUT, "a");
+ waitForElement(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 2));
+ selenium.click(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 2)); // Augusta
- /**
- * Tests inputting two cities separated by a comma in the second example. It presses 'a', clicks
- * on the second suggestion, presses ',' and 'm' and clicks on the third suggestion (Augusta and Madison).
- * Then it checks that states belonging to these cities are shown below the combo box.
- */
- @Test
- public void testSecondExampleMoreCities() {
- scrollIntoView(LOC_SECOND_INPUT, true);
-
- selenium.typeKeys(LOC_SECOND_INPUT, "a");
- waitForElement(String.format(LOC_SECOND_SUGGESTION_BOX_N, 2));
- selenium.click(String.format(LOC_SECOND_SUGGESTION_BOX_N, 2)); // Augusta
+ String state = selenium.getText(LOC_SECOND_STATE);
+ assertEquals(state, "Maine", MSG_AUGUSTA_MAINE);
+ }
- selenium.typeKeys(LOC_SECOND_INPUT, ",m");
- waitForTextEquals(String.format(LOC_SECOND_SUGGESTION_BOX_N, 3),
- "Madison");
- selenium.click(String.format(LOC_SECOND_SUGGESTION_BOX_N, 3)); // Madison
+ /**
+ * Tests inputting two cities separated by a comma in the second example. It
+ * presses 'a', clicks on the second suggestion, presses ',' and 'm' and
+ * clicks on the third suggestion (Augusta and Madison). Then it checks that
+ * states belonging to these cities are shown below the combo box.
+ */
+ @Test
+ public void testSecondExampleMoreCities() {
+ scrollIntoView(LOC_SECOND_INPUT, true);
- waitFor(700);
- String state = selenium.getText(LOC_SECOND_STATE);
- assertEquals(state, "Maine,Wisconsin",
- MSG_AUGUSTA_MADISON_MAINE_WISCONSIN);
- }
+ selenium.typeKeys(LOC_SECOND_INPUT, "a");
+ waitForElement(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 2));
+ selenium.click(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 2)); // Augusta
- /**
- * Tests the "View Page Source" in the first example. It checks that the source
- * code is not visible, clicks on the link, and checks 10 lines of source
- * code.
+ selenium.typeKeys(LOC_SECOND_INPUT, ",m");
+ waitForTextEquals(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 3), "Madison");
+ selenium.click(format(LOC_SECOND_SUGGESTION_BOX_PREFORMATTED, 3)); // Madison
+
+ waitFor(700);
+ String state = selenium.getText(LOC_SECOND_STATE);
+ assertEquals(state, "Maine,Wisconsin", MSG_AUGUSTA_MADISON_MAINE_WISCONSIN);
+ }
+
+ /**
+ * Tests the "View Page Source" in the first example. It checks that the
+ * source code is not visible, clicks on the link, and checks 10 lines of
+ * source code.
*/
@Test
public void testFirstExamplePageSource() {
- String[] strings = new String[] { "<ui:composition xmlns=\"http://www.w3.org/1999/xhtml\"",
+ String[] strings = new String[] { "<ui:composition xmlns=\"http://www.w3.org/1999/xhtml\"",
"<script type=\"text/javascript\">//<![CDATA[",
"\"<tr><td>State</td><td>1st City</td><td>2nd City</td><td>3rd City</td></tr>\" +",
"vertical-align: top;",
@@ -418,30 +418,27 @@
"<rich:suggestionbox id=\"suggestionBoxId\" for=\"text\" tokens=\",[]\"",
" rules=\"#{suggestionBox.rules}\"",
"suggestionAction=\"#{capitalsBean.autocomplete}\" var=\"result\"",
- "height=\"#{suggestionBox.height}\"",
- "nothingLabel=\"No capitals found\" columnClasses=\"center\"",
- };
+ "height=\"#{suggestionBox.height}\"", "nothingLabel=\"No capitals found\" columnClasses=\"center\"", };
abstractTestSource(1, "View Page Source", strings);
}
/**
- * Tests the "View CapitalsBean.java Source" in the first example. It checks that the source
- * code is not visible, clicks on the link, and checks 8 lines of source
- * code.
+ * Tests the "View CapitalsBean.java Source" in the first example. It checks
+ * that the source code is not visible, clicks on the link, and checks 8
+ * lines of source code.
*/
@Test
public void testFirstExampleBeanSource() {
- String[] strings = new String[] {
- "package org.richfaces.demo.capitals;",
- "import javax.faces.FacesException;",
- "public class CapitalsBean {",
- "public List<Capital> autocomplete(Object suggest) {",
- "if ((elem.getName() != null && elem.getName().toLowerCase().indexOf(pref.toLowerCase()) == 0) || \"\".equals(pref))",
- "URL rulesUrl = getClass().getResource(\"capitals-rules.xml\");",
- "digester.parse(getClass().getResourceAsStream(\"capitals.xml\"));",
- "public ArrayList<Capital> getCapitals() {",
- };
+ String[] strings = new String[] {
+ "package org.richfaces.demo.capitals;",
+ "import javax.faces.FacesException;",
+ "public class CapitalsBean {",
+ "public List<Capital> autocomplete(Object suggest) {",
+ "if ((elem.getName() != null && elem.getName().toLowerCase().indexOf(pref.toLowerCase()) == 0) || \"\".equals(pref))",
+ "URL rulesUrl = getClass().getResource(\"capitals-rules.xml\");",
+ "digester.parse(getClass().getResourceAsStream(\"capitals.xml\"));",
+ "public ArrayList<Capital> getCapitals() {", };
abstractTestSource(1, "View CapitalsBean.java Source", strings);
}
@@ -453,7 +450,7 @@
*/
@Test
public void testSecondExamplePageSource() {
- String[] strings = new String[] {
+ String[] strings = new String[] {
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">",
"<h:form id=\"form\">",
"<h:panelGrid columns=\"2\">",
@@ -461,42 +458,49 @@
"usingSuggestObjects=\"true\"",
"onobjectchange=\"printObjectsSelected(#{rich:element('objects')}, #{rich:component('suggestion')});\"",
"suggestionAction=\"#{capitalsBean.autocomplete}\" var=\"cap\"",
- "for=\"statesinput\" fetchValue=\"#{cap.name}\" id=\"suggestion\" tokens=\",\">",
- };
+ "for=\"statesinput\" fetchValue=\"#{cap.name}\" id=\"suggestion\" tokens=\",\">", };
abstractTestSource(2, "View Source", strings);
}
-
- /**
- * Pulls out the value of the specified attribute from the specified location.
- * @param loc an attribute locator
- * @param attr an 'subattribute' whose value we want (e.g. <div style="left: 4px;"/>, then loc=//div@style and attr=left
- * @return the value of the subattribute
- */
- private int getValue(String loc, String attr) {
- String tmp = selenium.getAttribute(loc);
- int firstIdx = tmp.indexOf(attr) + 2 + attr.length();
- int secondIdx = tmp.indexOf("px;", firstIdx);
- return Integer.parseInt(tmp.substring(firstIdx, secondIdx));
- }
- /**
- * Pulls out opacity from the specified attribute.
- * @param loc an attribute locator
- * @return the value of opacity
- */
- private double getOpacity(String loc) {
- String tmp = selenium.getAttribute(loc);
- int firstIdx = tmp.indexOf("opacity") + 9;
- int secondIdx = tmp.indexOf(";", firstIdx);
- return Double.parseDouble(tmp.substring(firstIdx, secondIdx));
- }
+ /**
+ * Pulls out the value of the specified attribute from the specified
+ * location.
+ *
+ * @param loc
+ * an attribute locator
+ * @param attr
+ * an 'subattribute' whose value we want (e.g. <div
+ * style="left: 4px;"/>, then loc=//div@style and attr=left
+ * @return the value of the subattribute
+ */
+ private int getValue(String loc, String attr) {
+ String tmp = selenium.getAttribute(loc);
+ int firstIdx = tmp.indexOf(attr) + 2 + attr.length();
+ int secondIdx = tmp.indexOf("px;", firstIdx);
+ return Integer.parseInt(tmp.substring(firstIdx, secondIdx));
+ }
- /**
- * Loads the page containing the calendar component.
- */
- @BeforeMethod
- private void loadPage() {
- super.loadPage("richInputs", 10, 1, MSG_COMPONENT_DESCRIPTION);
- }
+ /**
+ * Pulls out opacity from the specified attribute.
+ *
+ * @param loc
+ * an attribute locator
+ * @return the value of opacity
+ */
+ private double getOpacity(String loc) {
+ String tmp = selenium.getAttribute(loc);
+ int firstIdx = tmp.indexOf("opacity") + 9;
+ int secondIdx = tmp.indexOf(";", firstIdx);
+ return Double.parseDouble(tmp.substring(firstIdx, secondIdx));
+ }
+
+ /**
+ * Loads the page containing the calendar component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Suggestion Box");
+ }
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tabPanel/TabPanelTestCase.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tabPanel/TabPanelTestCase.java 2009-09-08 14:43:30 UTC (rev 15494)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/tabPanel/TabPanelTestCase.java 2009-09-08 14:54:18 UTC (rev 15495)
@@ -1,3 +1,21 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
package org.jboss.richfaces.integrationTest.tabPanel;
import static org.testng.Assert.assertEquals;
@@ -5,6 +23,7 @@
import static org.testng.Assert.assertTrue;
import org.jboss.richfaces.integrationTest.AbstractSeleniumRichfacesTestCase;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -16,176 +35,165 @@
*/
public class TabPanelTestCase extends AbstractSeleniumRichfacesTestCase {
- // messages -- Usage
- private final String MSG_USAGE_COMPONENT_DESCRIPTION = getMess("USAGE_COMPONENT_DESCRIPTION");
- private final String MSG_USAGE_CONTENT_OF_PANEL_N = getMess("USAGE_CONTENT_OF_PANEL_N");
- private final String MSG_USAGE_SECOND_TAB_SHOULD_BE_DISABLED = getMess("USAGE_SECOND_TAB_SHOULD_BE_DISABLED");
+ // messages
+ private final String MSG_USAGE_CONTENT_OF_PANEL_PREFORMATTED = getMsg("USAGE_CONTENT_OF_PANEL_PREFORMATTED");
+ private final String MSG_USAGE_SECOND_TAB_SHOULD_BE_DISABLED = getMsg("USAGE_SECOND_TAB_SHOULD_BE_DISABLED");
+ private final String MSG_CUST_TABS_RIGHT_ALIGNED = getMsg("CUST_TABS_RIGHT_ALIGNED");
+ private final String MSG_DELET_NUMBER_OF_TABS = getMsg("DELET_NUMBER_OF_TABS");
- // messages -- Look Customization
- private final String MSG_CUST_COMPONENT_DESCRIPTION = getMess("CUST_COMPONENT_DESCRIPTION");
- private final String MSG_CUST_TABS_RIGHT_ALIGNED = getMess("CUST_TABS_RIGHT_ALIGNED");
+ // locators
+ private final String LOC_USAGE_EXAMPLE_HEADER = getLoc("USAGE_EXAMPLE_HEADER");
+ private final String LOC_USAGE_PANEL_TAB_PREFORMATTED = getLoc("USAGE_PANEL_TAB_PREFORMATTED");
+ private final String LOC_USAGE_PANEL_TEXT_PREFORMATTED = getLoc("USAGE_PANEL_TEXT_PREFORMATTED");
+ private final String LOC_USAGE_PANEL_3_TEXT_PREFORMATTED = getLoc("USAGE_PANEL_3_TEXT_PREFORMATTED");
- // messages -- Tabs Deletion
- private final String MSG_DELET_COMPONENT_DESCRIPTION = getMess("DELET_COMPONENT_DESCRIPTION");
- private final String MSG_DELET_NUMBER_OF_TABS = getMess("DELET_NUMBER_OF_TABS");
+ private final String LOC_CUST_EXAMPLE_HEADER = getLoc("CUST_EXAMPLE_HEADER");
+ private final String LOC_CUST_TABS_ALIGN = getLoc("CUST_TABS_ALIGN");
+ private final String LOC_CUST_PANEL_TEXT_PREFORMATTED = getLoc("CUST_PANEL_TEXT_PREFORMATTED");
+ private final String LOC_CUST_PANEL_TAB_PREFORMATTED = getLoc("CUST_PANEL_TAB_PREFORMATTED");
- // locators -- Usage
- private final String LOC_USAGE_EXAMPLE_HEADER = getLoc("USAGE_EXAMPLE_HEADER");
- private final String LOC_USAGE_PANEL_N_TAB_M = getLoc("USAGE_PANEL_N_TAB_M");
- private final String LOC_USAGE_PANEL_N_TEXT = getLoc("USAGE_PANEL_N_TEXT");
- private final String LOC_USAGE_PANEL_3_N_TEXT = getLoc("USAGE_PANEL_3_N_TEXT");
+ private final String LOC_DELET_EXAMPLE_HEADER = getLoc("DELET_EXAMPLE_HEADER");
+ private final String LOC_DELET_PANEL_TABS = getLoc("DELET_PANEL_TABS");
+ private final String LOC_DELET_PANEL_TAB_CLOSE_PREFORMATTED = getLoc("DELET_PANEL_TAB_CLOSE_PREFORMATTED");
+ private final String LOC_DELET_RESET_BUTTON = getLoc("DELET_RESET_BUTTON");
- // locators -- Look Customization
- private final String LOC_CUST_EXAMPLE_HEADER = getLoc("CUST_EXAMPLE_HEADER");
- private final String LOC_CUST_TABS_ALIGN = getLoc("CUST_TABS_ALIGN");
- private final String LOC_CUST_PANEL_TEXT = getLoc("CUST_PANEL_TEXT");
- private final String LOC_CUST_PANEL_TAB_N = getLoc("CUST_PANEL_TAB_N");
+ /**
+ * Tests three tab panels from the usage tab. It click on each tab and
+ * verifies that the content of panel changed appropriately.
+ */
+ @Test
+ public void testTabPanelExample() {
+ openTab("Usage");
+ String text;
- // locators -- Tabs Deletion
- private final String LOC_DELET_EXAMPLE_HEADER = getLoc("DELET_EXAMPLE_HEADER");
- private final String LOC_DELET_PANEL_TABS = getLoc("DELET_PANEL_TABS");
- private final String LOC_DELET_PANEL_TAB_N_CLOSE = getLoc("DELET_PANEL_TAB_N_CLOSE");
- private final String LOC_DELET_RESET_BUTTON = getLoc("DELET_RESET_BUTTON");
+ // test the first tab panel
+ for (int i = 3; i > 0; i--) {
+ scrollIntoView(LOC_USAGE_EXAMPLE_HEADER, true); // scrolling is
+ // forgotten after
+ // page reload
+ selenium.click(format(LOC_USAGE_PANEL_TAB_PREFORMATTED, 1, i));
+ waitFor(2000);
+ text = selenium.getText(format(LOC_USAGE_PANEL_TEXT_PREFORMATTED, 1));
+ assertEquals(text, "Here is tab #" + i, format(MSG_USAGE_CONTENT_OF_PANEL_PREFORMATTED, 1));
+ }
- /**
- * Tests three tab panels from the usage tab. It click on each tab and
- * verifies that the content of panel changed appropriately.
- */
- @Test
- public void testTabPanelExample() {
- super.loadPage("richOutputs", 10, 1, MSG_USAGE_COMPONENT_DESCRIPTION);
- String text;
+ // test the second tab panel
+ scrollIntoView(LOC_USAGE_EXAMPLE_HEADER, true);
+ selenium.click(format(LOC_USAGE_PANEL_TAB_PREFORMATTED, 2, 3));
+ waitFor(2000);
+ text = selenium.getText(format(LOC_USAGE_PANEL_TEXT_PREFORMATTED, 2));
+ assertEquals(text, "Here is tab #" + 3, format(MSG_USAGE_CONTENT_OF_PANEL_PREFORMATTED, 2));
- // test the first tab panel
- for (int i = 3; i > 0; i--) {
- scrollIntoView(LOC_USAGE_EXAMPLE_HEADER, true); // scrolling is
- // forgotten after
- // page reload
- selenium.click(String.format(LOC_USAGE_PANEL_N_TAB_M, 1, i));
- waitFor(2000);
- text = selenium.getText(String.format(LOC_USAGE_PANEL_N_TEXT, 1));
- assertEquals(text, "Here is tab #" + i, String.format(
- MSG_USAGE_CONTENT_OF_PANEL_N, 1));
- }
+ selenium.click(format(LOC_USAGE_PANEL_TAB_PREFORMATTED, 2, 1));
+ waitFor(2000);
+ text = selenium.getText(format(LOC_USAGE_PANEL_TEXT_PREFORMATTED, 2));
+ assertEquals(text, "Here is tab #" + 1, format(MSG_USAGE_CONTENT_OF_PANEL_PREFORMATTED, 2));
- // test the second tab panel
- scrollIntoView(LOC_USAGE_EXAMPLE_HEADER, true);
- selenium.click(String.format(LOC_USAGE_PANEL_N_TAB_M, 2, 3));
- waitFor(2000);
- text = selenium.getText(String.format(LOC_USAGE_PANEL_N_TEXT, 2));
- assertEquals(text, "Here is tab #" + 3, String.format(
- MSG_USAGE_CONTENT_OF_PANEL_N, 2));
+ // test the disabled tab
+ boolean isEnabled = true;
+ try {
+ isEnabled = belongsClass("rich-tab-diabled", format(LOC_USAGE_PANEL_TAB_PREFORMATTED, 2, 2));
+ assertFalse(isEnabled, MSG_USAGE_SECOND_TAB_SHOULD_BE_DISABLED);
+ } catch (Exception e) {
+ // OK - there is no class attribute
+ }
+ selenium.click(format(LOC_USAGE_PANEL_TAB_PREFORMATTED, 2, 2));
+ waitFor(2000);
+ text = selenium.getText(format(LOC_USAGE_PANEL_TEXT_PREFORMATTED, 2));
+ assertEquals(text, "Here is tab #1", format(MSG_USAGE_CONTENT_OF_PANEL_PREFORMATTED, 2));
- selenium.click(String.format(LOC_USAGE_PANEL_N_TAB_M, 2, 1));
- waitFor(2000);
- text = selenium.getText(String.format(LOC_USAGE_PANEL_N_TEXT, 2));
- assertEquals(text, "Here is tab #" + 1, String.format(
- MSG_USAGE_CONTENT_OF_PANEL_N, 2));
+ // test the third tab panel -- client type work different
+ scrollIntoView(LOC_USAGE_EXAMPLE_HEADER, true);
+ for (int i = 3; i > 0; i--) {
+ selenium.click(format(LOC_USAGE_PANEL_TAB_PREFORMATTED, 3, i));
+ waitFor(2000);
+ for (int j = 1; j < 4; j++) {
+ if (i == j) {
+ assertTrue(isDisplayed(format(LOC_USAGE_PANEL_3_TEXT_PREFORMATTED, j)));
+ } else {
+ assertFalse(isDisplayed(format(LOC_USAGE_PANEL_3_TEXT_PREFORMATTED, j)));
+ }
+ }
+ }
+ }
- // test the disabled tab
- boolean isEnabled = true;
- try {
- selenium.getAttribute(
- String.format(LOC_USAGE_PANEL_N_TAB_M, 2, 2) + "@class")
- .contains("rich-tab-diabled");
- assertFalse(isEnabled, MSG_USAGE_SECOND_TAB_SHOULD_BE_DISABLED);
- } catch (Exception e) {
- // OK - there is no class attribute
- }
- selenium.click(String.format(LOC_USAGE_PANEL_N_TAB_M, 2, 2));
- waitFor(2000);
- text = selenium.getText(String.format(LOC_USAGE_PANEL_N_TEXT, 2));
- assertEquals(text, "Here is tab #1", String.format(
- MSG_USAGE_CONTENT_OF_PANEL_N, 2));
+ /**
+ * Tests tab panel customization. It clicks every tab and verifies that the
+ * content of panel changed. Then it checks that the tabs are aligned to the
+ * right.
+ */
+ @Test
+ public void testCustomization() {
+ openTab("Look Customization");
+ scrollIntoView(LOC_CUST_EXAMPLE_HEADER, true);
+ String text;
- // test the third tab panel -- client type work different
- scrollIntoView(LOC_USAGE_EXAMPLE_HEADER, true);
- for (int i = 3; i > 0; i--) {
- selenium.click(String.format(LOC_USAGE_PANEL_N_TAB_M, 3, i));
- waitFor(2000);
- for (int j = 1; j < 4; j++) {
- if (i == j) {
- assertTrue(isDisplayed(String.format(
- LOC_USAGE_PANEL_3_N_TEXT, j)));
- } else {
- assertFalse(isDisplayed(String.format(
- LOC_USAGE_PANEL_3_N_TEXT, j)));
- }
- }
- }
- }
+ for (int i = 3; i > 0; i--) {
+ selenium.click(format(LOC_CUST_PANEL_TAB_PREFORMATTED, i));
+ waitFor(2000);
+ for (int j = 1; j < 4; j++) {
+ if (i == j) {
+ waitFor(5000);
+ assertTrue(isDisplayed(format(LOC_CUST_PANEL_TEXT_PREFORMATTED, j)), format(
+ "Tab nr. {0} should be open.", j));
+ } else {
+ assertFalse(isDisplayed(format(LOC_CUST_PANEL_TEXT_PREFORMATTED, j)), format(
+ "Tab nr. {0} should not be open.", j));
+ }
+ }
+ }
- /**
- * Tests tab panel customization. It clicks every tab and verifies that the
- * content of panel changed. Then it checks that the tabs are aligned to the
- * right.
- */
- @Test
- public void testCustomization() {
- super.loadPage("richOutputs", 10, 2, MSG_CUST_COMPONENT_DESCRIPTION);
- scrollIntoView(LOC_CUST_EXAMPLE_HEADER, true);
+ text = selenium.getAttribute(LOC_CUST_TABS_ALIGN);
+ assertEquals(text, "right", MSG_CUST_TABS_RIGHT_ALIGNED);
+ }
- String text;
+ /**
+ * Tests tabs deletion. First it check that there are 3 tabs, then deletes
+ * the third, the second, and the first tab. After each deletion it verifies
+ * the number of remaining tabs. In the end it clicks the reset button and
+ * checks that all tabs were restored.
+ */
+ @Test
+ public void testTabsDeletion() {
+ openTab("Tabs Deletion");
+ scrollIntoView(LOC_DELET_EXAMPLE_HEADER, true);
- for (int i = 3; i > 0; i--) {
- selenium.click(String.format(LOC_CUST_PANEL_TAB_N, i));
- waitFor(2000);
- for (int j = 1; j < 4; j++) {
- if (i == j) {
- assertTrue(isDisplayed(String
- .format(LOC_CUST_PANEL_TEXT, j)));
- } else {
- assertFalse(isDisplayed(String.format(LOC_CUST_PANEL_TEXT,
- j)));
- }
- }
- }
+ int count = selenium.getXpathCount(LOC_DELET_PANEL_TABS).intValue();
+ assertEquals(count - 4, 3, MSG_DELET_NUMBER_OF_TABS);
- text = selenium.getAttribute(LOC_CUST_TABS_ALIGN);
- assertEquals(text, "right", MSG_CUST_TABS_RIGHT_ALIGNED);
- }
+ for (int i = 3; i > 0; i--) {
+ selenium.click(format(LOC_DELET_PANEL_TAB_CLOSE_PREFORMATTED, i));
+ waitFor(2000);
+ count = selenium.getXpathCount(LOC_DELET_PANEL_TABS).intValue();
+ assertEquals(count / 2, i - 1, MSG_DELET_NUMBER_OF_TABS);
+ }
- /**
- * Tests tabs deletion. First it check that there are 3 tabs, then deletes
- * the third, the second, and the first tab. After each deletion it verifies
- * the number of remaining tabs. In the end it clicks the reset button and
- * checks that all tabs were restored.
- */
- @Test
- public void testTabsDeletion() {
- super.loadPage("richOutputs", 10, 3, MSG_DELET_COMPONENT_DESCRIPTION);
- scrollIntoView(LOC_DELET_EXAMPLE_HEADER, true);
+ selenium.click(LOC_DELET_RESET_BUTTON);
+ waitFor(2000);
+ count = selenium.getXpathCount(LOC_DELET_PANEL_TABS).intValue();
+ assertEquals(count - 4, 3, MSG_DELET_NUMBER_OF_TABS);
+ }
- int count = selenium.getXpathCount(LOC_DELET_PANEL_TABS).intValue();
- assertEquals(count - 4, 3, MSG_DELET_NUMBER_OF_TABS);
+ /**
+ * Tests the "View Source". It checks that the source code is not visible,
+ * clicks on the link, and checks 5 lines of source code.
+ */
+ @Test
+ public void testUsageTabExampleSource() {
+ String[] strings = new String[] { "<ui:composition xmlns=\"http://www.w3.org/1999/xhtml\"", "<rich:tabPanel>",
+ "<rich:tab label=\"First\">", "Here is tab #2", "<rich:tabPanel switchType=\"ajax\">",
+ "<rich:tab label=\"Second\" disabled=\"true\">", "<rich:tabPanel switchType=\"client\">", };
- for (int i = 3; i > 0; i--) {
- selenium.click(String.format(LOC_DELET_PANEL_TAB_N_CLOSE, i));
- waitFor(2000);
- count = selenium.getXpathCount(LOC_DELET_PANEL_TABS).intValue();
- assertEquals(count / 2, i - 1, MSG_DELET_NUMBER_OF_TABS);
- }
+ abstractTestSource(1, "View Source", strings);
+ }
- selenium.click(LOC_DELET_RESET_BUTTON);
- waitFor(2000);
- count = selenium.getXpathCount(LOC_DELET_PANEL_TABS).intValue();
- assertEquals(count - 4, 3, MSG_DELET_NUMBER_OF_TABS);
- }
+ /**
+ * Loads the page containing the calendar component.
+ */
+ @SuppressWarnings("unused")
+ @BeforeMethod
+ private void loadPage() {
+ openComponent("Tab Panel");
+ }
- /**
- * Tests the "View Source". It checks that the source code is not visible,
- * clicks on the link, and checks 5 lines of source code.
- */
- @Test
- public void testUsageTabExampleSource() {
- String[] strings = new String[] {
- "<ui:composition xmlns=\"http://www.w3.org/1999/xhtml\"",
- "<rich:tabPanel>", "<rich:tab label=\"First\">",
- "Here is tab #2", "<rich:tabPanel switchType=\"ajax\">",
- "<rich:tab label=\"Second\" disabled=\"true\">",
- "<rich:tabPanel switchType=\"client\">", };
-
- abstractTestSource(1, "View Source", strings);
- }
-
}
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/locators.properties 2009-09-08 14:43:30 UTC (rev 15494)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/locators.properties 2009-09-08 14:54:18 UTC (rev 15495)
@@ -1,10 +1,12 @@
EXAMPLE_1_HEADER=//fieldset[1]/legend
EXAMPLE_2_HEADER=//fieldset[2]/legend
-FIRST_EXAMPLE_HEADER=//fieldset[legend/text()='Simple Toggle Panel example']//div[@class='rich-stglpanel-header']
-FIRST_EXAMPLE_ARROWS_LEFT_RELATIVE_TO_HEADER={0}//div[@class='rich-stglpnl-marker' and contains(@id,'switch_on')]
-FIRST_EXAMPLE_ARROWS_RIGHT_RELATIVE_TO_HEADER={0}//div[@class='rich-stglpnl-marker' and contains(@id,'switch_off')]
-FIRST_EXAMPLE_BODY=//fieldset[legend/text()='Simple Toggle Panel example']//div[@class='rich-stglpanel-body']
-SECOND_EXAMPLE_N_HEADER=//fieldset[legend/text()\='Switch types example']//td[@class\='tpanels'][%d]//div[@class\='rich-stglpanel-header']
-SECOND_EXAMPLE_N_ARROWS_LEFT_RELATIVE_TO_HEADER={0}//div[@class\='rich-stglpnl-marker' and contains(@id,'switch_on')]
-SECOND_EXAMPLE_N_ARROWS_RIGHT_RELATIVE_TO_HEADER={0}//div[@class\='rich-stglpnl-marker' and contains(@id,'switch_off')]
-SECOND_EXAMPLE_N_BODY=//fieldset[legend/text()\='Switch types example']//td[@class\='tpanels'][%d]//div[@class\='rich-stglpanel-body']
+
+FIRST_EXAMPLE_HEADER=//fieldset[1]//form/div
+FIRST_EXAMPLE_ARROWS_LEFT=//fieldset[1]//div[@class='rich-stglpnl-marker' and contains(@id,'switch_on')]
+FIRST_EXAMPLE_ARROWS_RIGHT=//fieldset[1]//div[@class='rich-stglpnl-marker' and contains(@id,'switch_off')]
+FIRST_EXAMPLE_BODY=//fieldset[1]/div/div[1]/div
+
+SECOND_EXAMPLE_N_HEADER=//fieldset[2]//td[{0}]/div/div[1]
+SECOND_EXAMPLE_N_ARROWS_LEFT=//fieldset[2]//td[{0}]//div[@class\='rich-stglpnl-marker' and contains(@id,'switch_on')]
+SECOND_EXAMPLE_N_ARROWS_RIGHT=//fieldset[2]//td[{0}]//div[@class\='rich-stglpnl-marker' and contains(@id,'switch_off')]
+SECOND_EXAMPLE_N_BODY=//fieldset[2]//td[{0}]/div/div[contains(@class, 'rich-stglpanel-body')]
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/messages.properties 2009-09-08 14:43:30 UTC (rev 15494)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/simpleTogglePanel/messages.properties 2009-09-08 14:54:18 UTC (rev 15495)
@@ -1,10 +1,9 @@
-COMPONENT_DESCRIPTION= SimpleTogglePanel represents a panel with a base text label at the top and additional content
-PANEL_HEADER=Header of the panel should be "%s".
+PANEL_HEADER=Header of the panel should be "{0}".
BODY_SHOULD_BE_VISIBLE=Content of the panel should be visible.
BODY_SHOULD_NOT_BE_VISIBLE=Content of the panel should not be visible.
-LEFT_ARROWS_SHOULD_BE_VISIBLE=Picture with two arrow heading to the left in panel's header should be visible.
-LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE=Picture with two arrow heading to the left in panel's header should not be visible.
-RIGHT_ARROWS_SHOULD_BE_VISIBLE=Picture with two arrow heading to the right in panel's header should be visible.
-RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE=Picture with two arrow heading to the right in panel's header should not be visible.
+LEFT_ARROWS_SHOULD_BE_VISIBLE=Picture with two arrows heading to the left in panel's header should be visible.
+LEFT_ARROWS_SHOULD_NOT_BE_VISIBLE=Picture with two arrows heading to the left in panel's header should not be visible.
+RIGHT_ARROWS_SHOULD_BE_VISIBLE=Picture with two arrows heading to the right in panel's header should be visible.
+RIGHT_ARROWS_SHOULD_NOT_BE_VISIBLE=Picture with two arrows heading to the right in panel's header should not be visible.
Added: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/locators.properties (rev 0)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/locators.properties 2009-09-08 14:54:18 UTC (rev 15495)
@@ -0,0 +1,7 @@
+EXAMPLE_HEADER=//fieldset/legend
+UPPER_SPINNER_INPUT=//fieldset/div/form/table[1]/tbody/tr/td[1]/input
+UPPER_SPINNER_UP=//fieldset/div/form/table[1]/tbody/tr/td[2]/table/tbody/tr[1]/td/input
+UPPER_SPINNER_DOWN=//fieldset/div/form/table[1]/tbody/tr/td[2]/table/tbody/tr[2]/td/input
+LOWER_SPINNER_INPUT=//fieldset/div/form/table[2]/tbody/tr/td[1]/input
+LOWER_SPINNER_UP=//fieldset/div/form/table[2]/tbody/tr/td[2]/table/tbody/tr[1]/td/input
+LOWER_SPINNER_DOWN=//fieldset/div/form/table[2]/tbody/tr/td[2]/table/tbody/tr[2]/td/input
\ No newline at end of file
Added: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/messages.properties (rev 0)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/spinner/messages.properties 2009-09-08 14:54:18 UTC (rev 15495)
@@ -0,0 +1,29 @@
+INITIAL_STATE_UPPER=50
+INITIAL_STATE_LOWER=50
+
+TYPE_TO_UPPER_FIRST_TYPED=20
+TYPE_TO_UPPER_FIRST_EXPECTED=20
+TYPE_TO_UPPER_SECOND_TYPED=2000
+TYPE_TO_UPPER_SECOND_EXPECTED=100
+TYPE_TO_UPPER_THIRD_TYPED=-23
+TYPE_TO_UPPER_THIRD_EXPECTED=0
+TYPE_TO_UPPER_FOURTH_TYPED=34.5
+TYPE_TO_UPPER_FOURTH_EXPECTED=34.5
+TYPE_TO_UPPER_FIFTH_TYPED=aaa
+TYPE_TO_UPPER_FIFTH_EXPECTED=34.5
+
+TYPE_TO_LOWER_FIRST_TYPED=20
+TYPE_TO_LOWER_FIRST_EXPECTED=20
+TYPE_TO_LOWER_SECOND_TYPED=2000
+TYPE_TO_LOWER_SECOND_EXPECTED=100
+TYPE_TO_LOWER_THIRD_TYPED=-23
+TYPE_TO_LOWER_THIRD_EXPECTED=0
+TYPE_TO_LOWER_FOURTH_TYPED=34.5
+TYPE_TO_LOWER_FOURTH_EXPECTED=34.5
+TYPE_TO_LOWER_FIFTH_TYPED=aaa
+TYPE_TO_LOWER_FIFTH_EXPECTED=34.5
+
+OVERFLOW_UPPER=0
+OVERFLOW_LOWER=0
+UNDERFLOW_UPPER=100
+UNDERFLOW_LOWER=100
\ No newline at end of file
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties 2009-09-08 14:43:30 UTC (rev 15494)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/locators.properties 2009-09-08 14:54:18 UTC (rev 15495)
@@ -1,4 +1,4 @@
-FIRST_SUGGESTION_BOX_N=//table[@id='suggestionbox_form:suggestionBoxId:suggest']/tbody/tr[%d]
+FIRST_SUGGESTION_BOX_PREFORMATTED=//table[@id='suggestionbox_form:suggestionBoxId:suggest']/tbody/tr[{0}]
FIRST_INPUT=//fieldset[1]/div/form/table/tbody/tr/td[1]/input[1]
FIRST_BORDER_INPUT=//fieldset[1]/div/form/table/tbody/tr/td[1]/table/tbody/tr[1]/td[2]/table/tbody/tr[1]/td[3]/input
@@ -8,7 +8,7 @@
FIRST_SHADOW_OPACITY_INPUT=//fieldset[1]/div/form/table/tbody/tr/td[1]/table/tbody/tr[5]/td[2]/table/tbody/tr[1]/td[3]/input
FIRST_CELLPADDING_INPUT=//fieldset[1]/div/form/table/tbody/tr/td[1]/table/tbody/tr[6]/td[2]/table/tbody/tr[1]/td[3]/input
-FIRST_TOWN_TABLE_M_N=//fieldset[1]/div/form/table/tbody/tr/td[2]/div/table/tbody/tr[%d]/td[%d]
+FIRST_TOWN_TABLE_PREFORMATTED=//fieldset[1]/div/form/table/tbody/tr/td[2]/div/table/tbody/tr[{0}]/td[{1}]
FIRST_BORDER_STYLE=//div[@id='suggestionbox_form:suggestionBoxId']/div[1]/div@style
FIRST_WIDTH_STYLE=//div[@id='suggestionbox_form:suggestionBoxId']@style
@@ -20,5 +20,5 @@
SECOND_INPUT=//fieldset[2]/div/form/table/tbody/tr[1]/td[2]/table/tbody/tr/td[1]/input
SECOND_BUTTON=//fieldset[2]/div/form/table/tbody/tr[1]/td[2]/table/tbody/tr/td[2]/img
SECOND_SUGGESTION_LINES=//div[@id='form:suggestion']/div[1]/div/table/tbody/tr/td/div/table/tbody/tr
-SECOND_SUGGESTION_BOX_N=//div[@id='form:suggestion']/div[1]/div/table/tbody/tr/td/div/table/tbody/tr[%d]
+SECOND_SUGGESTION_BOX_PREFORMATTED=//div[@id='form:suggestion']/div[1]/div/table/tbody/tr/td/div/table/tbody/tr[{0}]
SECOND_STATE=//fieldset[2]/div/form/table/tbody/tr[2]/td[2]/span
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/messages.properties 2009-09-08 14:43:30 UTC (rev 15494)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/suggestionBox/messages.properties 2009-09-08 14:54:18 UTC (rev 15495)
@@ -1,13 +1,13 @@
COMPONENT_DESCRIPTION=RichFaces Suggestion Box component adds the autocomplete capability to the existing input component
-TABLE_M_N=String in the table on the position [%d,%d].
+TABLE_PREFORMATTED=String in the table on the position [{0},{1}].
NO_CAPITALS_FOUND=There should be no capitals.
-SUGGESTION_BOX_BORDER=Border width of the suggestion box after typing %d.
-SUGGESTION_BOX_WIDTH=Width of the suggestion box after typing %d.
-SUGGESTION_BOX_HEIGHT=Height of the suggestion box after typing %d.
-SUGGESTION_BOX_SHADOW_DEPTH=Depth of the shadow after typing %d.
-SUGGESTION_BOX_SHADOW_OPACITY=Opacity of the shadow after typing %d.
-SUGGESTION_BOX_CELLPADDING=Padding of the suggestion box's cells after typing %d.
+SUGGESTION_BOX_BORDER_PREFORMATTED=Border width of the suggestion box after typing {0}.
+SUGGESTION_BOX_WIDTH_PREFORMATTED=Width of the suggestion box after typing {0}.
+SUGGESTION_BOX_HEIGHT_PREFORMATTED=Height of the suggestion box after typing {0}.
+SUGGESTION_BOX_SHADOW_DEPTH_PREFORMATTED=Depth of the shadow after typing {0}.
+SUGGESTION_BOX_SHADOW_OPACITY_PREFORMATTED=Opacity of the shadow after typing {0}.
+SUGGESTION_BOX_CELLPADDING_PREFORMATTED=Padding of the suggestion box's cells after typing {0}.
COUNT_OF_ALL_SUGGESTIONS=Count of all suggestions.
AUGUSTA_MAINE=Augusta is the capital of Maine.
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/locators.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/locators.properties 2009-09-08 14:43:30 UTC (rev 15494)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/locators.properties 2009-09-08 14:54:18 UTC (rev 15495)
@@ -1,17 +1,17 @@
# first tab
USAGE_EXAMPLE_HEADER=//fieldset/legend
-USAGE_PANEL_N_TEXT=//fieldset/div/table[%d]/tbody/tr[2]/td/table/tbody/tr/td
-USAGE_PANEL_3_N_TEXT=//fieldset/div/table[3]/tbody/tr[2]/td[%d]
-USAGE_PANEL_N_TAB_M=//fieldset/div/table[%d]/tbody/tr[1]/td/form/table/tbody/tr/td[%d*2]/table
+USAGE_PANEL_TEXT_PREFORMATTED=//fieldset/div/table[{0}]/tbody/tr[2]/td/table/tbody/tr/td
+USAGE_PANEL_3_TEXT_PREFORMATTED=//fieldset/div/table[3]/tbody/tr[2]/td[{0}]
+USAGE_PANEL_TAB_PREFORMATTED=//fieldset/div/table[{0}]/tbody/tr[1]/td/form/table/tbody/tr/td[{1}*2]/table
# second tab
CUST_EXAMPLE_HEADER=//div[@id='itme']/p
-CUST_TABS_ALIGN=//table[@class\='rich-tabpanel']/tbody/tr[1]/td@align
-CUST_PANEL_TEXT=//table[@class\='rich-tabpanel']/tbody/tr[2]/td[%d]
-CUST_PANEL_TAB_N=//table[@class\='rich-tabpanel']/tbody/tr[1]/td/form/table/tbody/tr/td[%d*2]/table
+CUST_TABS_ALIGN=//div[@id='itme']//table[contains(@class,'rich-tabpanel')]/tbody/tr[1]/td@align
+CUST_PANEL_TEXT_PREFORMATTED=//div[@id='itme']//table[contains(@class,'rich-tabpanel')]/tbody/tr[2]/td[{0}]
+CUST_PANEL_TAB_PREFORMATTED=//div[@id='itme']//table[contains(@class,'rich-tabpanel')]/tbody/tr[1]/td/form/table/tbody/tr/td[{0}*2]/table
# third tab
DELET_EXAMPLE_HEADER=//form[@id='tabs_form']/../../p
DELET_PANEL_TABS=//table[@id='tabs_form:RemoveAbleTabPanel']/tbody/tr[1]/td/table/tbody/tr/td
-DELET_PANEL_TAB_N_CLOSE=//img[@id='tabs_form:hidelink%d']
+DELET_PANEL_TAB_CLOSE_PREFORMATTED=//img[@id='tabs_form:hidelink{0}']
DELET_RESET_BUTTON=//form[@id\='tabs_form']/input[2]
\ No newline at end of file
Modified: branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/messages.properties
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/messages.properties 2009-09-08 14:43:30 UTC (rev 15494)
+++ branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/tabPanel/messages.properties 2009-09-08 14:54:18 UTC (rev 15495)
@@ -1,12 +1,9 @@
# first tab
-USAGE_COMPONENT_DESCRIPTION=Tab panel is used to create "tabbed" pages.
-USAGE_CONTENT_OF_PANEL_N=Content of tab panel %d.
+USAGE_CONTENT_OF_PANEL_PREFORMATTED=Content of tab panel {0}.
USAGE_SECOND_TAB_SHOULD_BE_DISABLED=The second tab should be disabled.
# second tab
-CUST_COMPONENT_DESCRIPTION=This is a demo of how to use stylesheets and skinnability features in order to adjust tab panel appearance.
CUST_TABS_RIGHT_ALIGNED=Tabs should be aligned to the right.
# third tab
-DELET_COMPONENT_DESCRIPTION=This simple sample is added according to numerous Forum requests and shows how to implement tabs deletion from tabPanel component.
DELET_NUMBER_OF_TABS=Number of tabs in the example.
\ No newline at end of file
15 years, 3 months
JBoss Rich Faces SVN: r15494 - branches/community/3.3.X/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: ochikvina
Date: 2009-09-08 10:43:30 -0400 (Tue, 08 Sep 2009)
New Revision: 15494
Removed:
branches/community/3.3.X/docs/userguide/en/src/main/resources/images/colorPicker_cn.png
branches/community/3.3.X/docs/userguide/en/src/main/resources/images/colorPicker_pc.png
Log:
https://jira.jboss.org/jira/browse/RF-7803 - deleting unnecessary images;
Deleted: branches/community/3.3.X/docs/userguide/en/src/main/resources/images/colorPicker_cn.png
===================================================================
(Binary files differ)
Deleted: branches/community/3.3.X/docs/userguide/en/src/main/resources/images/colorPicker_pc.png
===================================================================
(Binary files differ)
15 years, 3 months
JBoss Rich Faces SVN: r15471 - branches/community/3.3.X/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: atsebro
Date: 2009-09-05 06:47:29 -0400 (Sat, 05 Sep 2009)
New Revision: 15471
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_effect.xml
Log:
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_effect.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_effect.xml 2009-09-04 17:17:33 UTC (rev 15470)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/rich_effect.xml 2009-09-05 10:47:29 UTC (rev 15471)
@@ -1,252 +1,200 @@
<section role="NotInToc" id="rich_effect">
<title>
- <
- rich:effect
- >
- <emphasis role="since">
- <superscript> available since <emphasis role="version">3.1.0</emphasis>
- </superscript>
- </emphasis>
+ <rich:effect> <emphasis role="since"><superscript> available since <emphasis role="version">3.1.0</emphasis></superscript></emphasis>
</title>
- <section>
- <title>Description</title>
- <para>
- The <emphasis role="bold">
- <property><rich:effect></property>
- </emphasis> utilizes a set of effects provided by the scriptaculous JavaScript library.
- It allows to attach effects to JSF components and html tags.
- </para>
- </section>
- <section>
- <title>Key Features</title>
- <itemizedlist>
- <listitem>
- <para>No developers JavaScript writing needed to use it on pages</para>
- </listitem>
- <listitem>
- <para>Presents scriptaculous JavaScript library functionality</para>
- </listitem>
- </itemizedlist>
- </section>
- <section>
- <title>Details of Usage</title>
- <para> It is possible to use <emphasis role="bold">
- <property><rich:effect></property>
- </emphasis> in two modes: <itemizedlist>
- <listitem>
- <para>attached to the JSF components or html tags and triggered by a particular event.
- Wiring effect with JSF components might occur on the server or client. Wiring with html
- tag is possible only on the client side </para>
- </listitem>
- <listitem>
- <para>invoking from the JavaScript code by an effect name. During the rendering,
- <emphasis role="bold">
- <property><rich:effect></property>
- </emphasis> generates the JavaScript function with defined name.
- When the function is called, the effect is applied </para>
- </listitem>
- </itemizedlist>
- </para>
- <para>
- <emphasis role="bold">Those a the typical variants of using:</emphasis>
- </para>
- <programlisting role="XML">...
-<!-- attaching by event -->
+
+ <section>
+ <title>Description</title>
+ <para>
+ The <emphasis role="bold"><property><rich:effect></property></emphasis> utilizes a set of effects provided by the Scriptaculous JavaScript library.
+ It allows to attach effects to JSF components and HTML tags.
+ </para>
+ </section>
+
+ <section>
+ <title>Key Features</title>
+ <itemizedlist>
+ <listitem>
+ <para>Represents Scriptaculous JavaScript library functionality</para>
+ </listitem>
+ <listitem>
+ <para>No JavaScript needed to the component</para>
+ </listitem>
+ </itemizedlist>
+ </section>
+
+ <section>
+ <title>Details of Usage</title>
+ <para>
+ It is possible to use <emphasis role="bold"><property><rich:effect></property></emphasis> in two modes:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ attached to a JSF component or HTML tag and triggered by a particular event.
+ Wiring effect with JSF components might occur on the server or client.
+ Wiring with html tag is possible only on the client side.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ invoking from the JavaScript code by an effect name.
+ During the rendering, <emphasis role="bold"><property><rich:effect></property></emphasis> generates the JavaScript function with defined name.
+ When the function is called, the effect is applied
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ <para>
+ <emphasis role="bold">Those a the typical variants of using:</emphasis>
+ </para>
+ <programlisting role="XML"><!-- triggered by an event -->
<rich:panel>
<rich:effect event="onmouseout" type="Opacity" params="duration:0.8,from:1.0,to:0.3" />
- <!--panel content-->
+ ...
</rich:panel>
-...
-<!-- invoking from JavaScript -->
-<div id="contentDiv">
- <!--div content-->
-</div>
-
+<!-- invoking by JavaScript -->
+<div id="contentDiv">...</div>
<input type="button" onclick="hideDiv({duration:0.7})" value="Hide" />
<input type="button" onclick="showDiv()" value="Show" />
-
<rich:effect name="hideDiv" for="contentDiv" type="Fade" />
<rich:effect name="showDiv" for="contentDiv" type="Appear" />
-<!-- attaching to window on load and applying on particular page element -->
-<rich:effect for="window" event="onload" type="Appear" params="targetId:'contentDiv',duration:0.8,from:0.3,to:1.0" />
-...
-</programlisting>
+<!-- attached to a window onload event and applied to a particular page element -->
+<rich:effect for="window" event="onload" type="Appear" params="targetId:'contentDiv',duration:0.8,from:0.3,to:1.0" /></programlisting>
<figure>
- <title>Initial</title>
-
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/effect_init.png"/>
- </imageobject>
- </mediaobject>
+ <title>Initial</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/effect_init.png"/>
+ </imageobject>
+ </mediaobject>
</figure>
+ <figure>
+ <title>When the mouse cursor is over</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/effect_2.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
- <figure>
- <title>When the mouse cursor is over</title>
-
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/effect_2.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
<para>
- <emphasis>
- <property>"name"</property>
- </emphasis> attribute defines a name of the JavaScript function that is be generated on a page
- when the component is rendered. You can invoke this function to activate the effect. The
- function accesses one parameter. It is a set of effect options in JSON format. </para>
+ The <emphasis><property>"name"</property></emphasis> attribute defines a name of the JavaScript function that will be generated on a page after the component is rendered.
+ This function will activate the needed effect.
+ The function accesses one parameter.
+ It is a set of effect options in JSON format. </para>
<para>
- <emphasis>
- <property>"type"</property>
- </emphasis> attribute defines the type of an effect. For example, "Fade", "Blind", "Opacity".
- Have a look at <ulink url="http://script.aculo.us">scriptaculous documentation</ulink> for set
- of available effect. </para>
+ The <emphasis><property>"type"</property></emphasis> attribute defines the type of an effect that will be applied.
+ Possible values are <code>Fade</code>, <code>Blind</code>, <code>Opacity</code>.
+ </para>
<para>
- <emphasis>
- <property>"for"</property>
- </emphasis> attribute defines the id of the component or html tag, the effect is attached
- to. RichFaces converts the <emphasis>
- <property>"for"</property>
- </emphasis> attribute value to the client id of the component if such component is found. If
- not, the value is left as is for possible wiring with on the DOM element's id on the client
- side. By default, the target of the effect is the same element that effect pointed to.
- However, the target element is might be overridden with <emphasis>
- <property>"targetId"</property>
- </emphasis> option passed with <emphasis>
- <property>"params"</property>
- </emphasis> attribute of with function paramenter. </para>
+ The <emphasis><property>"for"</property></emphasis> attribute defines the ID of the component or HTML tag, the effect is attached to.
+ RichFaces converts value of <emphasis><property>"for"</property></emphasis> attribute to a component client ID if such component is found.
+ In case if such component is not found the value is left because of possible wirings with some DOM element id on the client side.
+ By default, the target of the effect is the same element that effect is pointed to.
+ Тarget element can be redefined with the <emphasis><property>"targetId"</property></emphasis> attribute;
+ new parameters should be passed with the <emphasis><property>"params"</property></emphasis> attribute.
+ </para>
<para>
- <emphasis>
- <property>"params"</property>
- </emphasis> attribute allows to define the set of options possible for particurar effect. For
- example, 'duration', 'delay', 'from', 'to'. Additionally to the options used by the effect
- itself, there are two option that might override the <emphasis role="bold">
- <property><rich:effect></property>
- </emphasis>
- attribute. Those are: <itemizedlist>
- <listitem>
- <para>
- <emphasis>
- <property>"targetId"</property>
- </emphasis> allows to re-define the target of effect. The option is override the value of <emphasis>
- <property>"for"</property>
- </emphasis> attribute.</para>
- </listitem>
- <listitem>
- <para>
- <emphasis>
- <property>"type"</property>
- </emphasis> defines the effect type. The option is override the value of <emphasis>
- <property>"type"</property>
- </emphasis> attribute.</para>
- </listitem>
- </itemizedlist>
+ The <emphasis><property>"params"</property></emphasis> attribute allows to define a set of options (<code>duration</code>, <code>delay</code>, <code>from</code>, <code>to</code>) possible for a particurar effect.
+ Additionally to the options used by the effect itself, there are two option that might override the <emphasis role="bold"><property><rich:effect></property></emphasis>attribute:
+ <itemizedlist>
+ <listitem>
+ <para>
+ <emphasis><property>"targetId"</property></emphasis> allows to re-define the target of effect.
+ The option is override the value of <emphasis><property>"for"</property></emphasis> attribute.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis><property>"type"</property></emphasis> defines the effect type.
+ The option is override the value of <emphasis><property>"type"</property></emphasis> attribute.
+ </para>
+ </listitem>
+ </itemizedlist>
</para>
- <para> You can use a set of effects directly without defining the <emphasis role="bold">
- <property><rich:effect></property>
- </emphasis> component on a page if it's convenient for you. For that, load the
- scriptaculous library to the page with the following code: </para>
<para>
- <emphasis role="bold">Example:</emphasis>
+ Besides all you can load the Scriptaculous library to the page and use it directly without <emphasis role="bold"><property><rich:effect></property></emphasis>:
</para>
- <programlisting role="XML">...
-<a4j:loadScript src="resource://scriptaculous/effect.js" />
-...
-</programlisting>
- <para> If you do use the <emphasis role="bold">
- <property><rich:effect></property>
- </emphasis>component, there is no need to include this library because it's already here. </para>
-
- <para>For more information look at <ulink url="http://jboss.com/index.html?module=bb&op=viewtopic&t=119044">RichFaces
- Users Forum</ulink>.</para>
- </section>
- <section>
- <title>Reference Data</title>
+ <programlisting role="XML"><a4j:loadScript src="resource://scriptaculous/effect.js" /></programlisting>
<para>
- <ulink url="&tlddoc;rich/effect.html">Table of
- <rich:effect>
- attributes</ulink>.
- </para>
+ But if you use the <emphasis role="bold"><property><rich:effect></property></emphasis> there is no need to include this library because it's already there.
+ </para>
+ </section>
+
+ <section>
+ <title>Reference Data</title>
+ <para>
+ <ulink url="&tlddoc;rich/effect.html">Table of <rich:effect> attributes</ulink>.
+ </para>
<table>
- <title>Component Identification Parameters </title>
- <tgroup cols="2">
- <thead>
- <row>
- <entry>Name</entry>
- <entry>Value</entry>
- </row>
+ <title>Component Identification Parameters </title>
+ <tgroup cols="2"><thead>
+ <row>
+ <entry>Name</entry>
+ <entry>Value</entry>
+ </row>
</thead>
- <tbody>
- <row>
- <entry>component-type</entry>
- <entry>org.richfaces.Effect</entry>
- </row>
- <row>
- <entry>component-class</entry>
- <entry>org.richfaces.component.html.HtmlEffect</entry>
- </row>
- <row>
- <entry>component-family</entry>
- <entry>org.richfaces.Effect</entry>
- </row>
- <row>
- <entry>renderer-type</entry>
- <entry>org.richfaces.EffectRenderer</entry>
- </row>
- <row>
- <entry>tag-class</entry>
- <entry>org.richfaces.taglib.EffectTag</entry>
- </row>
- </tbody>
- </tgroup>
+ <tbody>
+ <row>
+ <entry>component-type</entry>
+ <entry>org.richfaces.Effect</entry>
+ </row>
+ <row>
+ <entry>component-class</entry>
+ <entry>org.richfaces.component.html.HtmlEffect</entry>
+ </row>
+ <row>
+ <entry>component-family</entry>
+ <entry>org.richfaces.Effect</entry>
+ </row>
+ <row>
+ <entry>renderer-type</entry>
+ <entry>org.richfaces.EffectRenderer</entry>
+ </row>
+ <row>
+ <entry>tag-class</entry>
+ <entry>org.richfaces.taglib.EffectTag</entry>
+ </row>
+ </tbody>
+ </tgroup>
</table>
- </section>
- <section>
+ </section>
+
+ <section>
<title>Relevant Resources Links</title>
<para>
- <ulink url="http://wiki.jboss.org/wiki/CreateABannerUsingEffectsAndPoll">
- Here
- </ulink>
- you can get additional information how to create an image banner
- using
- <emphasis role="bold">
- <property><rich:effect></property>
- </emphasis>
- and
- <emphasis role="bold">
- <property><a4j:poll></property>
- </emphasis>
- components and figure out how to create an HTML banner from
- <ulink url="http://wiki.jboss.org/auth/wiki/CreateAHTMLBannerUsingEffectsAndPoll">
- "Creating HTML Banner Using Effects And Poll RichFaces Wiki" article
- </ulink>
- .
- </para>
- <para>In the
- <ulink url="http://wiki.jboss.org/auth/wiki/RichFacesCookbook/SlideShow">RichFaces Cookbook article</ulink>
- you can find information how to make a Slide Show with help of the
- <emphasis role="bold">
- <property><rich:effect></property>
- </emphasis>
- and <emphasis role="bold">
- <property><a4j:poll></property>
- </emphasis> components.
- </para>
- <para>
- <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/effect.jsf?c=effect">On the component LiveDemo page</ulink> you can see the example of <emphasis role="bold">
- <property><rich:effect></property>
- </emphasis> usage. </para>
- <para>How to save <emphasis role="bold">
- <property><rich:effect></property>
- </emphasis>status see on the <ulink url="http://www.jboss.com/index.html?module=bb&op=viewtopic&t=118833">RichFaces Users Forum</ulink>.</para>
- </section>
+ Visit the <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/effect.jsf?c=effect">Effect page</ulink> at RichFaces LiveDemo for examples of component usage and their sources.
+ </para>
+ <para>Useful articels:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ "<ulink url="http://www.jboss.org/community/wiki/CreateABannerUsingEffectsAndPoll">Create a banner using effects and poll</ulink>" and
+ "<ulink url="http://wiki.jboss.org/auth/wiki/CreateAHTMLBannerUsingEffectsAndPoll">Create a HTML banner using effects and poll</ulink>" at RichFaces wiki contains sorces for creating an image and HTML banners;
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ "<ulink url="http://wiki.jboss.org/auth/wiki/RichFacesCookbook/SlideShow">Slideshow</ulink>" article at RichFaces Cookbook describes
+ how to make a slideshow with help of the <emphasis role="bold"><property><rich:effect></property></emphasis> and <emphasis role="bold"><property><a4j:poll></property></emphasis> components;
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ Look at Scriptaculous <ulink url="http://script.aculo.us">documentation</ulink> for set of available effect.
+ </para>
+ <para>
+ Find more information about the compinent at <ulink url="http://jboss.com/index.html?module=bb&op=viewtopic&t=119044">RichFaces Users Forum</ulink>.
+ </para>
+ </section>
+
</section>
\ No newline at end of file
15 years, 3 months
JBoss Rich Faces SVN: r15470 - in branches/community/3.3.X/samples/combobox-sample/src/main/webapp: pages and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-09-04 13:17:33 -0400 (Fri, 04 Sep 2009)
New Revision: 15470
Added:
branches/community/3.3.X/samples/combobox-sample/src/main/webapp/pages/RF-7258.xhtml
branches/community/3.3.X/samples/combobox-sample/src/main/webapp/pages/RF-7701.xhtml
branches/community/3.3.X/samples/combobox-sample/src/main/webapp/pics/
branches/community/3.3.X/samples/combobox-sample/src/main/webapp/pics/info.gif
Log:
ComboBox: pop up can not be closed if it was opened during combobox rerender.
https://jira.jboss.org/jira/browse/RF-7258
comboBox: onselect event doesn't work
https://jira.jboss.org/jira/browse/RF-7701
Added: branches/community/3.3.X/samples/combobox-sample/src/main/webapp/pages/RF-7258.xhtml
===================================================================
--- branches/community/3.3.X/samples/combobox-sample/src/main/webapp/pages/RF-7258.xhtml (rev 0)
+++ branches/community/3.3.X/samples/combobox-sample/src/main/webapp/pages/RF-7258.xhtml 2009-09-04 17:17:33 UTC (rev 15470)
@@ -0,0 +1,29 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:cmb="http://labs.jboss.com/jbossrichfaces/ui/combobox"
+ xmlns:a4j="http://richfaces.org/a4j"
+ >
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ <h:form id="form">
+ <cmb:comboBox id="combo" >
+ <f:selectItem itemValue="val-1" />
+ <f:selectItem itemValue="val-2" />
+ <f:selectItem itemValue="val-3" />
+ <f:selectItem itemValue="val-4" />
+ <f:selectItem itemValue="val-5" />
+ </cmb:comboBox>
+ <a4j:commandButton
+ reRender="combo"
+ value="reRender"
+ onclick="$('form:combo').component.showList()" />
+ </h:form>
+ </f:view>
+ </body>
+</html>
\ No newline at end of file
Added: branches/community/3.3.X/samples/combobox-sample/src/main/webapp/pages/RF-7701.xhtml
===================================================================
--- branches/community/3.3.X/samples/combobox-sample/src/main/webapp/pages/RF-7701.xhtml (rev 0)
+++ branches/community/3.3.X/samples/combobox-sample/src/main/webapp/pages/RF-7701.xhtml 2009-09-04 17:17:33 UTC (rev 15470)
@@ -0,0 +1,32 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:cmb="http://labs.jboss.com/jbossrichfaces/ui/combobox"
+ xmlns:p="http://labs.jboss.com/jbossrichfaces/ui/panel"
+ xmlns:a4j="http://richfaces.org/a4j"
+ >
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <cmb:comboBox
+ onchange="#{bean.onchangeScript}"
+ onlistcall="#{bean.onlistcallScript}"
+ onselect="alert('Hi Alex!');"
+ buttonIcon="/pics/info.gif"
+ >
+
+ <f:selectItem itemValue="Oregon" />
+ <f:selectItem itemValue="Pennsylvania Oregonfdsf fdsfdsfds dsffdsfdsfdsf fdsfdsfwdsfsfsd fdsfdsfdsfds dfsfdsfdsfds"/>
+ <f:selectItem itemValue="Rhode Island"/>
+ <f:selectItem itemValue="South Carolina"/>
+ <f:selectItem itemValue="J'uneau"/>
+ </cmb:comboBox>
+ </h:form>
+ </f:view>
+ </body>
+</html>
Added: branches/community/3.3.X/samples/combobox-sample/src/main/webapp/pics/info.gif
===================================================================
(Binary files differ)
Property changes on: branches/community/3.3.X/samples/combobox-sample/src/main/webapp/pics/info.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 3 months