Author: jpapouse
Date: 2011-09-23 08:29:35 -0400 (Fri, 23 Sep 2011)
New Revision: 22735
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richTab/simple.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java
Log:
RFPL-1354: added test for action listener (rich:tab)
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richTab/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richTab/simple.xhtml 2011-09-23
08:44:46 UTC (rev 22734)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richTab/simple.xhtml 2011-09-23
12:29:35 UTC (rev 22735)
@@ -38,8 +38,7 @@
<ui:define name="component">
- <rich:tabPanel id="tabPanel"
-
itemChangeListener="#{richBean.itemChangeListener}">
+ <rich:tabPanel id="tabPanel">
<rich:tab id="tab1"
action="#{richBean.dummyAction}"
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java 2011-09-23
08:44:46 UTC (rev 22734)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richTab/TestRichTab.java 2011-09-23
12:29:35 UTC (rev 22735)
@@ -21,9 +21,11 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richTab;
+import static java.text.MessageFormat.format;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardHttp;
import static
org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardNoRequest;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
@@ -48,7 +50,10 @@
* @version $Revision$
*/
public class TestRichTab extends AbstractMetamerTest {
-
+
+ private static final JQueryLocator PHASE_FORMAT = jq("div#phasesPanel
li:eq({0})");
+ private static final String PHASE_LISTENER_LOG = "* action listener
invoked";
+
private JQueryLocator panel = pjq("div[id$=tabPanel]");
private JQueryLocator[] itemContents = {pjq("div[id$=tab1] >
div.rf-tab-cnt"), pjq("div[id$=tab2] > div.rf-tab-cnt"),
pjq("div[id$=tab3] > div.rf-tab-cnt"), pjq("div[id$=tab4] >
div.rf-tab-cnt"), pjq("div[id$=tab5] > div.rf-tab-cnt")};
@@ -58,7 +63,8 @@
pjq("td[id$=tab3:header:inactive]"),
pjq("td[id$=tab4:header:inactive]"),
pjq("td[id$=tab5:header:inactive]")};
private JQueryLocator[] disabledHeaders =
{pjq("td[id$=tab1:header:disabled]"),
pjq("td[id$=tab2:header:disabled]"),
pjq("td[id$=tab3:header:disabled]"),
pjq("td[id$=tab4:header:disabled]"),
pjq("td[id$=tab5:header:disabled]")};
- private JQueryLocator tab = pjq("div[id$=tab1]");
+ private JQueryLocator tab1 = pjq("div[id$=tab1]");
+
@Override
public URL getTestUrl() {
@@ -66,6 +72,24 @@
}
@Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-11427")
+ public void testActionListener() {
+ retrieveRequestTime.initializeValue();
+ selenium.click(pjq("input[id$=nextTabButton]"));
+ waitAjax.waitForChange(retrieveRequestTime);
+
+ retrieveRequestTime.initializeValue();
+ selenium.click(pjq("input[id$=prevTabButton]"));
+ waitAjax.waitForChange(retrieveRequestTime);
+
+ waitGui
+ .failWith("Expected <" + PHASE_LISTENER_LOG + ">, found
<" + selenium.getText(PHASE_FORMAT.format(5)) + ">")
+ .until(textEquals.locator(PHASE_FORMAT.format(5)).text(
+ PHASE_LISTENER_LOG)
+ );
+ }
+
+ @Test
public void testInit() {
boolean displayed = selenium.isDisplayed(panel);
assertTrue(displayed, "Tab panel is not present on the page.");
@@ -98,7 +122,7 @@
@Test
public void testDir() {
- testDir(tab);
+ testDir(tab1);
}
@Test
@@ -215,7 +239,7 @@
@Test
public void testLang() {
- testLang(tab);
+ testLang(tab1);
}
@Test
@@ -233,12 +257,12 @@
@Test
public void testOnclick() {
- testFireEvent(Event.CLICK, tab);
+ testFireEvent(Event.CLICK, tab1);
}
@Test
public void testOndblclick() {
- testFireEvent(Event.DBLCLICK, tab);
+ testFireEvent(Event.DBLCLICK, tab1);
}
@Test
@@ -304,27 +328,27 @@
@Test
public void testOnmousedown() {
- testFireEvent(Event.MOUSEDOWN, tab);
+ testFireEvent(Event.MOUSEDOWN, tab1);
}
@Test
public void testOnmousemove() {
- testFireEvent(Event.MOUSEMOVE, tab);
+ testFireEvent(Event.MOUSEMOVE, tab1);
}
@Test
public void testOnmouseout() {
- testFireEvent(Event.MOUSEOUT, tab);
+ testFireEvent(Event.MOUSEOUT, tab1);
}
@Test
public void testOnmouseover() {
- testFireEvent(Event.MOUSEOVER, tab);
+ testFireEvent(Event.MOUSEOVER, tab1);
}
@Test
public void testOnmouseup() {
- testFireEvent(Event.MOUSEUP, tab);
+ testFireEvent(Event.MOUSEUP, tab1);
}
@Test
@@ -336,17 +360,17 @@
assertFalse(selenium.isElementPresent(activeHeaders[0]), "Tab should not be
rendered when rendered=false.");
assertFalse(selenium.isElementPresent(inactiveHeaders[0]), "Tab should not
be rendered when rendered=false.");
assertFalse(selenium.isElementPresent(disabledHeaders[0]), "Tab should not
be rendered when rendered=false.");
- assertFalse(selenium.isElementPresent(tab), "Tab should not be rendered when
rendered=false.");
+ assertFalse(selenium.isElementPresent(tab1), "Tab should not be rendered
when rendered=false.");
}
@Test
public void testStyle() {
- testStyle(tab);
+ testStyle(tab1);
}
@Test
public void testStyleClass() {
- testStyleClass(tab);
+ testStyleClass(tab1);
}
@Test
@@ -396,6 +420,6 @@
@Test
public void testTitle() {
- testTitle(tab);
+ testTitle(tab1);
}
}