Author: lfryc(a)redhat.com
Date: 2009-09-15 18:21:41 -0400 (Tue, 15 Sep 2009)
New Revision: 15588
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataFilterSlider/DataFilterSliderTestCase.java
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dataFilterSlider/locators.properties
Log:
- DataFilterSliderTestCase - added waiting loop for table text stabilizes after slider
movement; removed code taking screenshot; the result can be empty in testComplexSlider if
the minimal limit is chosen (now testing for non-empty result set for maximal limit)
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataFilterSlider/DataFilterSliderTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataFilterSlider/DataFilterSliderTestCase.java 2009-09-15
17:34:28 UTC (rev 15587)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataFilterSlider/DataFilterSliderTestCase.java 2009-09-15
22:21:41 UTC (rev 15588)
@@ -21,7 +21,6 @@
*******************************************************************************/
package org.jboss.richfaces.integrationTest.dataFilterSlider;
-import java.io.File;
import java.util.LinkedList;
import java.util.List;
@@ -30,6 +29,7 @@
import org.jboss.richfaces.integrationTest.AbstractDataIterationTestCase;
import org.jboss.test.selenium.waiting.Condition;
import org.jboss.test.selenium.waiting.Wait;
+import org.jboss.test.selenium.waiting.Wait.Waiting;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -46,7 +46,6 @@
private final String LOC_DIV_SLIDER_HANDLE = getLoc("DIV_SLIDER_HANDLE");
private final String LOC_DIV_SLIDER_TRACK = getLoc("DIV_SLIDER_TRACK");
private final String LOC_INPUT_MAX_PRICE = getLoc("INPUT_MAX_PRICE");
- private final String LOC_TABLE_FILTERED_CAR_LIST =
getLoc("TABLE_FILTERED_CAR_LIST");
private final int MSG_COUNT_MAX_ROWS =
Integer.valueOf(getMsg("COUNT_MAX_ROWS"));
private final String MSG_CHOICES_OF_BRANDS = getMsg("CHOICES_OF_BRANDS");
@@ -92,15 +91,8 @@
assertTrue(allMileages.size() >= MSG_COUNT_MAX_ROWS ||
allMileages.containsAll(highMileages));
assertTrue(highMileages.size() >= MSG_COUNT_MAX_ROWS ||
highMileages.containsAll(lowMileages));
assertTrue(lowMileages.size() >= MSG_COUNT_MAX_ROWS ||
lowMileages.containsAll(lowestMileages));
- // TODO remove taking screenshot when lowestMileages is empty
- if (lowestMileages.isEmpty()) {
- scrollIntoView(LOC_DIV_SLIDER_TRACK, true);
- selenium.captureScreenshot(new File("screenshot-" +
this.getClass().getSimpleName() + "-01.png").toString());
- scrollIntoView(LOC_TABLE_FILTERED_CAR_LIST, true);
- selenium.captureScreenshot(new File("screenshot-" +
this.getClass().getSimpleName() + "-02.png").toString());
- }
// check that there is at least one mileage greater than slider minimum
- assertFalse(lowestMileages.isEmpty());
+ assertFalse(allMileages.isEmpty());
}
/**
@@ -182,8 +174,40 @@
return
!handlePosition.equals(selenium.getElementPositionLeft(LOC_DIV_SLIDER_HANDLE));
}
});
+
+ waitTableTextStabilizes.until(conditionTableTextStabilizes);
}
+
+ private Waiting waitTableTextStabilizes =
Wait.interval(100).timeout(10000).failWith("Table text never got stabilized");
+
+ private Condition conditionTableTextStabilizes = new Condition() {
+ String memory;
+ int count = 0;
+ public boolean isTrue() {
+ String actual = selenium.getText(LOC_TABLE_COMMON);
+
+ if (memory == null) {
+ memory = actual;
+ return false;
+ }
+
+ if (memory.equals(actual)) {
+ count++;
+ } else {
+ count = 0;
+ }
+
+ if (count >= 10) {
+ return true;
+ }
+
+ memory = actual;
+
+ return false;
+ }
+};
+
@SuppressWarnings("unused")
@BeforeMethod
private void loadPage() {
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dataFilterSlider/locators.properties
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dataFilterSlider/locators.properties 2009-09-15
17:34:28 UTC (rev 15587)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/resources/org/jboss/richfaces/integrationTest/dataFilterSlider/locators.properties 2009-09-15
22:21:41 UTC (rev 15588)
@@ -5,4 +5,3 @@
INPUT_MAX_PRICE=//*[@type\='text' and
contains(@class,'rich-dataFilterSlider-input-field')]
DIV_SLIDER_HANDLE=//*[contains(@class,'rich-dataFilterSlider-handle')]
DIV_SLIDER_TRACK=//*[contains(@class,'rich-dataFilterSlider-track')]
-TABLE_FILTERED_CAR_LIST=//*[contains(@id,'carList') and
*/@class\='rich-table-thead']
Show replies by date