Updated Branches:
  refs/heads/master 93168cd8d -> 2dc469507

Extend the duration during which a page is allowed to initialize


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/b04bca4d
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/b04bca4d
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/b04bca4d

Branch: refs/heads/master
Commit: b04bca4d35c542bc4551423aa2c9715e053614b8
Parents: 93168cd
Author: Howard M. Lewis Ship <[email protected]>
Authored: Mon Nov 25 16:24:06 2013 -0800
Committer: Howard M. Lewis Ship <[email protected]>
Committed: Mon Nov 25 16:24:06 2013 -0800

----------------------------------------------------------------------
 .../org/apache/tapestry5/test/SeleniumTestCase.java   | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/b04bca4d/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
----------------------------------------------------------------------
diff --git 
a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java 
b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
index e731d48..04db500 100644
--- 
a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
+++ 
b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java
@@ -1173,7 +1173,8 @@ public abstract class SeleniumTestCase extends Assert 
implements Selenium
 
     /**
      * Waits for page  to load, then waits for initialization to finish, which 
is recognized by the {@code data-page-initialized} attribute
-     * being set to true on the body element. Polls at increasing intervals.
+     * being set to true on the body element. Polls at increasing intervals, 
for up-to 30 seconds (that's extraordinarily long, but helps sometimes
+     * when manually debugging a page that doesn't have the floating console 
enabled)..
      */
     public void waitForPageToLoad(String timeout)
     {
@@ -1188,8 +1189,9 @@ public abstract class SeleniumTestCase extends Assert 
implements Selenium
             return;
         }
 
-        int totalTime = 0;
-        int sleepTime = 20;
+        final long pollingStartTime = System.currentTimeMillis();
+
+        long sleepTime = 20;
 
         while (true)
         {
@@ -1198,15 +1200,13 @@ public abstract class SeleniumTestCase extends Assert 
implements Selenium
                 return;
             }
 
-            if (totalTime > 10000)
+            if ((System.currentTimeMillis() - pollingStartTime) > 30000)
             {
-                reportAndThrowAssertionError("Page did not finish 
initializing.");
+                reportAndThrowAssertionError("Page did not finish initializing 
after 30 seconds.");
             }
 
             sleep(sleepTime);
 
-            totalTime += sleepTime;
-
             sleepTime *= 2;
         }
     }

Reply via email to