Author: ppitonak(a)redhat.com
Date: 2009-10-27 05:11:02 -0400 (Tue, 27 Oct 2009)
New Revision: 15763
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/resources/org/jboss/richfaces/integrationTest/calendar/locators.properties
Log:
* jQuery locators for all calendar-related test cases
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-10-26
20:45:20 UTC (rev 15762)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarStylingTestCase.java 2009-10-27
09:11:02 UTC (rev 15763)
@@ -56,8 +56,8 @@
String text = null;
int date = 0;
- for (int i = 3; i < 9; i++) {
- for (int j = 2; j < 9; j++) {
+ for (int i = 1; i < 7; i++) {
+ for (int j = 1; j < 8; j++) {
text = selenium.getText(format(LOC_STYLING_CELL_PREFORMATTED, i, j));
date = Integer.parseInt(text);
if (date % 3 == 0) {
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-10-26
20:45:20 UTC (rev 15762)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/CalendarTestCase.java 2009-10-27
09:11:02 UTC (rev 15763)
@@ -62,6 +62,7 @@
private final String LOC_MONTH_YEAR_LABEL = getLoc("MONTH_YEAR_LABEL");
private final String LOC_RIGHT_ARROW = getLoc("RIGHT_ARROW");
private final String LOC_DOUBLE_RIGHT_ARROW =
getLoc("DOUBLE_RIGHT_ARROW");
+ private final String LOC_DAY_LABEL = getLoc("DAY_LABEL");
private final String LOC_CLOSE_BUTTON = getLoc("CLOSE_BUTTON");
private final String LOC_CLEAN_BUTTON = getLoc("CLEAN_BUTTON");
private final String LOC_TODAY_BUTTON = getLoc("TODAY_BUTTON");
@@ -268,7 +269,7 @@
@Test
public void testLocale() {
// choose German localization
- selenium.click(LOC_LOCALE_SELECT + "/td[2]/input");
+ selenium.click(format(LOC_LOCALE_SELECT, 1));
waitFor(1000);
selenium.click(LOC_DATE_BUTTON);
@@ -279,7 +280,8 @@
assertTrue(month1.equalsIgnoreCase(month2), "The name of the month is not
localized.");
- String text = selenium.getText(LOC_CALENDAR + "/tbody/tr[2]/td[3]");
+ // get the label of second day
+ String text = selenium.getText(format(LOC_DAY_LABEL,1));
assertTrue(!"Mon".equalsIgnoreCase(text), "The name of the second
day is not localized.");
// TODO find out whether the following strings should be translated
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-10-26
20:45:20 UTC (rev 15762)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/calendar/OrganizerTestCase.java 2009-10-27
09:11:02 UTC (rev 15763)
@@ -66,13 +66,13 @@
String today =
Integer.toString(Calendar.getInstance().get(Calendar.DAY_OF_MONTH));
String text = null;
- int fromLine = 3;
+ int fromLine = 1;
if (Integer.parseInt(today) > 15) {
- fromLine = 5;
+ fromLine = 3;
}
- for (int i = fromLine; i < 9; i++) {
- for (int j = 1; j < 8; j++) {
+ for (int i = fromLine; i < 6; i++) {
+ for (int j = 0; j < 7; j++) {
text = selenium.getText(format(LOC_CELL_DATE_PREFORMATTED, i, j));
if (today.equals(text)) {
assertTrue(belongsClass("rich-calendar-today",
format(LOC_CELL_PREFORMATTED, i, j)),
@@ -89,7 +89,7 @@
*/
@Test
public void testLastDayIsGrey() {
- assertTrue(belongsClass("rich-calendar-boundary-dates",
format(LOC_CELL_PREFORMATTED, 8, 7)),
+ assertTrue(belongsClass("rich-calendar-boundary-dates",
format(LOC_CELL_PREFORMATTED, 6, 6)),
"Class attribute of the last cell should contain
\"rich-calendar-boundary-dates\".");
}
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-10-26
20:45:20 UTC (rev 15762)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/calendar/locators.properties 2009-10-27
09:11:02 UTC (rev 15763)
@@ -1,42 +1,43 @@
# first tab
-CALENDAR_HEADER=//fieldset[1]/legend
-DATE_INPUT=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/span/input
-DATE_BUTTON=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/span/img
-INPUTS=//fieldset[1]/div/form/table/tbody/tr/td[1]/div/span
-POPUP_MODE_CHECKBOX=//fieldset[1]/div/form/table/tbody/tr/td[2]/table/tbody/tr[1]/td[2]/input
-APPLY_BUTTON_CHECKBOX=//fieldset[1]/div/form/table/tbody/tr/td[2]/table/tbody/tr[2]/td[2]/input
-LOCALE_SELECT=//fieldset[1]/div/form/table/tbody/tr/td[2]/table/tbody/tr[3]/td[2]/table/tbody/tr
-DATE_PATTERN_SELECT=//fieldset[1]/div/form/table/tbody/tr/td[2]/table/tbody/tr[4]/td[2]/select
+CALENDAR_HEADER=jquery=fieldset:eq(0)
+DATE_INPUT=jquery=fieldset:eq(0) input[id$=InputDate]
+DATE_BUTTON=jquery=fieldset:eq(0) img[id$=PopupButton]
+INPUTS=jquery=fieldset:eq(0) td.ecol1 span
+POPUP_MODE_CHECKBOX=jquery=fieldset:eq(0) td.ecol2 tr:eq(0) input
+APPLY_BUTTON_CHECKBOX=jquery=fieldset:eq(0) td.ecol2 tr:eq(1) input
+LOCALE_SELECT=jquery=fieldset:eq(0) td.ecol2 tr:eq(2) table input:eq({0})
+DATE_PATTERN_SELECT=jquery=fieldset:eq(0) td.ecol2 tr:last select
-CALENDAR=//div[contains(@id, 'calendar')]/table
-DOUBLE_LEFT_ARROW=//div[contains(@id,
'calendar')]/table/tbody/tr[1]/td[1]/table/tbody/tr/td[1]/div
-LEFT_ARROW=//div[contains(@id,
'calendar')]/table/tbody/tr[1]/td[1]/table/tbody/tr/td[2]/div
-MONTH_YEAR_LABEL=//div[contains(@id,
'calendar')]/table/tbody/tr[1]/td[1]/table/tbody/tr/td[3]/div
-RIGHT_ARROW=//div[contains(@id,
'calendar')]/table/tbody/tr[1]/td[1]/table/tbody/tr/td[4]/div
-DOUBLE_RIGHT_ARROW=//div[contains(@id,
'calendar')]/table/tbody/tr[1]/td[1]/table/tbody/tr/td[5]/div
-CLOSE_BUTTON=//div[contains(@id,
'calendar')]/table/tbody/tr[1]/td[1]/table/tbody/tr/td[6]/div
-CLEAN_BUTTON=//div[contains(@id,
'calendar')]/table/tbody/tr[9]/td/table/tbody/tr/td[2]/div
-TODAY_BUTTON=//div[contains(@id,
'calendar')]/table/tbody/tr[9]/td/table/tbody/tr/td[5]/div
-APPLY_BUTTON=//div[contains(@id,
'calendar')]/table/tbody/tr[9]/td/table/tbody/tr/td[6]/div
-RANDOM_DAY=//div[contains(@id, 'calendar')]/table/tbody/tr[6]/td[4]
+CALENDAR=jquery=fieldset:eq(0) table.rich-calendar-popup
+DOUBLE_LEFT_ARROW=jquery=fieldset:eq(0) td.rich-calendar-header div:eq(0)
+LEFT_ARROW=jquery=fieldset:eq(0) td.rich-calendar-header div:eq(1)
+MONTH_YEAR_LABEL=jquery=fieldset:eq(0) td.rich-calendar-header div:eq(2)
+RIGHT_ARROW=jquery=fieldset:eq(0) td.rich-calendar-header div:eq(3)
+DOUBLE_RIGHT_ARROW=jquery=fieldset:eq(0) td.rich-calendar-header div:eq(4)
+CLOSE_BUTTON=jquery=fieldset:eq(0) td.rich-calendar-header div:eq(5)
+CLEAN_BUTTON=jquery=fieldset:eq(0) td.rich-calendar-toolfooter:eq(1) > div
+TODAY_BUTTON=jquery=fieldset:eq(0) td.rich-calendar-toolfooter:eq(4) > div
+APPLY_BUTTON=jquery=fieldset:eq(0) td.rich-calendar-toolfooter:eq(5) > div
+RANDOM_DAY=jquery=fieldset:eq(0) td.rich-calendar-cell[id$=DayCell23]
+DAY_LABEL=jquery=fieldset:eq(0) table.rich-calendar-popup td[id$=WeekDayCell{0}]
# second tab
-FIELDSET=//fieldset[1]/legend
+FIELDSET=jquery=fieldset:eq(0)
-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]
+CELL_PREFORMATTED=jquery=fieldset:eq(0) tr[id$=organizerWeekNum{0}] > td:eq({1})
+CELL_DATE_PREFORMATTED=jquery=fieldset:eq(0) tr[id$=organizerWeekNum{0}] > td:eq({1})
tr:eq(0)
+CELL_DESC_PREFORMATTED=jquery=fieldset:eq(0) tr[id$=organizerWeekNum{0}] > td:eq({1})
tr:eq(1)
+CELL_NOTE_PREFORMATTED=jquery=fieldset:eq(0) tr[id$=organizerWeekNum{0}] > td:eq({1})
tr:eq(2)
-DIALOG=//div[@id='panelContainer']
-DIALOG_DESCRIPTION=//table[@id='panelContentTable']/tbody/tr[2]/td/form/table/tbody/tr[1]/td[2]/input
-DIALOG_NOTE=//table[@id='panelContentTable']/tbody/tr[2]/td/form/table/tbody/tr[2]/td[2]/textarea
-DIALOG_STORE_BUTTON=//table[@id='panelContentTable']/tbody/tr[2]/td/form/table/tbody/tr[3]/td[1]/input
-DIALOG_CANCEL_BUTTON=//table[@id='panelContentTable']/tbody/tr[2]/td/form/table/tbody/tr[3]/td[2]/button
-DIALOG_CROSS_BUTTON=//div[@id\='panelContainer']/div[2]/div/div[2]/div/img
+DIALOG=jquery=div#panelContainer
+DIALOG_DESCRIPTION=jquery=div#panelContainer td.rich-mpnl-body tr:eq(0) input
+DIALOG_NOTE=jquery=div#panelContainer td.rich-mpnl-body tr:eq(1) textarea
+DIALOG_STORE_BUTTON=jquery=div#panelContainer td.rich-mpnl-body tr:eq(2) input
+DIALOG_CANCEL_BUTTON=jquery=div#panelContainer td.rich-mpnl-body tr:eq(2) button
+DIALOG_CROSS_BUTTON=jquery=div#panelContainer img#hidelink
# third tab
-STYLING_FIELDSET=//fieldset[1]/legend
-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
+STYLING_FIELDSET=jquery=fieldset:eq(0)
+STYLING_CELL_PREFORMATTED=jquery=fieldset:eq(0) tr[id$=WeekNum{0}] > td:eq({1})
+STYLING_CALENDAR_BUTTON=jquery=fieldset:eq(0) img.rich-calendar-button
+STYLING_RIGHT_ARROW=jquery=fieldset:eq(0) td.rich-calendar-header div:eq(3)
\ No newline at end of file