*/
import org.apache.archiva.web.test.parent.AbstractArchivaTest;
+import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@Test( groups = { "userroles" })
-public class UserRolesTest
+public class UserRolesTest
extends AbstractArchivaTest
{
@BeforeTest
loginAsAdmin();
}
+ @AfterSuite
+ public void tearDown()
+ {
+ goToUserManagementPage();
+ String[] usernameProperties =
+ new String[]{ "GUEST_USERNAME", "REGISTERED_USERNAME", "SYSAD_USERNAME", "USERADMIN_USERNAME",
+ "GLOBALREPOMANAGER_USERNAME", "GLOBALREPOOBSERVER_USERNAME", "REPOMANAGER_INTERNAL_USERNAME",
+ "REPOOBSERVER_INTERNAL_USERNAME" };
+ for ( String p : usernameProperties )
+ {
+ String username = getProperty( p );
+
+ if ( isLinkPresent( username ) )
+ {
+ deleteUser( username );
+ }
+ }
+ }
+
public void testBasicAddDeleteUser()
{
username = getProperty( "GUEST_USERNAME" );
fullname = getProperty( "GUEST_FULLNAME" );
-
+
createUser( username, fullname, getUserEmail(), getUserRolePassword(), true);
- deleteUser( username, fullname, getUserEmail() );
- logout();
- login( getAdminUsername() , getAdminPassword() );
+ deleteUser( username );
}
-
+
@Test (dependsOnMethods = { "testBasicAddDeleteUser" } )
public void testUserWithGuestRole()
{
username = getProperty("GUEST_USERNAME");
fullname = getProperty("GUEST_FULLNAME");
-
+
createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
clickLinkWithText( username );
clickLinkWithText( "Edit Roles" );
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());
assertLeftNavMenuWithRole( fullname );
logout();
login( getAdminUsername() , getAdminPassword() );
}
-
+
@Test (dependsOnMethods = { "testUserWithGuestRole" } )
public void testUserWithRegisteredUserRole()
{
username = getProperty("REGISTERED_USERNAME");
fullname = getProperty("REGISTERED_FULLNAME");
-
+
createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
- clickLinkWithText( username );
+ clickLinkWithText( username );
clickLinkWithText( "Edit Roles" );
checkUserRoleWithValue( fullname );
clickButtonWithValue( "Submit" );
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());
assertLeftNavMenuWithRole( fullname );
logout();
login( getAdminUsername() , getAdminPassword() );
}
-
+
@Test (dependsOnMethods = { "testUserWithRegisteredUserRole" } )
public void testUserWithSysAdminUserRole()
{
username = getProperty("SYSAD_USERNAME");
fullname = getProperty("SYSAD_FULLNAME");
-
+
createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
clickLinkWithText( username );
clickLinkWithText( "Edit Roles" );
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());
assertLeftNavMenuWithRole( fullname );
logout();
login( getAdminUsername() , getAdminPassword() );
}
-
+
@Test (dependsOnMethods = { "testUserWithSysAdminUserRole" } )
public void testUserWithUserAdminUserRole()
{
username = getProperty("USERADMIN_USERNAME");
fullname = getProperty("USERADMIN_FULLNAME");
-
+
createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
clickLinkWithText( username );
clickLinkWithText( "Edit Roles" );
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());
assertLeftNavMenuWithRole( fullname );
logout();
login( getAdminUsername() , getAdminPassword() );
}
-
+
@Test (dependsOnMethods = { "testUserWithUserAdminUserRole" } )
public void testUserWithGlobalRepoManagerRole()
{
username = getProperty("GLOBALREPOMANAGER_USERNAME");
fullname = getProperty("GLOBALREPOMANAGER_FULLNAME");
-
+
createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
clickLinkWithText( username );
clickLinkWithText( "Edit Roles" );
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());
assertLeftNavMenuWithRole( fullname );
logout();
{
username = getProperty("GLOBALREPOOBSERVER_USERNAME");
fullname = getProperty("GLOBALREPOOBSERVER_FULLNAME");
-
+
createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
clickLinkWithText( username );
clickLinkWithText( "Edit Roles" );
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());
assertLeftNavMenuWithRole( fullname );
logout();
login( getAdminUsername() , getAdminPassword() );
}
-
+
@Test (dependsOnMethods = { "testUserWithGlobalRepoObserverRole" } )
public void testUserWithRepoManagerInternalRole()
{
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());
assertLeftNavMenuWithRole( fullname );
logout();
clickLinkWithText("Logout");
login( getAdminUsername() , getAdminPassword() );
}*/
-
+
@Test (dependsOnMethods = { "testUserWithRepoManagerInternalRole" } )
public void testUserWithRepoObserverInternalRole()
{
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());
assertLeftNavMenuWithRole( fullname );
logout();