[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
This commit is contained in:
Marecor M. Baclay 2010-04-14 01:02:19 +00:00
parent 26f254351f
commit 45db0bf072
4 changed files with 19 additions and 68 deletions

View File

@ -43,8 +43,8 @@ public class LoginTest
public void testWithBadUsername() public void testWithBadUsername()
{ {
goToLoginPage(); goToLoginPage();
getSelenium().type( "loginForm_username", "badUsername" ); setFieldValue( "loginForm_username", "badUsername" );
getSelenium().click( "loginForm__login" ); clickButtonWithValue( "Login" );
getSelenium().waitForPageToLoad( maxWaitTimeInMs ); getSelenium().waitForPageToLoad( maxWaitTimeInMs );
assertTextPresent( "You have entered an incorrect username and/or password" ); assertTextPresent( "You have entered an incorrect username and/or password" );
} }
@ -53,8 +53,8 @@ public class LoginTest
public void testWithBadPassword() public void testWithBadPassword()
{ {
goToLoginPage(); goToLoginPage();
getSelenium().type( "loginForm_username", getProperty( "ADMIN_USERNAME" ) ); setFieldValue( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
getSelenium().type( "loginForm_password", "badPassword" ); setFieldValue( "loginForm_password", "badPassword" );
getSelenium().click( "loginForm__login" ); getSelenium().click( "loginForm__login" );
getSelenium().waitForPageToLoad( maxWaitTimeInMs ); getSelenium().waitForPageToLoad( maxWaitTimeInMs );
assertTextPresent( "You have entered an incorrect username and/or password" ); assertTextPresent( "You have entered an incorrect username and/or password" );
@ -64,8 +64,8 @@ public class LoginTest
public void testWithEmptyUsername() public void testWithEmptyUsername()
{ {
goToLoginPage(); goToLoginPage();
getSelenium().type( "loginForm_password", "password" ); setFieldValue( "loginForm_password", "password" );
getSelenium().click( "loginForm__login" ); clickButtonWithValue( "Login" );
getSelenium().waitForPageToLoad( maxWaitTimeInMs ); getSelenium().waitForPageToLoad( maxWaitTimeInMs );
assertTextPresent( "User Name is required" ); assertTextPresent( "User Name is required" );
} }
@ -74,8 +74,8 @@ public class LoginTest
public void testWithEmptyPassword() public void testWithEmptyPassword()
{ {
goToLoginPage(); goToLoginPage();
getSelenium().type( "loginForm_username", getProperty( "ADMIN_USERNAME" ) ); setFieldValue( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
getSelenium().click( "loginForm__login" ); clickButtonWithValue( "Login" );
getSelenium().waitForPageToLoad( maxWaitTimeInMs ); getSelenium().waitForPageToLoad( maxWaitTimeInMs );
assertTextPresent( "You have entered an incorrect username and/or password" ); assertTextPresent( "You have entered an incorrect username and/or password" );
} }
@ -84,9 +84,9 @@ public class LoginTest
public void testWithCorrectUsernamePassword() public void testWithCorrectUsernamePassword()
{ {
goToLoginPage(); goToLoginPage();
getSelenium().type( "loginForm_username", getProperty( "ADMIN_USERNAME" ) ); setFieldValue( "loginForm_username", getProperty( "ADMIN_USERNAME" ) );
getSelenium().type( "loginForm_password", getProperty( "ADMIN_PASSWORD" ) ); setFieldValue( "loginForm_password", getProperty( "ADMIN_PASSWORD" ) );
getSelenium().click( "loginForm__login" ); clickButtonWithValue( "Login" );
getSelenium().waitForPageToLoad( maxWaitTimeInMs ); getSelenium().waitForPageToLoad( maxWaitTimeInMs );
assertTextPresent( "Edit Details" ); assertTextPresent( "Edit Details" );
assertTextPresent( "Logout" ); assertTextPresent( "Logout" );

View File

@ -53,13 +53,7 @@ public class UserRolesTest
logout(); logout();
login( username, getUserRolePassword() ); login( username, getUserRolePassword() );
changePassword( getUserRolePassword(), getUserRoleNewPassword() ); changePassword( getUserRolePassword(), getUserRoleNewPassword() );
assertTextPresent( "Password successfully changed" );
// 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() );
assertLeftNavMenuWithRole( fullname ); assertLeftNavMenuWithRole( fullname );
logout(); logout();
login( getAdminUsername(), getAdminPassword() ); login( getAdminUsername(), getAdminPassword() );
@ -80,13 +74,7 @@ public class UserRolesTest
logout(); logout();
login( username, getUserRolePassword() ); login( username, getUserRolePassword() );
changePassword( getUserRolePassword(), getUserRoleNewPassword() ); changePassword( getUserRolePassword(), getUserRoleNewPassword() );
assertTextPresent( "Password successfully changed" );
// 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() );
assertLeftNavMenuWithRole( fullname ); assertLeftNavMenuWithRole( fullname );
logout(); logout();
login( getAdminUsername(), getAdminPassword() ); login( getAdminUsername(), getAdminPassword() );
@ -107,13 +95,7 @@ public class UserRolesTest
logout(); logout();
login( username, getUserRolePassword() ); login( username, getUserRolePassword() );
changePassword( getUserRolePassword(), getUserRoleNewPassword() ); changePassword( getUserRolePassword(), getUserRoleNewPassword() );
assertTextPresent( "Password successfully changed" );
// 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() );
assertLeftNavMenuWithRole( fullname ); assertLeftNavMenuWithRole( fullname );
logout(); logout();
login( getAdminUsername(), getAdminPassword() ); login( getAdminUsername(), getAdminPassword() );
@ -134,13 +116,7 @@ public class UserRolesTest
logout(); logout();
login( username, getUserRolePassword() ); login( username, getUserRolePassword() );
changePassword( getUserRolePassword(), getUserRoleNewPassword() ); changePassword( getUserRolePassword(), getUserRoleNewPassword() );
assertTextPresent( "Password successfully changed" );
// 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() );
assertLeftNavMenuWithRole( fullname ); assertLeftNavMenuWithRole( fullname );
logout(); logout();
login( getAdminUsername(), getAdminPassword() ); login( getAdminUsername(), getAdminPassword() );
@ -161,13 +137,7 @@ public class UserRolesTest
logout(); logout();
login( username, getUserRolePassword() ); login( username, getUserRolePassword() );
changePassword( getUserRolePassword(), getUserRoleNewPassword() ); changePassword( getUserRolePassword(), getUserRoleNewPassword() );
assertTextPresent( "Password successfully changed" );
// 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() );
assertLeftNavMenuWithRole( fullname ); assertLeftNavMenuWithRole( fullname );
logout(); logout();
login( getAdminUsername(), getAdminPassword() ); login( getAdminUsername(), getAdminPassword() );
@ -188,13 +158,7 @@ public class UserRolesTest
logout(); logout();
login( username, getUserRolePassword() ); login( username, getUserRolePassword() );
changePassword( getUserRolePassword(), getUserRoleNewPassword() ); changePassword( getUserRolePassword(), getUserRoleNewPassword() );
assertTextPresent( "Password successfully changed" );
// 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() );
assertLeftNavMenuWithRole( fullname ); assertLeftNavMenuWithRole( fullname );
logout(); logout();
login( getAdminUsername(), getAdminPassword() ); login( getAdminUsername(), getAdminPassword() );
@ -215,13 +179,7 @@ public class UserRolesTest
logout(); logout();
login( username, getUserRolePassword() ); login( username, getUserRolePassword() );
changePassword( getUserRolePassword(), getUserRoleNewPassword() ); changePassword( getUserRolePassword(), getUserRoleNewPassword() );
assertTextPresent( "Password successfully changed" );
// 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() );
assertLeftNavMenuWithRole( fullname ); assertLeftNavMenuWithRole( fullname );
logout(); logout();
login( getAdminUsername(), getAdminPassword() ); login( getAdminUsername(), getAdminPassword() );

View File

@ -37,7 +37,6 @@ public class VirtualRepositoryTest
public void testAddRepositoryGroupValidValue() public void testAddRepositoryGroupValidValue()
{ {
addRepositoryGroup( "testing" ); addRepositoryGroup( "testing" );
// assertAddedRepositoryLink( "testing" );
Assert.assertEquals( getSelenium().getText( "//div[@id='contentArea']/div[2]/div/div[1]/p[1]" ), "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" ); addRepositoryToRepositoryGroup( "testing", "internal" );
Assert.assertEquals( getSelenium().getText( "//div[@id='contentArea']/div[2]/div/div[3]/div[2]/p[1]" ), Assert.assertEquals( getSelenium().getText( "//div[@id='contentArea']/div[2]/div/div[3]/div[2]/p[1]" ),
"internal" ); "internal" );
// clickLinkWithXPath( "/html/body/div[4]/div/div/div[2]/div/div/p[2]/a" );
// getSelenium().goBack();
} }
@Test( dependsOnMethods = { "testAddRepositoryToRepositoryGroup" } ) @Test( dependsOnMethods = { "testAddRepositoryToRepositoryGroup" } )
@ -68,8 +65,4 @@ public class VirtualRepositoryTest
assertTextPresent( "No Repository Groups Defined." ); 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(); }
*/
} }