continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jzurb...@apache.org
Subject svn commit: r921322 - in /continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent: AbstractReleaseTest.java AbstractSeleniumTest.java
Date Wed, 10 Mar 2010 12:05:07 GMT
Author: jzurbano
Date: Wed Mar 10 12:05:06 2010
New Revision: 921322

URL: http://svn.apache.org/viewvc?rev=921322&view=rev
Log:
[CONTINUUM-2482] - Replace the use of Thread.sleep to Selenium waitForCondition
* added waitForCondition() which accepts only the condition and uses maxWaitTimeInMs for timeout
in Selenium waitForCondition()
* replaced Thread.sleep to use waitForCondition in AbstractReleaseTest assertRelease()


Modified:
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractReleaseTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractReleaseTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractReleaseTest.java?rev=921322&r1=921321&r2=921322&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractReleaseTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractReleaseTest.java
Wed Mar 10 12:05:06 2010
@@ -111,18 +111,11 @@ public abstract class AbstractReleaseTes
     public void assertRelease( boolean success )
         throws Exception
     {
-        int currentIt = 1;
-        int maxIt = 20;
+        // condition for release is complete; "Done" button or "Release Error" in page is
present
+        String condition = "( selenium.browserbot.getCurrentWindow().document.getElementById(
'releaseCleanup_0' ) != null || " +
+                           "selenium.browserbot.getCurrentWindow().document.body.innerHTML.search(
'Release Error' ) > 0 )";
 
-        while ( !isButtonWithValuePresent( "Done" ) && !isTextPresent( "Release Error"
) )
-        {
-            Thread.sleep( 10000 );
-            if ( currentIt > maxIt )
-            {
-                Assert.fail( "Timeout, Can't release project" );
-            }
-            currentIt++;
-        }
+        waitForCondition( condition );
 
         assertButtonWithValuePresent( "Rollback changes" );
     

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java?rev=921322&r1=921321&r2=921322&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
Wed Mar 10 12:05:06 2010
@@ -459,4 +459,10 @@ public abstract class AbstractSeleniumTe
     {
         getSelenium().removeSelection( locator, "label=" + text );
     }
+    
+    public void waitForCondition( String condition )
+        throws Exception
+    {
+        getSelenium().waitForCondition( condition, maxWaitTimeInMs );
+    }
 }



Mime
View raw message