continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mbac...@apache.org
Subject svn commit: r802643 - in /continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test: UserRolesManagementTest.java parent/AbstractContinuumTest.java
Date Mon, 10 Aug 2009 03:23:34 GMT
Author: mbaclay
Date: Mon Aug 10 03:23:30 2009
New Revision: 802643

URL: http://svn.apache.org/viewvc?rev=802643&view=rev
Log:
[CONTINUUM-2245] Continuum User Roles Tests
Added tests to users with assigned roles.

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/AbstractContinuumTest.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=802643&r1=802642&r2=802643&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
Mon Aug 10 03:23:30 2009
@@ -3,7 +3,7 @@
 import org.apache.continuum.web.test.parent.AbstractUserRolesManagementTest;
 import org.testng.annotations.Test;
 
-@Test( groups = { "userroles" }, dependsOnMethods = { "testWithCorrectUsernamePassword" }
)
+@Test( groups = { "userroles" }, dependsOnMethods = { "testWithCorrectUsernamePassword" },
sequential = true )
 public class UserRolesManagementTest
     extends AbstractUserRolesManagementTest
 {
@@ -17,9 +17,14 @@
         clickLinkWithText( "Logout" );
         login( getAdminUsername(), getAdminPassword() );
     }
-
+    
+    /*
+     * GUEST USER ROLE
+     * Guest Role could only view the About Page. Project Groups should not be shown when
clicking
+     * Show Project Group link.
+    */
     @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
-    public void testUserWithGuestRole()
+    public void testAddUserWithGuestRole()
     {
         username = getProperty( "GUEST_USERNAME" );
         fullname = getProperty( "GUEST_FULLNAME" );
@@ -38,17 +43,30 @@
         waitPage();
         clickLinkWithText( "Logout" );
         // assertTextPresent("You are already logged in.");
+    }
 
-        login( username, getUserRoleNewPassword() );
-        assertLeftNavMenuWithRole( fullname );
-        clickLinkWithText( "Show Project Groups" );
-        assertTextPresent( "Project Groups list is empty." );
-        clickLinkWithText( "Logout" );
-        login( getAdminUsername(), getAdminPassword() );
+    @Test( dependsOnMethods = { "testAddUserWithGuestRole" } )
+    public void testGuestUserRoleFunction()
+    {
+	username = getProperty( "GUEST_USERNAME" );
+        fullname = getProperty( "GUEST_FULLNAME" );
+	login( username, getUserRoleNewPassword() );
+	assertLeftNavMenuWithRole( fullname );
+	goToAboutPage();
+	clickLinkWithText( "Show Project Groups" );
+	assertTextPresent( "Project Groups list is empty" );
+	clickLinkWithText( "Logout" );
+	login( getAdminUsername(), getAdminPassword() );
     }
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
-    public void testUserWithRegisteredUserRole()
+
+    /*
+     * REGISTERED USER ROLE
+     * Registered User Role could only view the About Page. Project Groups should not be
shown when clicking
+     * Show Project Group link.
+    */
+    @Test( dependsOnMethods = { "testBasicAddDeleteUser" , "testGuestUserRoleFunction" }
)
+    public void testAddUserWithRegisteredUserRole()
     {
         username = getProperty( "REGISTERED_USERNAME" );
         fullname = getProperty( "REGISTERED_FULLNAME" );
@@ -56,29 +74,42 @@
         createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
         assertCreatedUserInfo( username );
         checkUserRoleWithValue( fullname );
-		clickButtonWithValue( "Submit" );
-
+	clickButtonWithValue( "Submit" );
         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();
         waitPage();
         clickLinkWithText( "Logout" );
         // assertTextPresent("You are already logged in.");
+    }
 
-        login( username, getUserRoleNewPassword() );
+    @Test( dependsOnMethods = { "testAddUserWithRegisteredUserRole" } )
+    public void testRegisteredRoleFunction()
+    {
+	username = getProperty( "REGISTERED_USERNAME" );
+        fullname = getProperty( "REGISTERED_FULLNAME" );
+	login( username, getUserRoleNewPassword() );
         assertLeftNavMenuWithRole( fullname );
+	goToAboutPage();
         clickLinkWithText( "Show Project Groups" );
         assertTextPresent( "Project Groups list is empty." );
         clickLinkWithText( "Logout" );
         login( getAdminUsername(), getAdminPassword() );
     }
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
-    public void testUserWithSystemAdminRole()
+    /*
+     * SYSTEM ADMINISTRATOR ROLE
+     * Has access to all functions in the application.
+     *
+     * The following tests only asserts elements that could be shown 
+     * when system admin user is logged in since the user that is used 
+     * to test the other functionalities is a system admin user.
+     */
+    @Test( dependsOnMethods = { "testBasicAddDeleteUser" , "testRegisteredRoleFunction" }
)
+    public void testAddUserWithSystemAdminRole()
     {
         username = getProperty( "SYSAD_USERNAME" );
         fullname = getProperty( "SYSAD_FULLNAME" );
@@ -86,7 +117,7 @@
         createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
         assertCreatedUserInfo( username );
         checkUserRoleWithValue( fullname );
-		clickButtonWithValue( "Submit" );
+	clickButtonWithValue( "Submit" );
 
         clickLinkWithText( "Logout" );
 
@@ -97,18 +128,31 @@
         getSelenium().goBack();
         waitPage();
         clickLinkWithText( "Logout" );
-        // assertTextPresent("You are already logged in.");
+    }
 
