continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jzurb...@apache.org
Subject svn commit: r924712 - in /continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent: AbstractConfigurationTest.java AbstractContinuumTest.java AbstractSeleniumTest.java
Date Thu, 18 Mar 2010 11:21:14 GMT
Author: jzurbano
Date: Thu Mar 18 11:21:13 2010
New Revision: 924712

URL: http://svn.apache.org/viewvc?rev=924712&view=rev
Log:
[CONTINUUM-2482] - Replace the use of Thread.sleep to Selenium waitForCondition
* removed Thread.sleep in buildProjectGroup(), and waitForElementPresent()
* added call for waitPage() in goToConfigurationPage() -- wait for page to load before assertion
of elements


Modified:
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractConfigurationTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.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/AbstractConfigurationTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractConfigurationTest.java?rev=924712&r1=924711&r2=924712&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractConfigurationTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractConfigurationTest.java
Thu Mar 18 11:21:13 2010
@@ -29,6 +29,7 @@ public abstract class AbstractConfigurat
     public void goToConfigurationPage()
     {
         clickLinkWithText( "Configuration" );
+        waitPage();
         assertEditConfigurationPage();
     }
 

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java?rev=924712&r1=924711&r2=924712&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
Thu Mar 18 11:21:13 2010
@@ -373,66 +373,34 @@ public abstract class AbstractContinuumT
     public void buildProjectGroup(String projectGroupName,String groupId,String description,String
projectName )
         throws Exception
     {
-        int currentIt = 1;
-        int maxIt = 120; // 2 minutes each, not including refresh time
         showProjectGroup( projectGroupName, groupId, description );
+        waitForProjectUpdate();
         clickButtonWithValue( "Build all projects" );
 
-        int refreshInterval = 1000;
-        Thread.sleep( 10000 );
+        // wait for project to finish building
+        waitForProjectBuild();
+        
         getSelenium().refresh();
         waitPage();
         
-        // check if project group is updating from SCM
-        while ( isElementPresent( "//td/img[@alt='Updating']" ) )
+        // wait for the success status of project
+        if ( !isElementPresent( "//a/img[@alt='Success']" ) )
         {
-            Thread.sleep( refreshInterval );
-            getSelenium().refresh();
-            waitPage();
-            currentIt++;
-            if ( currentIt > maxIt )
-            {
-                Assert.fail( "Timeout, Can't update project group from SCM" );
-            }
+            waitForElementPresent( "//a/img[@alt='Success']" );
         }
-
-        Thread.sleep( refreshInterval );
+        
         getSelenium().refresh();
         waitPage();
-        currentIt = 1;
-
-        // check if project is building, or updating
-        while ( isElementPresent( "//img[@alt='Building']" ) || isElementPresent( "//img[@alt='Updating']"
) )
-        {
-            Thread.sleep( refreshInterval );
-            getSelenium().refresh();
-            waitPage();
-            currentIt++;
-            if ( currentIt > maxIt )
-            {
-                Assert.fail( "Timeout, Can't build project group" );
-            }
-        }
-
-        // TODO: investigate and remove
-        // sometimes the project is still building in the later checks, even though the above
has passed. This is here
-        // to help diagnose
-        if ( !isElementPresent( "//img[@alt='Success']" ) )
-        {
-            CaptureScreenShotsListener.captureScreenshotAndSource( getClass().getName() );
-        }
-
-        // TODO: investigate and remove
-        // not sure why this is needed, but the page seems to be partially loaded as the
screenshot can be
-        // correct even if the link is not yet present
+        
+        // wait for the projectName link
         if ( !isLinkPresent( projectName ) )
         {
-            CaptureScreenShotsListener.captureScreenshotAndSource( getClass().getName() );
-
-            // This seems to be enough to avoid it
-            Thread.sleep( 10000 );
+            waitForElementPresent( "link=" + projectName );
         }
 
+        getSelenium().refresh();
+        waitPage();
+
         clickLinkWithText( projectName );
         clickLinkWithText( "Builds" );
         clickLinkWithText( "Result" );

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=924712&r1=924711&r2=924712&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
Thu Mar 18 11:21:13 2010
@@ -418,23 +418,9 @@ public abstract class AbstractSeleniumTe
     }
 
     public void waitForElementPresent( String locator )
-        throws InterruptedException
+        throws Exception
     {
-        for ( int second = 0;; second++ )
-        {
-            if ( second >= 60 )
-                Assert.fail( "timeout" );
-            try
-            {
-                if ( isElementPresent( locator ) )
-                    break;
-            }
-            catch ( Exception e )
-            {
-            }
-            Thread.sleep( 1000 );
-            getSelenium().refresh();
-        }
+        waitForElementPresent( locator, true );
     }
     
     /*



Mime
View raw message