rf-demo ftest - patch Wait.until() method to test conditions on the start of the loop
-------------------------------------------------------------------------------------
Key: RF-8177
URL:
https://jira.jboss.org/jira/browse/RF-8177
Project: RichFaces
Issue Type: Task
Security Level: Public (Everyone can see)
Components: functional-tests, QA-environment
Reporter: Lukas Fryc
Assignee: Lukas Fryc
Use following patch after solving related issues - some tests needs to be modifies (mainly
widely used abstractTestSource()):
Index: src/main/java/org/jboss/test/selenium/waiting/Wait.java
===================================================================
--- src/main/java/org/jboss/test/selenium/waiting/Wait.java (revision 16033)
+++ src/main/java/org/jboss/test/selenium/waiting/Wait.java (revision 16037)
@@ -373,8 +373,28 @@
}
/**
- * Stars loop waiting to satisfy condition.
+ * <p>Stars loop waiting to satisfy condition.</p>
*
+ * <p>The condition will be tested</p>
+ *
+ * <ul>
+ * <li>on the start,</li>
+ * <li>every time interval after last try</li>
+ * <li>and also once after timeout when finishes interval since last try before
timeout.</li>
+ * </ul>
+ *
+ * <p>Scheme:</p>
+ *
+ * <p><pre>S ..int.. T ..int.. T ..int1..timeout..int2..
L</pre></p>
+ *
+ * <p>
+ * <div>S - starting try</div>
+ * <div>T - try within intervals</div>
+ * <div>L - last try after timeout</div>
+ * <div>int - one interval</div>
+ * <div>int = int1 + int2</div>
+ * </p>
+ *
* @param condition
* what wait for to be satisfied
*/
@@ -382,13 +402,17 @@
long start = System.currentTimeMillis();
long end = start + timeout;
while (System.currentTimeMillis() < end) {
+ if (condition.isTrue())
+ return;
try {
Thread.sleep(interval);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
- if (condition.isTrue())
- return;
+ if (System.currentTimeMillis() >= end) {
+ if (condition.isTrue())
+ return;
+ }
}
fail();
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira