continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r794895 - in /continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test: LoginTest.java parent/AbstractContinuumTest.java
Date Thu, 16 Jul 2009 22:39:19 GMT
Author: carlos
Date: Thu Jul 16 22:39:18 2009
New Revision: 794895

URL: http://svn.apache.org/viewvc?rev=794895&view=rev
Log:
Add a logoutIfNeeded

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

Modified: continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/LoginTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/LoginTest.java?rev=794895&r1=794894&r2=794895&view=diff
==============================================================================
--- continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/LoginTest.java
(original)
+++ continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/LoginTest.java
Thu Jul 16 22:39:18 2009
@@ -39,6 +39,7 @@
 {
     public void testWithBadUsername()
     {
+        logoutIfNeeded();
         goToLoginPage();
         getSelenium().type( "loginForm_username", "badUsername" );
         getSelenium().type( "loginForm_username", getProperty( "ADMIN_PASSWORD" ) );
@@ -49,6 +50,7 @@
 
     public void testWithBadPassword()
     {
+        logoutIfNeeded();
         goToLoginPage();
         getSelenium().type( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
         getSelenium().type( "loginForm_password", "badPassword" );
@@ -59,6 +61,7 @@
 
     public void testWithEmptyUsername()
     {
+        logoutIfNeeded();
         goToLoginPage();
         getSelenium().type( "loginForm_password", "password" );
         getSelenium().click( "loginForm__login" );
@@ -68,6 +71,7 @@
 
     public void testWithEmptyPassword()
     {
+        logoutIfNeeded();
         goToLoginPage();
         getSelenium().type( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
         getSelenium().click( "loginForm__login" );
@@ -78,6 +82,12 @@
     @Test( groups = { "loginSuccess" } )
     public void testWithCorrectUsernamePassword()
     {
-        loginAsAdmin();
+        logoutIfNeeded();
+        goToLoginPage();
+        getSelenium().type( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
+        getSelenium().type( "loginForm_password", getProperty( "ADMIN_PASSWORD" ) );
+        getSelenium().click( "loginForm__login" );
+        getSelenium().waitForPageToLoad( maxWaitTimeInMs );
+        assertAutenticatedPage( getProperty( "ADMIN_USERNAME" ) );
     }
 }

Modified: continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java?rev=794895&r1=794894&r2=794895&view=diff
==============================================================================
--- continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
(original)
+++ continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
Thu Jul 16 22:39:18 2009
@@ -104,8 +104,22 @@
         assertTextPresent( "Forgot your Password? Request a password reset." );
     }
 
-    public void loginAsAdmin()
+    public void logoutIfNeeded()
     {
+        if ( !getSelenium().isTextPresent( "Current User" ) )
+        {
+            return;
+        }
+        clickLinkWithText( "Logout" );
+    }
+
+    public void loginAsAdminIfNeeded()
+    {
+        if ( getSelenium().isTextPresent( "Current User" )
+            && getSelenium().isTextPresent( getProperty( "ADMIN_USERNAME" ) ) )
+        {
+            return;
+        }
         goToLoginPage();
         getSelenium().type( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
         getSelenium().type( "loginForm_password", getProperty( "ADMIN_PASSWORD" ) );



Mime
View raw message