Author: ppitonak(a)redhat.com
Date: 2011-02-16 07:59:07 -0500 (Wed, 16 Feb 2011)
New Revision: 21691
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richCalendar/list.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richCalendar/simple.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/AbstractCalendarTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarBasic.java
Log:
added a new sample for calendar - using f:ajax
tests for calendar refactored
added 5 new tests
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richCalendar/list.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richCalendar/list.xhtml 2011-02-16
12:58:26 UTC (rev 21690)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richCalendar/list.xhtml 2011-02-16
12:59:07 UTC (rev 21691)
@@ -35,6 +35,10 @@
Simple page containing <b>rich:calendar</b> and inputs for
all its attributes.
</metamer:testPageLink>
+ <metamer:testPageLink id="fAjax" outcome="fAjax"
value="f:ajax">
+ Simple page containing <b>rich:calendar</b> with f:ajax and
inputs for all its attributes.
+ </metamer:testPageLink>
+
<metamer:testPageLink id="dataModel"
outcome="dataModel" value="Data Model">
Page containing <b>rich:calendar</b> with data model and
inputs for all its attributes.
</metamer:testPageLink>
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richCalendar/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richCalendar/simple.xhtml 2011-02-16
12:58:26 UTC (rev 21690)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richCalendar/simple.xhtml 2011-02-16
12:59:07 UTC (rev 21691)
@@ -159,7 +159,7 @@
verticalOffset="#{richCalendarBean.attributes['verticalOffset'].value}"
zindex="#{richCalendarBean.attributes['zindex'].value}"
- <a4j:ajax event="change"
render="output, phasesPanel" limitRender="#{true}"/>
+ <a4j:ajax event="change" render="output,
phasesPanel" />
</rich:calendar>
</div>
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/AbstractCalendarTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/AbstractCalendarTest.java 2011-02-16
12:58:26 UTC (rev 21690)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/AbstractCalendarTest.java 2011-02-16
12:59:07 UTC (rev 21691)
@@ -21,6 +21,19 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richCalendar;
+import static
org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.faces.event.PhaseId;
+
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
@@ -99,4 +112,99 @@
protected JQueryLocator dateEditorYears =
pjq("div[id$=calendarDateEditorLayoutY{0}]");
// other
protected JQueryLocator output = pjq("span[id$=output]");
+
+ public void testOpenPopupClickOnInput() {
+ guardNoRequest(selenium).click(input);
+ assertTrue(selenium.isDisplayed(popup), "Popup should be visible.");
+ }
+
+ public void testOpenPopupClickOnImage() {
+ guardNoRequest(selenium).click(image);
+ assertTrue(selenium.isDisplayed(popup), "Popup should be visible.");
+ }
+
+ public void testHeaderButtons() {
+ selenium.click(input);
+
+ boolean displayed = selenium.isDisplayed(prevYearButton);
+ assertTrue(displayed, "Previous year button should be visible.");
+ String buttonText = selenium.getText(prevYearButton);
+ assertEquals(buttonText, "<<", "Previous year
button");
+
+ displayed = selenium.isDisplayed(prevMonthButton);
+ assertTrue(displayed, "Previous month button should be visible.");
+ buttonText = selenium.getText(prevMonthButton);
+ assertEquals(buttonText, "<", "Previous month button");
+
+ displayed = selenium.isDisplayed(nextMonthButton);
+ assertTrue(displayed, "Next month button should be visible.");
+ buttonText = selenium.getText(nextMonthButton);
+ assertEquals(buttonText, ">", "Next month button");
+
+ displayed = selenium.isDisplayed(nextYearButton);
+ assertTrue(displayed, "Next year button should be visible.");
+ buttonText = selenium.getText(nextYearButton);
+ assertEquals(buttonText, ">>", "Next year button");
+
+ displayed = selenium.isDisplayed(closeButton);
+ assertTrue(displayed, "Close button should be visible.");
+ buttonText = selenium.getText(closeButton);
+ assertEquals(buttonText, "x", "Close button");
+ }
+
+ public void testFooterButtons() {
+ selenium.click(input);
+
+ boolean displayed = selenium.isDisplayed(todayButton);
+ assertTrue(displayed, "Today button should be visible.");
+ String buttonText = selenium.getText(todayButton);
+ assertEquals(buttonText, "Today", "Button's text");
+
+ displayed = selenium.isDisplayed(applyButton);
+ assertTrue(displayed, "Apply button should be visible.");
+ buttonText = selenium.getText(applyButton);
+ assertEquals(buttonText, "Apply", "Button's text");
+
+ displayed = selenium.isElementPresent(cleanButton);
+ assertFalse(displayed, "Clean button should not be visible.");
+
+ displayed = selenium.isElementPresent(timeButton);
+ assertFalse(displayed, "Time button should not be visible.");
+
+ selenium.click(cellWeekDay.format(3, 3));
+
+ displayed = selenium.isDisplayed(cleanButton);
+ assertTrue(displayed, "Clean button should be visible.");
+ buttonText = selenium.getText(cleanButton);
+ assertEquals(buttonText, "Clean", "Button's text");
+
+ displayed = selenium.isDisplayed(timeButton);
+ assertTrue(displayed, "Time button should be visible.");
+ buttonText = selenium.getText(timeButton);
+ assertEquals(buttonText, "12:00", "Button's text");
+ }
+
+ public void testApplyButton() {
+ selenium.click(input);
+
+ selenium.click(cellDay.format(6));
+ String day = selenium.getText(cellDay.format(6));
+ String month = selenium.getText(monthLabel);
+
+ String selectedDate = null;
+ try {
+ Date date = new SimpleDateFormat("d MMMM, yyyy hh:mm").parse(day +
" " + month + " 12:00");
+ selectedDate = new SimpleDateFormat("MMM d, yyyy
hh:mm").format(date);
+ } catch (ParseException ex) {
+ fail(ex.getMessage());
+ }
+
+ guardXhr(selenium).click(applyButton);
+ assertFalse(selenium.isDisplayed(popup), "Popup should not be
displayed.");
+
+ String inputDate = selenium.getValue(input);
+ assertEquals(inputDate, selectedDate, "Input doesn't contain selected
date.");
+
+ phaseInfo.assertListener(PhaseId.PROCESS_VALIDATIONS, "value changed: null
-> " + selectedDate);
+ }
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarBasic.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarBasic.java 2011-02-16
12:58:26 UTC (rev 21690)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richCalendar/TestRichCalendarBasic.java 2011-02-16
12:59:07 UTC (rev 21691)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -33,6 +33,7 @@
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.testng.annotations.Test;
@@ -68,45 +69,21 @@
}
@Test
+ @Override
public void testOpenPopupClickOnInput() {
- guardNoRequest(selenium).click(input);
- assertTrue(selenium.isDisplayed(popup), "Popup should be visible.");
+ super.testOpenPopupClickOnInput();
}
@Test
+ @Override
public void testOpenPopupClickOnImage() {
- guardNoRequest(selenium).click(image);
- assertTrue(selenium.isDisplayed(popup), "Popup should be visible.");
+ super.testOpenPopupClickOnImage();
}
@Test
+ @Override
public void testHeaderButtons() {
- selenium.click(input);
-
- boolean displayed = selenium.isDisplayed(prevYearButton);
- assertTrue(displayed, "Previous year button should be visible.");
- String buttonText = selenium.getText(prevYearButton);
- assertEquals(buttonText, "<<", "Previous year
button");
-
- displayed = selenium.isDisplayed(prevMonthButton);
- assertTrue(displayed, "Previous month button should be visible.");
- buttonText = selenium.getText(prevMonthButton);
- assertEquals(buttonText, "<", "Previous month button");
-
- displayed = selenium.isDisplayed(nextMonthButton);
- assertTrue(displayed, "Next month button should be visible.");
- buttonText = selenium.getText(nextMonthButton);
- assertEquals(buttonText, ">", "Next month button");
-
- displayed = selenium.isDisplayed(nextYearButton);
- assertTrue(displayed, "Next year button should be visible.");
- buttonText = selenium.getText(nextYearButton);
- assertEquals(buttonText, ">>", "Next year button");
-
- displayed = selenium.isDisplayed(closeButton);
- assertTrue(displayed, "Close button should be visible.");
- buttonText = selenium.getText(closeButton);
- assertEquals(buttonText, "x", "Close button");
+ super.testHeaderButtons();
}
@Test
@@ -119,36 +96,9 @@
}
@Test
+ @Override
public void testFooterButtons() {
- selenium.click(input);
-
- boolean displayed = selenium.isDisplayed(todayButton);
- assertTrue(displayed, "Today button should be visible.");
- String buttonText = selenium.getText(todayButton);
- assertEquals(buttonText, "Today", "Button's text");
-
- displayed = selenium.isDisplayed(applyButton);
- assertTrue(displayed, "Apply button should be visible.");
- buttonText = selenium.getText(applyButton);
- assertEquals(buttonText, "Apply", "Button's text");
-
- displayed = selenium.isElementPresent(cleanButton);
- assertFalse(displayed, "Clean button should not be visible.");
-
- displayed = selenium.isElementPresent(timeButton);
- assertFalse(displayed, "Time button should not be visible.");
-
- selenium.click(cellWeekDay.format(3, 3));
-
- displayed = selenium.isDisplayed(cleanButton);
- assertTrue(displayed, "Clean button should be visible.");
- buttonText = selenium.getText(cleanButton);
- assertEquals(buttonText, "Clean", "Button's text");
-
- displayed = selenium.isDisplayed(timeButton);
- assertTrue(displayed, "Time button should be visible.");
- buttonText = selenium.getText(timeButton);
- assertEquals(buttonText, "12:00", "Button's text");
+ super.testFooterButtons();
}
@Test
@@ -310,25 +260,8 @@
}
@Test
+ @Override
public void testApplyButton() {
- selenium.click(input);
-
- selenium.click(cellDay.format(6));
- String day = selenium.getText(cellDay.format(6));
- String month = selenium.getText(monthLabel);
-
- String selectedDate = null;
- try {
- Date date = new SimpleDateFormat("d MMMM, yyyy hh:mm").parse(day +
" " + month + " 12:00");
- selectedDate = new SimpleDateFormat("MMM d, yyyy
hh:mm").format(date);
- } catch (ParseException ex) {
- fail(ex.getMessage());
- }
-
- guardXhr(selenium).click(applyButton);
- assertFalse(selenium.isDisplayed(popup), "Popup should not be
displayed.");
-
- String inputDate = selenium.getValue(input);
- assertEquals(inputDate, selectedDate, "Input doesn't contain selected
date.");
+ super.testApplyButton();
}
}