Author: andrei_exadel
Date: 2008-12-03 10:09:42 -0500 (Wed, 03 Dec 2008)
New Revision: 11522
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java
Log:
RF-5150
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java 2008-12-03
14:47:47 UTC (rev 11521)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java 2008-12-03
15:09:42 UTC (rev 11522)
@@ -39,10 +39,12 @@
static final String CONTROLS_FORM_ID = "_controls:";
static final String availableDayCellClass = "rich-calendar-cell-size
rich-calendar-cell rich-calendar-btn";
-
+
String calendarId;
String calendarHeaderId;
+
+ String calendarFooterId;
String ajaxSubmitId;
@@ -53,15 +55,31 @@
String resetActionId;
String testClientModeId;
+
+ String timeSelectionXpath;
+
+ String timeHoursSelectionId;
+
+ String timeMinutesSelectionId;
+
+ String timeSelectionOkButtonId;
+
+ String timeSelectionCancelButtonId;
void initIds(String parentId) {
calendarId = parentId + FORM_ID + "calendar";
calendarHeaderId = calendarId + "Header";
+ calendarFooterId = calendarId + "Footer";
+ timeSelectionXpath =
"//td[@id='"+calendarFooterId+"']/table/tbody/tr/td[3]/div";
ajaxSubmitId = parentId + FORM_ID + "ajaxSubmit";
serverSubmitId = parentId + FORM_ID + "serverSubmit";
statusId = parentId + FORM_ID + "status";
resetActionId = parentId + CONTROLS_FORM_ID + "resetAction";
testClientModeId = parentId + CONTROLS_FORM_ID + "testClientMode";
+ timeHoursSelectionId = calendarId + "TimeHours";
+ timeMinutesSelectionId = calendarId + "TimeMinutes";
+ timeSelectionOkButtonId = calendarId + "TimeEditorButtonOk";
+ timeSelectionCancelButtonId = calendarId + "TimeEditorButtonCancel";
}
String getStatus() {
@@ -107,8 +125,60 @@
void switchToClientMode() {
clickCommandAndWait(testClientModeId);
}
+
+ void showTimeSelectionWindow() {
+ selenium.click(timeSelectionXpath);
+ }
+
+ @Test
+ public void testTimeSelection(Template template) {
+ renderPage(template, RESET_METHOD);
+ initIds(getParentId());
+
+
+ // Test time selection appearing
+ showTimeSelectionWindow();
+ AssertVisible(calendarId + "TimeEditorLayout", "Time selection
dialog was not opened");
+ AssertVisible(timeHoursSelectionId, "'Hour' input was not
displayed");
+ AssertVisible(timeMinutesSelectionId, "'Minutes' input was not
displayed");
+ AssertVisible(timeSelectionOkButtonId, "Time selection 'OK' button
was not displayed");
+ AssertVisible(timeSelectionCancelButtonId, "Time selection 'Cancel'
button was not displayed");
+
+ // Test time selection applying
+ setValueById(timeHoursSelectionId, "10");
+ setValueById(timeMinutesSelectionId, "00");
+ clickById(timeSelectionOkButtonId);
+ AssertNotVisible(calendarId + "TimeEditorLayout", "Time selection
dialog was not hidden after 'Ok' button clicked");
+
+ String time = selenium.getText(timeSelectionXpath);
+ if (!"10:00".equals(time)) {
+ Assert.fail("Time selected has not been applied. Expected [10:00]. But was
+ [" + time+ "]");
+ }
+
+ // Test time cancel button
+ showTimeSelectionWindow();
+
+ setValueById(timeHoursSelectionId, "18");
+ setValueById(timeMinutesSelectionId, "50");
+ clickById(timeSelectionCancelButtonId);
+ AssertNotVisible(calendarId + "TimeEditorLayout", "Time selection
dialog was not hidden after 'Cancel' button clicked");
+
+ time = selenium.getText(timeSelectionXpath);
+ if (!"10:00".equals(time)) {
+ Assert.fail("Time applied after cancel button clicked. Expected [10:00].
But was + [" + time+ "]");
+ }
+
+ // Test time applying in server side
+
+ clickCommandAndWait(serverSubmitId);
+ time = selenium.getText(timeSelectionXpath);
+ if (!"10:00".equals(time)) {
+ Assert.fail("Time was not applied on server side. Expected [10:00]. But was
+ [" + time+ "]");
+ }
+
+ }
- @Test
+ //@Test
public void testListenersInAjaxMode(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId());
@@ -127,7 +197,7 @@
}
- @Test
+ //@Test
public void testListenersInClientMode(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId());
Show replies by date