-        login( username, getUserRoleNewPassword() );
+    @Test( dependsOnMethods = { "testAddUserWithSystemAdminRole" } )
+    public void testSystemAdminRoleFunction()
+    {
+	username = getProperty( "SYSAD_USERNAME" );
+        fullname = getProperty( "SYSAD_FULLNAME" );
+	login( username, getUserRoleNewPassword() );
         assertLeftNavMenuWithRole( fullname );
         clickLinkWithText( "Show Project Groups" );
         assertTextNotPresent( "Project Groups list is empty." );
+	assertLinkPresent( "Default Project Group" );
+	
         clickLinkWithText( "Logout" );
         login( getAdminUsername(), getAdminPassword() );
     }
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
-    public void testUserWithUserAdminRole()
+    /* 
+     * USER ADMIN ROLE
+     * User Admin role could only add/edit/delete users and can view user Roles. Cannot view
Project Groups
+     * but can assign a User to a project.
+     *
+     */
+    @Test( dependsOnMethods = { "testBasicAddDeleteUser" , "testSystemAdminRoleFunction"
} )
+    public void testAddUserWithUserAdminRole()
     {
         username = getProperty( "USERADMIN_USERNAME" );
         fullname = getProperty( "USERADMIN_FULLNAME" );
@@ -127,18 +171,48 @@
         getSelenium().goBack();
         waitPage();
         clickLinkWithText( "Logout" );
-        // assertTextPresent("You are already logged in.");
-
-        login( username, getUserRoleNewPassword() );
+    }
+    
+    @Test( dependsOnMethods = { "testAddUserWithUserAdminRole" } )
+    public void testUserAdminFunction()
+    {
+	username = getProperty( "USERADMIN_USERNAME" );
+        fullname = getProperty( "USERADMIN_FULLNAME" );
+	login( username, getUserRoleNewPassword() );
         assertLeftNavMenuWithRole( fullname );
         clickLinkWithText( "Show Project Groups" );
         assertTextPresent( "Project Groups list is empty." );
-        clickLinkWithText( "Logout" );
+	// add user
+	clickLinkWithText( "Users" );
+	clickButtonWithValue( "Create New User" );
+	assertCreateUserPage();
+	setFieldValue( "user.username", "guest0" );
+        setFieldValue( "user.fullName", "guest0" );
+        setFieldValue( "user.email", "guest0@guest0.com" );
+        setFieldValue( "user.password", "pass" );
+        setFieldValue( "user.confirmPassword", "pass" );
+        submit();
+	assertUserRolesPage( );
+        clickButtonWithValue( "Submit" );
+	selectValue( "name=ec_rd", "50" );
+        waitPage();
+	// delete user	
+	deleteUser( "guest0", "guest0", "guest0@guest0.com" );	
+	// TODO edit user
+
+	clickLinkWithText( "Logout" );
         login( getAdminUsername(), getAdminPassword() );
     }
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
-    public void testUserWithContinuumGroupProjectAdminRole()
+    /*
+     * CONTINUUM GROUP PROJECT ADMIN
+     * - Can Add/Edit/Delete Project Group, can Add/Edit/Delete projects, can assign Users
+     *    roles to existing projects, can add/edit/delete schedules, can view existing roles
for the
+     *    projects, can build/release projects
+     * - Cannot add users, --- --- ---
+     */
+    @Test( dependsOnMethods = { "testBasicAddDeleteUser" , "testUserAdminFunction" } )
+    public void testAddUserWithContinuumGroupProjectAdminRole()
     {
         username = getProperty( "GROUPPROJECTADMIN_USERNAME" );
         fullname = getProperty( "GROUPPROJECTADMIN_FULLNAME" );
@@ -158,14 +232,114 @@
         waitPage();
         clickLinkWithText( "Logout" );
         // assertTextPresent("You are already logged in.");
+    }
 
