From 45db0bf072d0dcb4ae0e80f4b31f4987b09d8fd0 Mon Sep 17 00:00:00 2001 From: "Marecor M. Baclay" Date: Wed, 14 Apr 2010 01:02:19 +0000 Subject: [PATCH] [MRM-1276] Selenium tests need a clean up - 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 --- .../apache/archiva/web/test/LoginTest.java | 22 ++++---- .../archiva/web/test/UserRolesTest.java | 56 +++---------------- .../web/test/VirtualRepositoryTest.java | 7 --- .../AbstractArtifactManagementTest.java | 2 +- 4 files changed, 19 insertions(+), 68 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java index bed113348..54ba9d6e7 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/LoginTest.java @@ -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" ); diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/UserRolesTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/UserRolesTest.java index bc44b8413..06f71f8ea 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/UserRolesTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/UserRolesTest.java @@ -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() ); diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java index f7f266dbe..7054c495e 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java @@ -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 diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java index c781bee6b..e73e08009 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java @@ -130,4 +130,4 @@ public abstract class AbstractArtifactManagementTest assertElementPresent( arrayelement ); assertButtonWithValuePresent( "Add Legacy Artifact Path" ); } -} +} \ No newline at end of file -- 2.39.5