Author: ppitonak(a)redhat.com
Date: 2010-01-05 07:32:43 -0500 (Tue, 05 Jan 2010)
New Revision: 16239
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/fileUpload/FileUploadTestCase.java
Log:
https://jira.jboss.org/jira/browse/RFPL-318
* test case refactored in order to provide more stable results
Modified:
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/fileUpload/FileUploadTestCase.java
===================================================================
---
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/fileUpload/FileUploadTestCase.java 2010-01-05
12:08:08 UTC (rev 16238)
+++
branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/fileUpload/FileUploadTestCase.java 2010-01-05
12:32:43 UTC (rev 16239)
@@ -272,7 +272,12 @@
waitFor(3000);
selenium.attachFile(LOC_ADD_BUTTON, "file://" + FILE_CYAN);
- waitForElement(LOC_UPLOADED_LIST_TR);
+ Wait.failWith("Files were not uploaded.").until(new Condition() {
+ public boolean isTrue() {
+ return getJQueryCount(LOC_UPLOADED_LIST_TR) == 1;
+ }
+ });
+
count = getJQueryCount(LOC_UPLOADED_LIST_TR);
assertEquals(count, 1, MSG_RIGHT_PANEL_NUMBER_OF_ITEMS);
}
@@ -340,7 +345,11 @@
assertFalse(isDisplayed(LOC_CLEAR_ALL_BUTTON_STYLE),
MSG_CLEAR_ALL_BUTTON_NOT_VISIBLE);
selenium.click(LOC_UPLOAD_BUTTON);
- waitForElement(LOC_UPLOADED_LIST_TR);
+ Wait.failWith("Files were not uploaded.").until(new Condition() {
+ public boolean isTrue() {
+ return getJQueryCount(LOC_UPLOADED_LIST_TR) == 2;
+ }
+ });
assertTrue(isDisplayed(LOC_CLEAR_ALL_BUTTON_STYLE),
MSG_CLEAR_ALL_BUTTON_VISIBLE);
@@ -367,11 +376,19 @@
assertFalse(selenium.isElementPresent(LOC_CLEAR_UPLOADED_DATA_BUTTON),
MSG_CLEAR_UPLOADED_DATA_BUTTON_NOT_VISIBLE);
- waitFor(2000);
+ Wait.failWith("There should be 2 files in the list.").until(new
Condition() {
+ public boolean isTrue() {
+ return getJQueryCount(LOC_NOT_UPLOADED_LIST_TR) == 2;
+ }
+ });
selenium.click(LOC_UPLOAD_BUTTON);
- waitForElement(LOC_UPLOADED_LIST_TR);
-
+ Wait.failWith("Files were not uploaded").until(new Condition() {
+ public boolean isTrue() {
+ return getJQueryCount(LOC_UPLOADED_LIST_TR) == 2;
+ }
+ });
+
assertTrue(selenium.isElementPresent(LOC_CLEAR_UPLOADED_DATA_BUTTON),
MSG_CLEAR_UPLOADED_DATA_BUTTON_VISIBLE);
selenium.click(LOC_CLEAR_UPLOADED_DATA_BUTTON);