Repository: tapestry-5 Updated Branches: refs/heads/master 4d45afaf2 -> 14524fecd
use org.apache.tapestry5.test.SeleniumTestCase.waitForAjaxRequestsToComplete() instead of sleeping for a fixed amount of time Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/6a63e750 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/6a63e750 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/6a63e750 Branch: refs/heads/master Commit: 6a63e750ed8d245b83199d04d79b28eb3076603b Parents: 4d45afa Author: Jochen Kemnade <jochen.kemn...@eddyson.de> Authored: Tue May 6 09:03:45 2014 +0200 Committer: Jochen Kemnade <jochen.kemn...@eddyson.de> Committed: Tue May 6 09:03:45 2014 +0200 ---------------------------------------------------------------------- .../tapestry5/integration/app1/AlertsTests.groovy | 4 ++-- .../tapestry5/integration/TapestryCoreTestCase.java | 4 ++++ .../apache/tapestry5/integration/app1/AjaxTests.java | 8 ++++---- .../apache/tapestry5/integration/app1/CacheTests.java | 2 +- .../apache/tapestry5/integration/app1/FormTests.java | 6 +++--- .../apache/tapestry5/integration/app1/GridTests.java | 4 ++-- .../tapestry5/integration/app1/ZoneRefreshTest.java | 4 ++-- .../apache/tapestry5/integration/app1/ZoneTests.java | 12 ++++++------ 8 files changed, 24 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6a63e750/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy index ed540cd..4cf2aa9 100644 --- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy +++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/AlertsTests.groovy @@ -49,7 +49,7 @@ class AlertsTests extends App1TestCase { click "css=$CONTAINER button.close" - sleep AJAX_WAIT_TIME + waitForAjaxRequestsToComplete() // Check that the alert container is now empty @@ -146,7 +146,7 @@ class AlertsTests extends App1TestCase { click "//input[@value='Ajax Update']" - sleep AJAX_WAIT_TIME + waitForAjaxRequestsToComplete() waitForCSSSelectedElementToAppear "div.t-error" http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6a63e750/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java index fb54010..1c3baa7 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/TapestryCoreTestCase.java @@ -24,6 +24,10 @@ public abstract class TapestryCoreTestCase extends SeleniumTestCase public static final String TEST_APP_BANNER = "Tapestry Integration Test Application"; // Rule of thumb time, in ms, to wait for Ajax to occur. + /** + *@deprecated Use {@link #waitForAjaxRequestsToComplete()} + */ + @Deprecated public static final int AJAX_WAIT_TIME = 250; protected final void assertTextSeries(String idFormat, int startIndex, String... values) http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6a63e750/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java index 528054f..956b3fb 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/AjaxTests.java @@ -185,7 +185,7 @@ public class AjaxTests extends App1TestCase click("link=Add another value"); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); type("//input[@type='text'][1]", "5.1"); @@ -195,7 +195,7 @@ public class AjaxTests extends App1TestCase click("link=remove"); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); clickAndWait(SUBMIT); @@ -211,7 +211,7 @@ public class AjaxTests extends App1TestCase click("link=Add another value"); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); type("//input[@type='text'][1]", "5.1"); @@ -221,7 +221,7 @@ public class AjaxTests extends App1TestCase click("css=.glyphicon-trash"); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); clickAndWait(SUBMIT); http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6a63e750/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CacheTests.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CacheTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CacheTests.java index 6f9cb2a..6dccd83 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CacheTests.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CacheTests.java @@ -35,7 +35,7 @@ public class CacheTests extends App1TestCase click("link=update"); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); String time2_1 = getText("time1"); String time2_2 = getText("time1"); http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6a63e750/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java index b0bf953..15b3af5 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/FormTests.java @@ -205,7 +205,7 @@ public class FormTests extends App1TestCase click("css=.x-birthday .btn"); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); assertText("//A[@class='topLabel']", "1966 d\u00e9cembre"); } @@ -243,7 +243,7 @@ public class FormTests extends App1TestCase click("css=.x-impact .btn"); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); assertSourcePresent("Unparseable date: \"<script>alert('T5 is great'); </script>\""); } @@ -374,7 +374,7 @@ public class FormTests extends App1TestCase //immediately after picking the month label, so we sleep the test for a few seconds to provide //ammple time for the bug to manifest. - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); assertTrue(isVisible("css=div.datePicker")); } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6a63e750/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java index 37407e5..1a55695 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java @@ -273,11 +273,11 @@ public class GridTests extends App1TestCase String timestamp = getText("lastupdate"); click("link=2"); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); click("link=Album"); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); assertEquals(getText("lastupdate"), timestamp, "Timestamp should not have changed because updates are in-place."); http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6a63e750/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneRefreshTest.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneRefreshTest.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneRefreshTest.java index 51bc760..c18890c 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneRefreshTest.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneRefreshTest.java @@ -27,7 +27,7 @@ public class ZoneRefreshTest extends App1TestCase clickAndWait("link=Zone Refresh With Event Handler Returning Void"); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); checkZoneValues("zone", 3); } @@ -39,7 +39,7 @@ public class ZoneRefreshTest extends App1TestCase clickAndWait("link=Zone Refresh With Event Handler Returning Zone"); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); checkZoneValues("zone", 3); } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/6a63e750/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java index e2497a7..b997e03 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ZoneTests.java @@ -33,7 +33,7 @@ public class ZoneTests extends App1TestCase select("carMaker", "Bmw"); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); click(SUBMIT); @@ -51,7 +51,7 @@ public class ZoneTests extends App1TestCase select("carMaker", "Mercedes"); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); select(selectLocator, "E-Class"); @@ -71,7 +71,7 @@ public class ZoneTests extends App1TestCase click("link=Select \"Mr. <Roboto>\""); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); assertTextPresent("Selected: Mr. <Roboto>"); @@ -141,7 +141,7 @@ public class ZoneTests extends App1TestCase click(SUBMIT); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); waitForElementToAppear("message"); @@ -162,7 +162,7 @@ public class ZoneTests extends App1TestCase // Give it some time to process. - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); assertText("zone-update-message", "Zone updated."); } @@ -318,7 +318,7 @@ public class ZoneTests extends App1TestCase click("link=Update zone with empty body"); - sleep(AJAX_WAIT_TIME); + waitForAjaxRequestsToComplete(); assertText("zone-update-message", "Zone updated."); }