Author: ppitonak(a)redhat.com
Date: 2011-12-05 11:21:51 -0500 (Mon, 05 Dec 2011)
New Revision: 23043
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataScroller.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestScroller.java
Log:
tests for scroller in list refactored
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataScroller.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataScroller.java 2011-12-05
16:13:37 UTC (rev 23042)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/model/DataScroller.java 2011-12-05
16:21:51 UTC (rev 23043)
@@ -25,6 +25,7 @@
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
import static org.jboss.test.selenium.locator.reference.ReferencedLocator.ref;
import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.testng.Assert.fail;
import org.jboss.test.selenium.framework.AjaxSelenium;
import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
@@ -116,14 +117,27 @@
if (lastPage != null && (pageNumber < 1 || pageNumber > lastPage))
{
throw new IllegalStateException(SimplifiedFormat.format("The given
pageNumber '{0}' is out of range of pages <1,{1}>", pageNumber,
lastPage));
}
- while (pageNumber > getLastVisiblePage()) {
+
+ int counter = 50; // to prevent infinite loops
+ while (pageNumber > getLastVisiblePage() && counter > 0) {
fastForward(pageNumber);
+ counter--;
}
- while (pageNumber < getFirstVisiblePage()) {
+ if (counter == 0) {
+ fail("Scroller doesn't change pages.");
+ }
+
+ counter = 50; // to prevent inifinite loops
+ while (pageNumber < getFirstVisiblePage() && counter > 0) {
fastRewind(pageNumber);
+ counter--;
}
+ if (counter == 0) {
+ fail("Scroller doesn't change pages.");
+ }
+
if (pageNumber == getCurrentPage()) {
return;
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestScroller.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestScroller.java 2011-12-05
16:13:37 UTC (rev 23042)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richList/TestScroller.java 2011-12-05
16:21:51 UTC (rev 23043)
@@ -5,6 +5,8 @@
import java.net.URL;
import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
+import org.richfaces.tests.metamer.ftest.annotations.Templates;
import org.richfaces.tests.metamer.ftest.annotations.Use;
import org.richfaces.tests.metamer.ftest.model.DataScroller;
import org.richfaces.tests.metamer.ftest.richDataScroller.PaginationTester;
@@ -44,13 +46,41 @@
int lastPage = dataScroller.obtainLastPage();
dataScroller.setLastPage(lastPage);
paginationTester.initializeTestedPages(lastPage);
-
+
dataScroller.setFastStep(1);
}
@Test
- @Use(field = "dataScroller", value = "dataScroller*")
- public void testScrollerWithRowsAttribute() {
+ @Use(field = "dataScroller", value = "dataScroller1")
+ @Templates(exclude = { "richDataTable",
"richCollapsibleSubTable", "richExtendedDataTable",
"richDataGrid",
+ "richList", "a4jRepeat", "hDataTable",
"uiRepeat" })
+ public void testScrollerWithRowsAttributeOut() {
paginationTester.testNumberedPages();
}
+
+ @Test
+ @Use(field = "dataScroller", value = "dataScroller1")
+ @IssueTracking("https://issues.jboss.org/browse/RF-11787")
+ @Templates(value = { "richDataTable", "richCollapsibleSubTable",
"richExtendedDataTable", "richDataGrid",
+ "richList", "a4jRepeat", "hDataTable",
"uiRepeat" })
+ public void testScrollerWithRowsAttributeOutIterationComponents() {
+ paginationTester.testNumberedPages();
+ }
+
+ @Test
+ @Use(field = "dataScroller", value = "dataScroller2")
+ @Templates(exclude = { "richDataTable",
"richCollapsibleSubTable", "richExtendedDataTable",
"richDataGrid",
+ "richList", "a4jRepeat" })
+ public void testScrollerWithRowsAttributeIn() {
+ paginationTester.testNumberedPages();
+ }
+
+ @Test
+ @Use(field = "dataScroller", value = "dataScroller2")
+ @IssueTracking("https://issues.jboss.org/browse/RF-11787")
+ @Templates(value = { "richDataTable", "richCollapsibleSubTable",
"richExtendedDataTable", "richDataGrid",
+ "richList", "a4jRepeat" })
+ public void testScrollerWithRowsAttributeInIterationComponents() {
+ paginationTester.testNumberedPages();
+ }
}
Show replies by date