]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1276] Selenium tests need a clean up
authorMarecor M. Baclay <mbaclay@apache.org>
Wed, 14 Apr 2010 01:02:19 +0000 (01:02 +0000)
committerMarecor M. Baclay <mbaclay@apache.org>
Wed, 14 Apr 2010 01:02:19 +0000 (01:02 +0000)
- removed the unnecessary commented out lines
- modified LoginTest to use the methods in abstract class

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@933824 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/UserRolesTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java

index bed1133488c6a0e314d710c503021c09de507dd6..54ba9d6e7d0ef344fad73b8a33cfbb7a75db8a25 100644 (file)
@@ -43,8 +43,8 @@ public class LoginTest
     public void testWithBadUsername()
     {
         goToLoginPage();
-        getSelenium().type( "loginForm_username", "badUsername" );
-        getSelenium().click( "loginForm__login" );
+        setFieldValue( "loginForm_username", "badUsername" );
+        clickButtonWithValue( "Login" );
         getSelenium().waitForPageToLoad( maxWaitTimeInMs );
         assertTextPresent( "You have entered an incorrect username and/or password" );
     }
@@ -53,8 +53,8 @@ public class LoginTest
     public void testWithBadPassword()
     {
         goToLoginPage();
-        getSelenium().type( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
-        getSelenium().type( "loginForm_password", "badPassword" );
+        setFieldValue( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
+        setFieldValue( "loginForm_password", "badPassword" );
         getSelenium().click( "loginForm__login" );
         getSelenium().waitForPageToLoad( maxWaitTimeInMs );
         assertTextPresent( "You have entered an incorrect username and/or password" );
@@ -64,8 +64,8 @@ public class LoginTest
     public void testWithEmptyUsername()
     {
         goToLoginPage();
-        getSelenium().type( "loginForm_password", "password" );
-        getSelenium().click( "loginForm__login" );
+        setFieldValue( "loginForm_password", "password" );
+        clickButtonWithValue( "Login" );
         getSelenium().waitForPageToLoad( maxWaitTimeInMs );
         assertTextPresent( "User Name is required" );
     }
@@ -74,8 +74,8 @@ public class LoginTest
     public void testWithEmptyPassword()
     {
         goToLoginPage();
-        getSelenium().type( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
-        getSelenium().click( "loginForm__login" );
+        setFieldValue( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
+        clickButtonWithValue( "Login" );
         getSelenium().waitForPageToLoad( maxWaitTimeInMs );
         assertTextPresent( "You have entered an incorrect username and/or password" );
     }
@@ -84,9 +84,9 @@ public class LoginTest
     public void testWithCorrectUsernamePassword()
     {
         goToLoginPage();
-        getSelenium().type( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
-        getSelenium().type( "loginForm_password", getProperty( "ADMIN_PASSWORD" ) );
-        getSelenium().click( "loginForm__login" );
+        setFieldValue( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
+        setFieldValue( "loginForm_password", getProperty( "ADMIN_PASSWORD" ) );
+        clickButtonWithValue( "Login" );
         getSelenium().waitForPageToLoad( maxWaitTimeInMs );
         assertTextPresent( "Edit Details" );
         assertTextPresent( "Logout" );
index bc44b8413912b53437f99da1841534c97d600399..06f71f8ea58bb71fa55cd19daad5cd368e2b9654 100644 (file)
@@ -53,13 +53,7 @@ public class UserRolesTest
         logout();
         login( username, getUserRolePassword() );
         changePassword( getUserRolePassword(), getUserRoleNewPassword() );
-
-        // this section will be removed if issue from redback after changing password will be fixed.
-        getSelenium().goBack();
-        logout();
-        // assertTextPresent("You are already logged in.");
-
-        login( username, getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
         assertLeftNavMenuWithRole( fullname );
         logout();
         login( getAdminUsername(), getAdminPassword() );
@@ -80,13 +74,7 @@ public class UserRolesTest
         logout();
         login( username, getUserRolePassword() );
         changePassword( getUserRolePassword(), getUserRoleNewPassword() );
-
-        // this section will be removed if issue from redback after changing password will be fixed.
-        getSelenium().goBack();
-        logout();
-        // assertTextPresent("You are already logged in.");
-
-        login( username, getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
         assertLeftNavMenuWithRole( fullname );
         logout();
         login( getAdminUsername(), getAdminPassword() );
@@ -107,13 +95,7 @@ public class UserRolesTest
         logout();
         login( username, getUserRolePassword() );
         changePassword( getUserRolePassword(), getUserRoleNewPassword() );
-
-        // this section will be removed if issue from redback after changing password will be fixed.
-        getSelenium().goBack();
-        logout();
-        // assertTextPresent("You are already logged in.");
-
-        login( username, getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
         assertLeftNavMenuWithRole( fullname );
         logout();
         login( getAdminUsername(), getAdminPassword() );
@@ -134,13 +116,7 @@ public class UserRolesTest
         logout();
         login( username, getUserRolePassword() );
         changePassword( getUserRolePassword(), getUserRoleNewPassword() );
-
-        // this section will be removed if issue from redback after changing password will be fixed.
-        getSelenium().goBack();
-        logout();
-        // assertTextPresent("You are already logged in.");
-
-        login( username, getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
         assertLeftNavMenuWithRole( fullname );
         logout();
         login( getAdminUsername(), getAdminPassword() );
@@ -161,13 +137,7 @@ public class UserRolesTest
         logout();
         login( username, getUserRolePassword() );
         changePassword( getUserRolePassword(), getUserRoleNewPassword() );
-
-        // this section will be removed if issue from redback after changing password will be fixed.
-        getSelenium().goBack();
-        logout();
-        // assertTextPresent("You are already logged in.");
-
-        login( username, getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
         assertLeftNavMenuWithRole( fullname );
         logout();
         login( getAdminUsername(), getAdminPassword() );
@@ -188,13 +158,7 @@ public class UserRolesTest
         logout();
         login( username, getUserRolePassword() );
         changePassword( getUserRolePassword(), getUserRoleNewPassword() );
-
-        // this section will be removed if issue from redback after changing password will be fixed.
-        getSelenium().goBack();
-        logout();
-        // assertTextPresent("You are already logged in.");
-
-        login( username, getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
         assertLeftNavMenuWithRole( fullname );
         logout();
         login( getAdminUsername(), getAdminPassword() );
@@ -215,13 +179,7 @@ public class UserRolesTest
         logout();
         login( username, getUserRolePassword() );
         changePassword( getUserRolePassword(), getUserRoleNewPassword() );
-
-        // this section will be removed if issue from redback after changing password will be fixed.
-        getSelenium().goBack();
-        logout();
-        // assertTextPresent("You are already logged in.");
-
-        login( username, getUserRoleNewPassword() );
+        assertTextPresent( "Password successfully changed" );
         assertLeftNavMenuWithRole( fullname );
         logout();
         login( getAdminUsername(), getAdminPassword() );
index f7f266dbe7cdc492131264284033cd6f1d9eae79..7054c495e07ead38fb52da14430f2acdb85ac2e5 100644 (file)
@@ -37,7 +37,6 @@ public class VirtualRepositoryTest
     public void testAddRepositoryGroupValidValue()
     {
         addRepositoryGroup( "testing" );
-        // assertAddedRepositoryLink( "testing" );
         Assert.assertEquals( getSelenium().getText( "//div[@id='contentArea']/div[2]/div/div[1]/p[1]" ), "testing" );
     }
 
@@ -47,8 +46,6 @@ public class VirtualRepositoryTest
         addRepositoryToRepositoryGroup( "testing", "internal" );
         Assert.assertEquals( getSelenium().getText( "//div[@id='contentArea']/div[2]/div/div[3]/div[2]/p[1]" ),
                              "internal" );
-        // clickLinkWithXPath( "/html/body/div[4]/div/div/div[2]/div/div/p[2]/a" );
-        // getSelenium().goBack();
     }
 
     @Test( dependsOnMethods = { "testAddRepositoryToRepositoryGroup" } )
@@ -68,8 +65,4 @@ public class VirtualRepositoryTest
         assertTextPresent( "No Repository Groups Defined." );
     }
 
-    /*
-     * @Test(dependsOnMethods = { "testAddRepositoryToRepositoryGroup" } ) public void testCheckRepositoryGroup() {
-     * clickLinkWithXPath( "/html/body/div[4]/div/div/div[2]/div/div/p[2]/a" ); getSelenium().goBack(); }
-     */
 }
\ No newline at end of file
index c781bee6b5827b8251e02205a0acd7b729b2cc96..e73e0800963f294c011dc2ab6690d7b96575ac4d 100644 (file)
@@ -130,4 +130,4 @@ public abstract class AbstractArtifactManagementTest
             assertElementPresent( arrayelement );
         assertButtonWithValuePresent( "Add Legacy Artifact Path" );
     }
-}
+}
\ No newline at end of file