mirror of https://github.com/apache/archiva.git
check user is logged in at end of test
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@910389 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4903f8dd2d
commit
23de2a49fb
|
@ -63,7 +63,7 @@ public class ArchivaAdminTest
|
|||
String mail = getProperty( "ADMIN_EMAIL" );
|
||||
String password = getProperty( "ADMIN_PASSWORD" );
|
||||
submitAdminData( fullname, mail, password );
|
||||
assertAuthenticatedPage( username );
|
||||
assertUserLoggedIn( username );
|
||||
submit();
|
||||
clickLinkWithText( "Logout" );
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@ public class UserRolesTest
|
|||
|
||||
createUser( username, fullname, getUserEmail(), getUserRolePassword(), true);
|
||||
deleteUser( username, fullname, getUserEmail() );
|
||||
clickLinkWithText( "Logout" );
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
logout();
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
}
|
||||
|
||||
@Test (dependsOnMethods = { "testBasicAddDeleteUser" } )
|
||||
|
@ -50,19 +50,19 @@ public class UserRolesTest
|
|||
checkUserRoleWithValue( fullname );
|
||||
clickButtonWithValue( "Submit" );
|
||||
|
||||
clickLinkWithText("Logout");
|
||||
login(username, getUserRolePassword());
|
||||
logout();
|
||||
login(username, getUserRolePassword());
|
||||
changePassword( getUserRolePassword(), getUserRoleNewPassword());
|
||||
|
||||
// this section will be removed if issue from redback after changing password will be fixed.
|
||||
getSelenium().goBack();
|
||||
clickLinkWithText("Logout");
|
||||
//assertTextPresent("You are already logged in.");
|
||||
logout();
|
||||
//assertTextPresent("You are already logged in.");
|
||||
|
||||
login(username, getUserRoleNewPassword());
|
||||
assertLeftNavMenuWithRole( fullname );
|
||||
clickLinkWithText("Logout");
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
logout();
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
}
|
||||
|
||||
@Test (dependsOnMethods = { "testUserWithGuestRole" } )
|
||||
|
@ -77,19 +77,19 @@ public class UserRolesTest
|
|||
checkUserRoleWithValue( fullname );
|
||||
clickButtonWithValue( "Submit" );
|
||||
|
||||
clickLinkWithText("Logout");
|
||||
login(username, getUserRolePassword());
|
||||
logout();
|
||||
login(username, getUserRolePassword());
|
||||
changePassword( getUserRolePassword(), getUserRoleNewPassword());
|
||||
|
||||
// this section will be removed if issue from redback after changing password will be fixed.
|
||||
getSelenium().goBack();
|
||||
clickLinkWithText("Logout");
|
||||
//assertTextPresent("You are already logged in.");
|
||||
logout();
|
||||
//assertTextPresent("You are already logged in.");
|
||||
|
||||
login(username, getUserRoleNewPassword());
|
||||
assertLeftNavMenuWithRole( fullname );
|
||||
clickLinkWithText("Logout");
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
logout();
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
}
|
||||
|
||||
@Test (dependsOnMethods = { "testUserWithRegisteredUserRole" } )
|
||||
|
@ -104,19 +104,19 @@ public class UserRolesTest
|
|||
checkUserRoleWithValue( fullname );
|
||||
clickButtonWithValue( "Submit" );
|
||||
|
||||
clickLinkWithText("Logout");
|
||||
login(username, getUserRolePassword());
|
||||
logout();
|
||||
login(username, getUserRolePassword());
|
||||
changePassword( getUserRolePassword(), getUserRoleNewPassword());
|
||||
|
||||
// this section will be removed if issue from redback after changing password will be fixed.
|
||||
getSelenium().goBack();
|
||||
clickLinkWithText("Logout");
|
||||
//assertTextPresent("You are already logged in.");
|
||||
logout();
|
||||
//assertTextPresent("You are already logged in.");
|
||||
|
||||
login(username, getUserRoleNewPassword());
|
||||
assertLeftNavMenuWithRole( fullname );
|
||||
clickLinkWithText("Logout");
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
logout();
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
}
|
||||
|
||||
@Test (dependsOnMethods = { "testUserWithSysAdminUserRole" } )
|
||||
|
@ -131,19 +131,19 @@ public class UserRolesTest
|
|||
checkUserRoleWithValue( fullname );
|
||||
clickButtonWithValue( "Submit" );
|
||||
|
||||
clickLinkWithText("Logout");
|
||||
login(username, getUserRolePassword());
|
||||
logout();
|
||||
login(username, getUserRolePassword());
|
||||
changePassword( getUserRolePassword(), getUserRoleNewPassword());
|
||||
|
||||
// this section will be removed if issue from redback after changing password will be fixed.
|
||||
getSelenium().goBack();
|
||||
clickLinkWithText("Logout");
|
||||
//assertTextPresent("You are already logged in.");
|
||||
logout();
|
||||
//assertTextPresent("You are already logged in.");
|
||||
|
||||
login(username, getUserRoleNewPassword());
|
||||
assertLeftNavMenuWithRole( fullname );
|
||||
clickLinkWithText("Logout");
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
logout();
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
}
|
||||
|
||||
@Test (dependsOnMethods = { "testUserWithUserAdminUserRole" } )
|
||||
|
@ -158,19 +158,19 @@ public class UserRolesTest
|
|||
checkUserRoleWithValue( fullname );
|
||||
clickButtonWithValue( "Submit" );
|
||||
|
||||
clickLinkWithText("Logout");
|
||||
login(username, getUserRolePassword());
|
||||
logout();
|
||||
login(username, getUserRolePassword());
|
||||
changePassword( getUserRolePassword(), getUserRoleNewPassword());
|
||||
|
||||
// this section will be removed if issue from redback after changing password will be fixed.
|
||||
getSelenium().goBack();
|
||||
clickLinkWithText("Logout");
|
||||
//assertTextPresent("You are already logged in.");
|
||||
logout();
|
||||
//assertTextPresent("You are already logged in.");
|
||||
|
||||
login(username, getUserRoleNewPassword());
|
||||
assertLeftNavMenuWithRole( fullname );
|
||||
clickLinkWithText("Logout");
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
logout();
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
}
|
||||
|
||||
@Test (dependsOnMethods = { "testUserWithGlobalRepoManagerRole" } )
|
||||
|
@ -185,19 +185,19 @@ public class UserRolesTest
|
|||
checkUserRoleWithValue( fullname );
|
||||
clickButtonWithValue( "Submit" );
|
||||
|
||||
clickLinkWithText("Logout");
|
||||
login(username, getUserRolePassword());
|
||||
logout();
|
||||
login(username, getUserRolePassword());
|
||||
changePassword( getUserRolePassword(), getUserRoleNewPassword());
|
||||
|
||||
// this section will be removed if issue from redback after changing password will be fixed.
|
||||
getSelenium().goBack();
|
||||
clickLinkWithText("Logout");
|
||||
//assertTextPresent("You are already logged in.");
|
||||
logout();
|
||||
//assertTextPresent("You are already logged in.");
|
||||
|
||||
login(username, getUserRoleNewPassword());
|
||||
assertLeftNavMenuWithRole( fullname );
|
||||
clickLinkWithText("Logout");
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
logout();
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
}
|
||||
|
||||
@Test (dependsOnMethods = { "testUserWithGlobalRepoObserverRole" } )
|
||||
|
@ -212,19 +212,19 @@ public class UserRolesTest
|
|||
checkResourceRoleWithValue( fullname );
|
||||
clickButtonWithValue( "Submit" );
|
||||
|
||||
clickLinkWithText("Logout");
|
||||
login(username, getUserRolePassword());
|
||||
logout();
|
||||
login(username, getUserRolePassword());
|
||||
changePassword( getUserRolePassword(), getUserRoleNewPassword());
|
||||
|
||||
// this section will be removed if issue from redback after changing password will be fixed.
|
||||
getSelenium().goBack();
|
||||
clickLinkWithText("Logout");
|
||||
//assertTextPresent("You are already logged in.");
|
||||
logout();
|
||||
//assertTextPresent("You are already logged in.");
|
||||
|
||||
login(username, getUserRoleNewPassword());
|
||||
assertLeftNavMenuWithRole( fullname );
|
||||
clickLinkWithText("Logout");
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
logout();
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
}
|
||||
|
||||
/*@Test (dependsOnMethods = { "testUserWithRepoManagerInternalRole" } )
|
||||
|
@ -266,45 +266,45 @@ public class UserRolesTest
|
|||
checkResourceRoleWithValue( fullname );
|
||||
clickButtonWithValue( "Submit" );
|
||||
|
||||
clickLinkWithText("Logout");
|
||||
login(username, getUserRolePassword());
|
||||
logout();
|
||||
login(username, getUserRolePassword());
|
||||
changePassword( getUserRolePassword(), getUserRoleNewPassword());
|
||||
|
||||
// this section will be removed if issue from redback after changing password will be fixed.
|
||||
getSelenium().goBack();
|
||||
clickLinkWithText("Logout");
|
||||
//assertTextPresent("You are already logged in.");
|
||||
logout();
|
||||
//assertTextPresent("You are already logged in.");
|
||||
|
||||
login(username, getUserRoleNewPassword());
|
||||
assertLeftNavMenuWithRole( fullname );
|
||||
clickLinkWithText("Logout");
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
logout();
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
}
|
||||
|
||||
/*@Test (dependsOnMethods = { "testUserWithRepoObserverInternalRole" } )
|
||||
public void testUserWithRepoObserverSnapshotsRole()
|
||||
{
|
||||
username = getProperty( "REPOOBSERVER_SNAPSHOTS_USERNAME" );
|
||||
fullname = getProperty( "REPOOBSERVER_SNAPSHOTS_FULLNAME" );
|
||||
/*@Test (dependsOnMethods = { "testUserWithRepoObserverInternalRole" } )
|
||||
public void testUserWithRepoObserverSnapshotsRole()
|
||||
{
|
||||
username = getProperty( "REPOOBSERVER_SNAPSHOTS_USERNAME" );
|
||||
fullname = getProperty( "REPOOBSERVER_SNAPSHOTS_FULLNAME" );
|
||||
|
||||
createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
|
||||
clickLinkWithText( username );
|
||||
clickLinkWithText( "Edit Roles" );
|
||||
checkResourceRoleWithValue( fullname );
|
||||
clickButtonWithValue( "Submit" );
|
||||
createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
|
||||
clickLinkWithText( username );
|
||||
clickLinkWithText( "Edit Roles" );
|
||||
checkResourceRoleWithValue( fullname );
|
||||
clickButtonWithValue( "Submit" );
|
||||
|
||||
clickLinkWithText("Logout");
|
||||
login(username, getUserRolePassword());
|
||||
changePassword( getUserRolePassword(), getUserRoleNewPassword());
|
||||
clickLinkWithText("Logout");
|
||||
login(username, getUserRolePassword());
|
||||
changePassword( getUserRolePassword(), getUserRoleNewPassword());
|
||||
|
||||
// this section will be removed if issue from redback after changing password will be fixed.
|
||||
getSelenium().goBack();
|
||||
clickLinkWithText("Logout");
|
||||
//assertTextPresent("You are already logged in.");
|
||||
// this section will be removed if issue from redback after changing password will be fixed.
|
||||
getSelenium().goBack();
|
||||
clickLinkWithText("Logout");
|
||||
//assertTextPresent("You are already logged in.");
|
||||
|
||||
login(username, getUserRoleNewPassword());
|
||||
assertLeftNavMenuWithRole( fullname );
|
||||
clickLinkWithText("Logout");
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
}*/
|
||||
login(username, getUserRoleNewPassword());
|
||||
assertLeftNavMenuWithRole( fullname );
|
||||
clickLinkWithText("Logout");
|
||||
login( getAdminUsername() , getAdminPassword() );
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -118,8 +118,8 @@ public abstract class AbstractArchivaTest
|
|||
submit();
|
||||
if ( success )
|
||||
{
|
||||
assertAuthenticatedPage( username );
|
||||
}
|
||||
assertUserLoggedIn( username );
|
||||
}
|
||||
else
|
||||
{
|
||||
assertLoginPage();
|
||||
|
@ -143,17 +143,7 @@ public abstract class AbstractArchivaTest
|
|||
assertTextPresent( "Forgot your Password? Request a password reset." );
|
||||
}
|
||||
|
||||
public void assertAuthenticatedPage( String username )
|
||||
{
|
||||
assertTextPresent( "Current User" );
|
||||
assertTextPresent( "Edit Details" );
|
||||
assertTextPresent( "Logout" );
|
||||
assertTextNotPresent( "Login" );
|
||||
assertTextPresent( username );
|
||||
}
|
||||
|
||||
|
||||
//User Management
|
||||
//User Management
|
||||
public void goToUserManagementPage()
|
||||
{
|
||||
clickLinkWithText( "User Management" );
|
||||
|
@ -278,6 +268,10 @@ public abstract class AbstractArchivaTest
|
|||
|
||||
submitLoginPage( username, password, false, valid, assertReturnPage );
|
||||
}
|
||||
if ( valid )
|
||||
{
|
||||
assertUserLoggedIn( username );
|
||||
}
|
||||
}
|
||||
|
||||
public void submitLoginPage( String username, String password )
|
||||
|
@ -304,10 +298,7 @@ public abstract class AbstractArchivaTest
|
|||
|
||||
if ( validUsernamePassword )
|
||||
{
|
||||
assertTextPresent( "Current User:" );
|
||||
assertTextPresent( username );
|
||||
assertLinkPresent( "Edit Details" );
|
||||
assertLinkPresent( "Logout" );
|
||||
assertUserLoggedIn( username );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -322,7 +313,16 @@ public abstract class AbstractArchivaTest
|
|||
}
|
||||
}
|
||||
|
||||
// User Roles
|
||||
protected void assertUserLoggedIn( String username )
|
||||
{
|
||||
assertTextPresent( "Current User:" );
|
||||
assertTextPresent( username );
|
||||
assertLinkPresent( "Edit Details" );
|
||||
assertLinkPresent( "Logout" );
|
||||
assertTextNotPresent( "Login" );
|
||||
}
|
||||
|
||||
// User Roles
|
||||
public void assertUserRoleCheckBoxPresent(String value)
|
||||
{
|
||||
getSelenium() .isElementPresent("xpath=//input[@id='addRolesToUser_addNDSelectedRoles' and @name='addNDSelectedRoles' and @value='" + value + "']");
|
||||
|
@ -553,4 +553,13 @@ public abstract class AbstractArchivaTest
|
|||
//TODO
|
||||
clickButtonWithValue( "Add Repository" );
|
||||
}
|
||||
|
||||
protected void logout()
|
||||
{
|
||||
clickLinkWithText("Logout");
|
||||
assertTextNotPresent( "Current User:" );
|
||||
assertLinkNotPresent( "Edit Details" );
|
||||
assertLinkNotPresent( "Logout" );
|
||||
assertLinkPresent( "Login" );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue