continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r795184 - /continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/SetupContinuum.java
Date Fri, 17 Jul 2009 18:25:22 GMT
Author: carlos
Date: Fri Jul 17 18:25:22 2009
New Revision: 795184

URL: http://svn.apache.org/viewvc?rev=795184&view=rev
Log:
Avoid race conditions when several browsers try to register the admin user

Modified:
    continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/SetupContinuum.java

Modified: continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/SetupContinuum.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/SetupContinuum.java?rev=795184&r1=795183&r2=795184&view=diff
==============================================================================
--- continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/SetupContinuum.java
(original)
+++ continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/SetupContinuum.java
Fri Jul 17 18:25:22 2009
@@ -31,7 +31,7 @@
     extends AbstractContinuumTest
 {
 
-     public void initializeContinuumIfNeeded()
+    public void initializeContinuumIfNeeded()
         throws Exception
     {
         getSelenium().open( baseUrl );
@@ -44,10 +44,26 @@
             String mail = getProperty( "ADMIN_MAIL" );
             String password = getProperty( "ADMIN_PASSWORD" );
             submitAdminData( fullname, mail, password );
-            assertAutenticatedPage( username );
-            assertEditConfigurationPage();
-            postAdminUserCreation();
-            clickLinkWithText( "Logout" );
+
+            /* Avoid race conditions when several browsers try to register the admin user
*/
+            if ( getSelenium().isTextPresent( "Current User" ) )
+            {
+                /* this is the browser that registered the admin */
+                assertEditConfigurationPage();
+                postAdminUserCreation();
+                clickLinkWithText( "Logout" );
+            }
+            else
+            {
+                /* wait for the other browser to submit the configuration */
+                loginAsAdminIfNeeded();
+                while ( getSelenium().isTextPresent( "General Configuration" ) )
+                {
+                    Thread.sleep( 1 * 1000 );
+                    loginAsAdminIfNeeded();
+                }
+                logoutIfNeeded();
+            }
         }
     }
 



Mime
View raw message