On Mar 11, 2008, at 7:35 PM, jvelociter (SVN) wrote:
Author: jvelociter
Date: 2008-03-11 19:35:40 +0100 (Tue, 11 Mar 2008)
New Revision: 8409
Modified:
xwiki-products/xwiki-watch/trunk/distribution-test/selenium-tests/
src/test/it/com/xpn/xwiki/watch/it/selenium/WatchGWTLoadingTest.java
Log:
XWATCH-118 Add an integration test that ensure Watch loads in the
distribution
- I modified the test so that it waits for GWT to load after the
page loading. I don't really like the solution I came up with
(Thread.sleep), but I could not find a way to wait without any
condition. The Selenium waitForCondition() method with JS argument
could be investigated, but I'm not sure it's easy to hook with GWT
loading.
Modified: xwiki-products/xwiki-watch/trunk/distribution-test/
selenium-tests/src/test/it/com/xpn/xwiki/watch/it/selenium/
WatchGWTLoadingTest.java
===================================================================
--- xwiki-products/xwiki-watch/trunk/distribution-test/selenium-
tests/src/test/it/com/xpn/xwiki/watch/it/selenium/
WatchGWTLoadingTest.java 2008-03-11 17:21:49 UTC (rev 8408)
+++ xwiki-products/xwiki-watch/trunk/distribution-test/selenium-
tests/src/test/it/com/xpn/xwiki/watch/it/selenium/
WatchGWTLoadingTest.java 2008-03-11 18:35:40 UTC (rev 8409)
@@ -19,6 +19,8 @@
*/
package com.xpn.xwiki.watch.it.selenium;
+import java.lang.InterruptedException;
+
import com.xpn.xwiki.it.selenium.framework.AbstractXWikiTestCase;
import com.xpn.xwiki.it.selenium.framework.AlbatrossSkinExecutor;
import com.xpn.xwiki.it.selenium.framework.XWikiTestSuite;
@@ -49,7 +51,20 @@
public void testGWTLoading()
{
open("/xwiki/bin/view/Watch/Reader");
- getSelenium().waitForPageToLoad("50000");
+ // Wait for the reader page to load
+ getSelenium().waitForPageToLoad("2000");
+ // Now wait for the GWT reader to load.
+ try
+ {
+ // this is a bit dirty, but I could not find an easy way
+ // to ask Selenium to just wait, without conditions.
+ // We could investigate the use of waitForCondition()
with a JS function argument
+ // althought it seems it will be a bit heavy to setup
for this use case.
+ Thread.sleep(500);
+ }
+ catch (InterruptedException e){
+ fail();
+ }
You could start by removing the try/catch and add a throw Exception to
the method.
How do we know the GWT reader page is loaded? Isn't there some DOM
element or something that will tell us and that we could wait on?
Thanks
-Vincent