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:
Brett Porter 2010-02-16 03:57:37 +00:00
parent 4903f8dd2d
commit 23de2a49fb
3 changed files with 116 additions and 107 deletions

View File

@ -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" );
}

View File

@ -34,7 +34,7 @@ public class UserRolesTest
createUser( username, fullname, getUserEmail(), getUserRolePassword(), true);
deleteUser( username, fullname, getUserEmail() );
clickLinkWithText( "Logout" );
logout();
login( getAdminUsername() , getAdminPassword() );
}
@ -50,18 +50,18 @@ public class UserRolesTest
checkUserRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
clickLinkWithText("Logout");
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");
logout();
//assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
clickLinkWithText("Logout");
logout();
login( getAdminUsername() , getAdminPassword() );
}
@ -77,18 +77,18 @@ public class UserRolesTest
checkUserRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
clickLinkWithText("Logout");
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");
logout();
//assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
clickLinkWithText("Logout");
logout();
login( getAdminUsername() , getAdminPassword() );
}
@ -104,18 +104,18 @@ public class UserRolesTest
checkUserRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
clickLinkWithText("Logout");
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");
logout();
//assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
clickLinkWithText("Logout");
logout();
login( getAdminUsername() , getAdminPassword() );
}
@ -131,18 +131,18 @@ public class UserRolesTest
checkUserRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
clickLinkWithText("Logout");
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");
logout();
//assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
clickLinkWithText("Logout");
logout();
login( getAdminUsername() , getAdminPassword() );
}
@ -158,18 +158,18 @@ public class UserRolesTest
checkUserRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
clickLinkWithText("Logout");
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");
logout();
//assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
clickLinkWithText("Logout");
logout();
login( getAdminUsername() , getAdminPassword() );
}
@ -185,18 +185,18 @@ public class UserRolesTest
checkUserRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
clickLinkWithText("Logout");
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");
logout();
//assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
clickLinkWithText("Logout");
logout();
login( getAdminUsername() , getAdminPassword() );
}
@ -212,18 +212,18 @@ public class UserRolesTest
checkResourceRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
clickLinkWithText("Logout");
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");
logout();
//assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
clickLinkWithText("Logout");
logout();
login( getAdminUsername() , getAdminPassword() );
}
@ -266,18 +266,18 @@ public class UserRolesTest
checkResourceRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
clickLinkWithText("Logout");
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");
logout();
//assertTextPresent("You are already logged in.");
login(username, getUserRoleNewPassword());
assertLeftNavMenuWithRole( fullname );
clickLinkWithText("Logout");
logout();
login( getAdminUsername() , getAdminPassword() );
}

View File

@ -118,7 +118,7 @@ public abstract class AbstractArchivaTest
submit();
if ( success )
{
assertAuthenticatedPage( username );
assertUserLoggedIn( username );
}
else
{
@ -143,16 +143,6 @@ 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
public void goToUserManagementPage()
{
@ -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,6 +313,15 @@ public abstract class AbstractArchivaTest
}
}
protected void assertUserLoggedIn( String username )
{
assertTextPresent( "Current User:" );
assertTextPresent( username );
assertLinkPresent( "Edit Details" );
assertLinkPresent( "Logout" );
assertTextNotPresent( "Login" );
}
// User Roles
public void assertUserRoleCheckBoxPresent(String 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" );
}
}