Author: brett Date: Tue Jul 31 12:17:29 2012 New Revision: 1367513 URL: http://svn.apache.org/viewvc?rev=1367513&view=rev Log: fix user roles test Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/UserRolesManagementTest.java continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractAdminTest.java continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractUserRolesManagementTest.java Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/UserRolesManagementTest.java URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/UserRolesManagementTest.java?rev=1367513&r1=1367512&r2=1367513&view=diff ============================================================================== --- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/UserRolesManagementTest.java (original) +++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/UserRolesManagementTest.java Tue Jul 31 12:17:29 2012 @@ -15,7 +15,6 @@ public class UserRolesManagementTest createUser( username, fullname, getUserEmail(), getUserRolePassword(), true ); deleteUser( username, fullname, getUserEmail() ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } /* @@ -47,13 +46,12 @@ public class UserRolesManagementTest { username = getProperty( "GUEST_USERNAME" ); fullname = getProperty( "GUEST_FULLNAME" ); - login( username, getUserRoleNewPassword() ); + loginAs( username, getUserRoleNewPassword() ); assertLeftNavMenuWithRole( fullname ); goToAboutPage(); clickLinkWithText( "Show Project Groups" ); assertTextPresent( "Project Groups list is empty" ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } @@ -93,7 +91,6 @@ public class UserRolesManagementTest clickLinkWithText( "Show Project Groups" ); assertTextPresent( "Project Groups list is empty." ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } /* @@ -136,7 +133,6 @@ public class UserRolesManagementTest assertLinkPresent( "Default Project Group" ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } /* @@ -193,7 +189,6 @@ public class UserRolesManagementTest // TODO edit user clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } /* @@ -229,7 +224,7 @@ public class UserRolesManagementTest clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); + loginAsAdmin(); // disable distributed build clickLinkWithText( "Configuration" ); clickLinkWithLocator( "configuration_distributedBuildEnabled", false ); @@ -289,7 +284,6 @@ public class UserRolesManagementTest checkResourceRoleWithValue( "Project Developer - Test Group" ); submit(); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } /* @@ -359,7 +353,6 @@ public class UserRolesManagementTest login( username, getUserRoleNewPassword() ); assertLeftNavMenuWithRole( fullname ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } @Test( dependsOnMethods = { "testUserWithContinuumGroupProjectDeveloperRole" } ) @@ -382,7 +375,6 @@ public class UserRolesManagementTest login( username, getUserRoleNewPassword() ); assertLeftNavMenuWithRole( fullname ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } @Test( dependsOnMethods = { "testUserWithContinuumGroupProjectUserRole" } ) @@ -405,7 +397,6 @@ public class UserRolesManagementTest login( username, getUserRoleNewPassword() ); assertLeftNavMenuWithRole( fullname ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } @Test( dependsOnMethods = { "testUserWithContinuumManageBuildEnvironmentRole" } ) @@ -428,7 +419,6 @@ public class UserRolesManagementTest login( username, getUserRoleNewPassword() ); assertLeftNavMenuWithRole( fullname ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } @Test( dependsOnMethods = { "testUserWithContinuumManageBuildTemplatesRole" } ) @@ -451,7 +441,6 @@ public class UserRolesManagementTest login( username, getUserRoleNewPassword() ); assertLeftNavMenuWithRole( fullname ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } @Test( dependsOnMethods = { "testUserWithContinuumManageInstallationsRole" } ) @@ -474,7 +463,6 @@ public class UserRolesManagementTest login( username, getUserRoleNewPassword() ); assertLeftNavMenuWithRole( fullname ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } @Test( dependsOnMethods = { "testUserWithContinuumManageLocalRepoRole" } ) @@ -497,7 +485,6 @@ public class UserRolesManagementTest login( username, getUserRoleNewPassword() ); assertLeftNavMenuWithRole( fullname ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } @Test( dependsOnMethods = { "testUserWithContinuumManagePurgingRole" } ) @@ -520,7 +507,6 @@ public class UserRolesManagementTest login( username, getUserRoleNewPassword() ); assertLeftNavMenuWithRole( fullname ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } @Test( dependsOnMethods = { "testUserWithContinuumManageQueuesRole" } ) @@ -543,7 +529,6 @@ public class UserRolesManagementTest login( username, getUserRoleNewPassword() ); assertLeftNavMenuWithRole( fullname ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } @Test( dependsOnMethods = { "testUserWithContinuumManageSchedulingRole" } ) @@ -566,7 +551,6 @@ public class UserRolesManagementTest login( username, getUserRoleNewPassword() ); assertLeftNavMenuWithRole( fullname ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } @Test( dependsOnMethods = { "testUserWithProjectAdminDefaultProjectGroup" } ) @@ -589,7 +573,6 @@ public class UserRolesManagementTest login( username, getUserRoleNewPassword() ); assertLeftNavMenuWithRole( fullname ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } @Test( dependsOnMethods = { "testUserWithProjectDevDefaultProjectGroup" } ) @@ -612,7 +595,6 @@ public class UserRolesManagementTest login( username, getUserRoleNewPassword() ); assertLeftNavMenuWithRole( fullname ); clickLinkWithText( "Logout" ); - login( getAdminUsername(), getAdminPassword() ); } } Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractAdminTest.java URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractAdminTest.java?rev=1367513&r1=1367512&r2=1367513&view=diff ============================================================================== --- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractAdminTest.java (original) +++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractAdminTest.java Tue Jul 31 12:17:29 2012 @@ -27,10 +27,14 @@ public abstract class AbstractAdminTest @BeforeMethod( alwaysRun = true ) public void loginAsAdmin() { - String username = getProperty( "ADMIN_USERNAME" ); + loginAs( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) ); + } + + protected void loginAs( String username, String password ) + { if ( !getSelenium().isElementPresent( "//span[@class='username' and text()='" + username + "']" ) ) { - login( username, getProperty( "ADMIN_PASSWORD" ) ); + login( username, password ); } } } Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractUserRolesManagementTest.java URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractUserRolesManagementTest.java?rev=1367513&r1=1367512&r2=1367513&view=diff ============================================================================== --- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractUserRolesManagementTest.java (original) +++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractUserRolesManagementTest.java Tue Jul 31 12:17:29 2012 @@ -38,18 +38,6 @@ public abstract class AbstractUserRolesM return basedir; } - public String getAdminUsername() - { - String adminUsername = getProperty( "ADMIN_USERNAME" ); - return adminUsername; - } - - public String getAdminPassword() - { - String adminPassword = getProperty( "ADMIN_PASSWORD" ); - return adminPassword; - } - //////////////////////////// // Assertions //////////////////////////// @@ -274,7 +262,7 @@ public abstract class AbstractUserRolesM private void createUser( String userName, String fullName, String emailAd, String password, String confirmPassword, boolean valid ) { - login( getAdminUsername() , getAdminPassword() ); + loginAsAdmin(); clickLinkWithText( "Users" ); clickButtonWithValue( "Create New User" ); assertCreateUserPage(); @@ -300,11 +288,6 @@ public abstract class AbstractUserRolesM } - public void login( String username, String password ) - { - login( username, password, true, "Login Page" ); - } - public void login( String username, String password, boolean valid, String assertReturnPage ) { if ( isLinkPresent( "Login" ) )