-        login( username, getUserRoleNewPassword() );
+    @Test( dependsOnMethods = { "testAddUserWithContinuumGroupProjectAdminRole" } )
+    public void testContinuumGroupProjectAdmin_AddProjectGroup() throws Exception
+    {
+	username = getProperty( "GROUPPROJECTADMIN_USERNAME" );
+        fullname = getProperty( "GROUPPROJECTADMIN_FULLNAME" );
+	login( username, getUserRoleNewPassword() );
         assertLeftNavMenuWithRole( fullname );
-        clickLinkWithText( "Logout" );
+	clickLinkWithText( "Show Project Groups" );
+        assertTextNotPresent( "Project Groups list is empty." );
+	// test add project group
+	clickButtonWithValue( "Add Project Group" );
+	setFieldValue( "name", "Test Group" );
+        setFieldValue( "groupId", "Test Group" );
+        setFieldValue( "description", "testing project group" );
+	submit();
+    }
+
+    @Test( dependsOnMethods = { "testContinuumGroupProjectAdmin_AddProjectGroup" } )
+    public void testContinuumGroupProjectAdmin_AddProjectToProjectGroup() throws Exception
+    {
+	clickLinkWithText( "Test Group" );
+	clickButtonWithValue( "Add" );	
+	assertAddMavenTwoProjectPage();
+	setFieldValue( "m2PomUrl", "https://svn.apache.org/repos/asf/continuum/sandbox/continuum-build-queue-test-data/pom.xml"
);
+        clickButtonWithValue( "Add" );
+	String title;
+	boolean success = true;
+        if ( success )
+        {
+            title = "Continuum - Project Group";
+        }
+        else
+        {
+            title = "Continuum - Add Maven 2 Project";
+        }
+        waitAddProject( title );
+	assertTextPresent( "ContinuumBuildQueueTestData" );
+    }
+    
+    @Test( dependsOnMethods = { "testContinuumGroupProjectAdmin_AddProjectToProjectGroup"
} )
+    public void testContinuumGroupProjectAdmin_BuildProject() throws Exception
+    {
+	buildProjectGroup( "Test Group", "Test Group", "testing project group", "ContinuumBuildQueueTestData"
);
+    }
+
+    @Test( dependsOnMethods = { "testContinuumGroupProjectAdmin_BuildProject" } )
+    public void testContinuumGroupProjectAdmin_AssignUserToAGroup()
+    {
+	clickLinkWithText( "Users" );
+	clickLinkWithText( "guest1" );
+	clickLinkWithText( "Edit Roles" );
+	checkUserRoleWithValue( "Guest" );
+	checkResourceRoleWithValue( "Project Developer - Test Group" );
+	submit();
+	clickLinkWithText( "Logout" );
+        login( getAdminUsername(), getAdminPassword() );
+    }
+
+    /*
+     * Uncomment the lines below to release a Project provided that you add
+     * the values under RELEASE A PROJECT in testng.properties file (project's pom url, access
to project to be released.)
+    	
+    @Test( dependsOnMethods = { "testContinuumGroupProjectAdmin_AssignUserToAGroup" } )
+    public void testContinuumGroupProjectAdmin_ReleaseProject() throws Exception
+    {
+	String projectUrl = getProperty( "PROJECT_URL_TO_BE_RELEASED" );
+	String projectName = getProperty( "PROJECT_NAME_TO_BE_RELEASED" );
+	String projectUsername = getProperty( "PROJECT_USERNAME" );
+	String projectPassword = getProperty( "PROJECT_USERNAME" );
+	// add a project group
+	clickLinkWithText( "Show Project Groups" );
+	clickButtonWithValue( "Add Project Group" );
+	setFieldValue( "name", "Project Group" );
+        setFieldValue( "groupId", "Project Group" );
+        setFieldValue( "description", "project group for projects to be released" );
+	submit();
+	// add a project to a project group
+	clickLinkWithText( "Project Group" );
+	clickButtonWithValue( "Add" );
+	assertAddMavenTwoProjectPage();
+	setFieldValue( "m2PomUrl", projectUrl );
+	// set username and password here
+	setFieldValue( "scmUsername", projectUsername );
+	setFieldValue( "scmPassword", projectPassword );
+	clickButtonWithValue( "Add" );
+	String title;
+	boolean success = true;
+	if ( success )
+        {
+            title = "Continuum - Project Group";
+        }
+        else
+        {
+            title = "Continuum - Add Maven 2 Project";
+        }
+        waitAddProject( title );
+	// build the project added in the project group
+	buildProjectGroup( "Project Group", "Project Group", "project group for projects to be released",
projectName );
+	// release the project
+	clickButtonWithValue( "Release" );
+	clickLinkWithText( "Logout" );
         login( getAdminUsername(), getAdminPassword() );
     }
+    */
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
+    @Test( dependsOnMethods = { "testContinuumGroupProjectAdmin_BuildProject" } )
     public void testUserWithContinuumGroupProjectDeveloperRole()
     {
         username = getProperty( "GROUPPROJECTDEVELOPER_USERNAME" );
@@ -193,7 +367,7 @@
         login( getAdminUsername(), getAdminPassword() );
     }
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
+    @Test( dependsOnMethods = { "testUserWithContinuumGroupProjectDeveloperRole" } )
     public void testUserWithContinuumGroupProjectUserRole()
     {
         username = getProperty( "GROUPPROJECTUSER_USERNAME" );
@@ -221,7 +395,7 @@
         login( getAdminUsername(), getAdminPassword() );
     }
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
+    @Test( dependsOnMethods = { "testUserWithContinuumGroupProjectUserRole" } )
     public void testUserWithContinuumManageBuildEnvironmentRole()
     {
         username = getProperty( "MANAGEBUILDENVIRONMENT_USERNAME" );
@@ -249,7 +423,7 @@
         login( getAdminUsername(), getAdminPassword() );
     }
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
+    @Test( dependsOnMethods = { "testUserWithContinuumManageBuildEnvironmentRole" } )
     public void testUserWithContinuumManageBuildTemplatesRole()
     {
         username = getProperty( "MANAGEBUILDTEMPLATES_USERNAME" );
@@ -277,7 +451,7 @@
         login( getAdminUsername(), getAdminPassword() );
     }
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
+    @Test( dependsOnMethods = { "testUserWithContinuumManageBuildTemplatesRole" } )
     public void testUserWithContinuumManageInstallationsRole()
     {
         username = getProperty( "MANAGEINSTALLATIONS_USERNAME" );
@@ -305,7 +479,7 @@
         login( getAdminUsername(), getAdminPassword() );
     }
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
+    @Test( dependsOnMethods = { "testUserWithContinuumManageInstallationsRole" } )
     public void testUserWithContinuumManageLocalRepoRole()
     {
         username = getProperty( "MANAGELOCALREPOS_USERNAME" );
@@ -333,7 +507,7 @@
         login( getAdminUsername(), getAdminPassword() );
     }
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
+    @Test( dependsOnMethods = { "testUserWithContinuumManageLocalRepoRole" } )
     public void testUserWithContinuumManagePurgingRole()
     {
         username = getProperty( "MANAGEPURGING_USERNAME" );
@@ -361,7 +535,7 @@
         login( getAdminUsername(), getAdminPassword() );
     }
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
+    @Test( dependsOnMethods = { "testUserWithContinuumManagePurgingRole" } )
     public void testUserWithContinuumManageQueuesRole()
     {
         username = getProperty( "MANAGEQUEUES_USERNAME" );
@@ -389,7 +563,7 @@
         login( getAdminUsername(), getAdminPassword() );
     }
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
+    @Test( dependsOnMethods = { "testUserWithContinuumManageQueuesRole" } )
     public void testUserWithContinuumManageSchedulingRole()
     {
         username = getProperty( "MANAGESCHEDULING_USERNAME" );
@@ -416,7 +590,7 @@
         login( getAdminUsername(), getAdminPassword() );
     }
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
+    @Test( dependsOnMethods = { "testUserWithContinuumManageSchedulingRole" } )
     public void testUserWithProjectAdminDefaultProjectGroup()
     {
         username = getProperty( "PROJECTADMINISTRATOR_DEFAULTPROJECTGROUP_USERNAME" );
@@ -444,7 +618,7 @@
         login( getAdminUsername(), getAdminPassword() );
     }
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
+    @Test( dependsOnMethods = { "testUserWithProjectAdminDefaultProjectGroup" } )
     public void testUserWithProjectDevDefaultProjectGroup()
     {
         username = getProperty( "PROJECTDEVELOPER_DEFAULTPROJECTGROUP_USERNAME" );
@@ -472,7 +646,7 @@
         login( getAdminUsername(), getAdminPassword() );
     }
 
-    @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
+    @Test( dependsOnMethods = { "testUserWithProjectDevDefaultProjectGroup" } )
     public void testUserWithProjectUserDefaultProjectGroup()
     {
         username = getProperty( "PROJECTUSER_DEFAULTPROJECTGROUP_USERNAME" );

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java?rev=802643&r1=802642&r2=802643&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
Mon Aug 10 03:23:30 2009
@@ -749,7 +749,7 @@
         waitAddProject( title );
     }
 
-    private void waitAddProject(String title )
+    public void waitAddProject(String title )
         throws Exception
     {
 



Mime
View raw message