[richfaces-svn-commits] JBoss Rich Faces SVN: r11987 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Tue Dec 23 06:05:41 EST 2008
Author: dsvyatobatsko
Date: 2008-12-23 06:05:40 -0500 (Tue, 23 Dec 2008)
New Revision: 11987
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/facetsTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/layoutTests.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5343
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/facetsTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/facetsTest.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/facetsTest.xhtml 2008-12-23 11:05:40 UTC (rev 11987)
@@ -0,0 +1,48 @@
+<!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:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.template}">
+ <ui:define name="component">
+ <h:form id="_form">
+ <rich:calendar
+ id="calendar"
+ popup="false"
+ cellWidth="70px"
+ cellHeight="70px">
+ <f:facet name="header">
+ <h:panelGrid columns="2">
+ <h:outputText value="Header"/>
+ <h:outputText value="{todayControl}"/>
+ </h:panelGrid>
+ </f:facet>
+ <f:facet name="optionalHeader">
+ <h:outputText value="optionalHeader"/>
+ </f:facet>
+ <f:facet name="weekDay">
+ <h:outputText value="WD: {weekDayLabelShort}"/>
+ </f:facet>
+ <f:facet name="weekNumber">
+ <h:outputText value="WN: {weekNumber}" style="color:red"/>
+ </f:facet>
+ <f:facet name="footer">
+ <h:panelGrid columns="4">
+ <h:outputText value="Footer"/>
+ <h:outputText value="{previousMonthControl}"/>
+ <h:outputText value="{currentMonthControl}"/>
+ <h:outputText value="{nextMonthControl}"/>
+ </h:panelGrid>
+ </f:facet>
+ <f:facet name="optionalFooter">
+ <h:outputText value="optionalFooter"/>
+ </f:facet>
+ <h:outputText value="{day}"></h:outputText>
+ </rich:calendar>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</html>
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/calendar/layoutTests.xhtml
===================================================================
(Binary files differ)
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-23 10:54:38 UTC (rev 11986)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/CalendarTest.java 2008-12-23 11:05:40 UTC (rev 11987)
@@ -75,6 +75,8 @@
static final String RESET_TIME_ON_DATE_SELECTION_TEST_URL = "pages/calendar/resetTimeOnDateSelectTest.xhtml";
+ static final String FACETS_TEST_URL = "pages/calendar/facetsTest.xhtml";
+
static final String CONTROLS_FORM_ID = "_controls:";
static final String availableDayCellClass = "rich-calendar-cell-size rich-calendar-cell rich-calendar-btn";
@@ -191,7 +193,15 @@
String enableManualInputId;
String boundaryDatesModeId;
+
+ String optionalHeaderFacetId;
+ String optionalFooterFacetId;
+
+ String headerFacetId;
+
+ String footerFacetId;
+
void initIds(String parentId) {
calendarId = parentId + FORM_ID + "calendar";
calendarHeaderId = calendarId + "Header";
@@ -241,6 +251,10 @@
directionId = parentId + FORM_ID + "direction";
enableManualInputId = parentId + FORM_ID + "enableManualInput";
boundaryDatesModeId = parentId + FORM_ID + "boundaryDatesMode";
+ optionalHeaderFacetId = calendarId + "HeaderOptional";
+ optionalFooterFacetId = calendarId + "FooterOptional";
+ headerFacetId = calendarId + "Header";
+ footerFacetId = calendarId + "Footer";
}
String getStatus() {
@@ -1636,10 +1650,43 @@
@Test
public void testFacets(Template template) {
- renderPage(LAYOUT_TESTS_URL, template, null);
+ renderPage(FACETS_TEST_URL, template, null);
initIds(getParentId());
+ writeStatus("Check facets of the component: 'header', 'footer', 'optionalHeader', 'optionalFooter', 'weekNumber' and 'weekDay'");
- writeStatus("Check facets of the component: 'header', 'footer', 'optionalHeader', 'optionalFooter', 'weekNumber' and 'weekDay'");
+ AssertTextEquals(optionalHeaderFacetId, "optionalHeader", "Optional header facet is not rendered to client");
+ AssertTextEquals(optionalFooterFacetId, "optionalFooter", "Optional footer facet is not rendered to client");
+
+ writeStatus("Check header facet");
+ String headerFacetText = selenium.getText(headerFacetId);
+ Assert.assertTrue(headerFacetText.matches(".*Header.*"), "Header facet is not rendered to client");
+ Assert.assertTrue(headerFacetText.matches(".*Today.*"), "Header facet is not rendered to client");
+
+ writeStatus("Check footer facet");
+ AssertPresent(footerFacetId, "Footer facet is not rendered");
+ AssertTextEquals("//*[@id='" + footerFacetId + "']/table/tbody/tr/td[1]", "Footer");
+
+ writeStatus("Check '{previousMonthControl}' element works");
+ AssertTextEquals("//*[@id='" + footerFacetId + "']/table/tbody/tr/td[2]", "<");
+ String beforeHTML = getHTMLById(calendarId);
+ selenium.click("//*[@id='" + footerFacetId + "']/table/tbody/tr/td[2]/div");
+ String afterHTML = getHTMLById(calendarId);
+ Assert.assertFalse(afterHTML.equals(beforeHTML), "It looks as if previous month control does not work");
+
+ writeStatus("Check '{nextMonthControl}' element works");
+ AssertTextEquals("//*[@id='" + footerFacetId + "']/table/tbody/tr/td[4]", ">");
+ beforeHTML = getHTMLById(calendarId);
+ selenium.click("//*[@id='" + footerFacetId + "']/table/tbody/tr/td[4]/div");
+ afterHTML = getHTMLById(calendarId);
+ Assert.assertFalse(afterHTML.equals(beforeHTML), "It looks as if next month control does not work");
+
+ writeStatus("Check 'weekNumber' facet");
+ String weekNumberCellText = selenium.getText(calendarId + "WeekNumCell1");
+ Assert.assertTrue(weekNumberCellText.matches(".*WN:.*"), "Week number facet is not rendered to client");
+
+ writeStatus("Check 'weekDay' facet");
+ String weekDayCellText = selenium.getText(calendarId + "WeekDayCell1");
+ Assert.assertTrue(weekDayCellText.matches(".*WD:.*"), "Week day facet is not rendered to client");
}
@Test
More information about the richfaces-svn-commits
mailing list