[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()
{
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" );

View 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() );

View 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(); }
*/
}

View File

@ -130,4 +130,4 @@ public abstract class AbstractArtifactManagementTest
assertElementPresent( arrayelement );
assertButtonWithValuePresent( "Add Legacy Artifact Path" );
}
}
}