1 package org.apache.archiva.web.test;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.archiva.web.test.parent.AbstractArchivaTest;
23 import org.testng.annotations.Test;
25 @Test( groups = { "userroles" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
26 public class UserRolesTest
27 extends AbstractArchivaTest
30 public void testBasicAddDeleteUser()
32 username = getProperty( "GUEST_USERNAME" );
33 fullname = getProperty( "GUEST_FULLNAME" );
35 createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
36 deleteUser( username, fullname, getUserEmail() );
38 login( getAdminUsername(), getAdminPassword() );
41 @Test( dependsOnMethods = { "testBasicAddDeleteUser" } )
42 public void testUserWithGuestRole()
44 username = getProperty( "GUEST_USERNAME" );
45 fullname = getProperty( "GUEST_FULLNAME" );
47 createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
48 clickLinkWithText( username );
49 clickLinkWithText( "Edit Roles" );
50 checkUserRoleWithValue( fullname );
51 clickButtonWithValue( "Submit" );
54 login( username, getUserRolePassword() );
55 changePassword( getUserRolePassword(), getUserRoleNewPassword() );
57 // this section will be removed if issue from redback after changing password will be fixed.
58 getSelenium().goBack();
60 // assertTextPresent("You are already logged in.");
62 login( username, getUserRoleNewPassword() );
63 assertLeftNavMenuWithRole( fullname );
65 login( getAdminUsername(), getAdminPassword() );
68 @Test( dependsOnMethods = { "testUserWithGuestRole" } )
69 public void testUserWithRegisteredUserRole()
71 username = getProperty( "REGISTERED_USERNAME" );
72 fullname = getProperty( "REGISTERED_FULLNAME" );
74 createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
75 clickLinkWithText( username );
76 clickLinkWithText( "Edit Roles" );
77 checkUserRoleWithValue( fullname );
78 clickButtonWithValue( "Submit" );
81 login( username, getUserRolePassword() );
82 changePassword( getUserRolePassword(), getUserRoleNewPassword() );
84 // this section will be removed if issue from redback after changing password will be fixed.
85 getSelenium().goBack();
87 // assertTextPresent("You are already logged in.");
89 login( username, getUserRoleNewPassword() );
90 assertLeftNavMenuWithRole( fullname );
92 login( getAdminUsername(), getAdminPassword() );
95 @Test( dependsOnMethods = { "testUserWithRegisteredUserRole" } )
96 public void testUserWithSysAdminUserRole()
98 username = getProperty( "SYSAD_USERNAME" );
99 fullname = getProperty( "SYSAD_FULLNAME" );
101 createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
102 clickLinkWithText( username );
103 clickLinkWithText( "Edit Roles" );
104 checkUserRoleWithValue( fullname );
105 clickButtonWithValue( "Submit" );
108 login( username, getUserRolePassword() );
109 changePassword( getUserRolePassword(), getUserRoleNewPassword() );
111 // this section will be removed if issue from redback after changing password will be fixed.
112 getSelenium().goBack();
114 // assertTextPresent("You are already logged in.");
116 login( username, getUserRoleNewPassword() );
117 assertLeftNavMenuWithRole( fullname );
119 login( getAdminUsername(), getAdminPassword() );
122 @Test( dependsOnMethods = { "testUserWithSysAdminUserRole" } )
123 public void testUserWithUserAdminUserRole()
125 username = getProperty( "USERADMIN_USERNAME" );
126 fullname = getProperty( "USERADMIN_FULLNAME" );
128 createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
129 clickLinkWithText( username );
130 clickLinkWithText( "Edit Roles" );
131 checkUserRoleWithValue( fullname );
132 clickButtonWithValue( "Submit" );
135 login( username, getUserRolePassword() );
136 changePassword( getUserRolePassword(), getUserRoleNewPassword() );
138 // this section will be removed if issue from redback after changing password will be fixed.
139 getSelenium().goBack();
141 // assertTextPresent("You are already logged in.");
143 login( username, getUserRoleNewPassword() );
144 assertLeftNavMenuWithRole( fullname );
146 login( getAdminUsername(), getAdminPassword() );
149 @Test( dependsOnMethods = { "testUserWithUserAdminUserRole" } )
150 public void testUserWithGlobalRepoManagerRole()
152 username = getProperty( "GLOBALREPOMANAGER_USERNAME" );
153 fullname = getProperty( "GLOBALREPOMANAGER_FULLNAME" );
155 createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
156 clickLinkWithText( username );
157 clickLinkWithText( "Edit Roles" );
158 checkUserRoleWithValue( fullname );
159 clickButtonWithValue( "Submit" );
162 login( username, getUserRolePassword() );
163 changePassword( getUserRolePassword(), getUserRoleNewPassword() );
165 // this section will be removed if issue from redback after changing password will be fixed.
166 getSelenium().goBack();
168 // assertTextPresent("You are already logged in.");
170 login( username, getUserRoleNewPassword() );
171 assertLeftNavMenuWithRole( fullname );
173 login( getAdminUsername(), getAdminPassword() );
176 @Test( dependsOnMethods = { "testUserWithGlobalRepoManagerRole" } )
177 public void testUserWithGlobalRepoObserverRole()
179 username = getProperty( "GLOBALREPOOBSERVER_USERNAME" );
180 fullname = getProperty( "GLOBALREPOOBSERVER_FULLNAME" );
182 createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
183 clickLinkWithText( username );
184 clickLinkWithText( "Edit Roles" );
185 checkUserRoleWithValue( fullname );
186 clickButtonWithValue( "Submit" );
189 login( username, getUserRolePassword() );
190 changePassword( getUserRolePassword(), getUserRoleNewPassword() );
192 // this section will be removed if issue from redback after changing password will be fixed.
193 getSelenium().goBack();
195 // assertTextPresent("You are already logged in.");
197 login( username, getUserRoleNewPassword() );
198 assertLeftNavMenuWithRole( fullname );
200 login( getAdminUsername(), getAdminPassword() );
203 @Test( dependsOnMethods = { "testUserWithGlobalRepoObserverRole" } )
204 public void testUserWithRepoManagerInternalRole()
206 username = getProperty( "REPOMANAGER_INTERNAL_USERNAME" );
207 fullname = getProperty( "REPOMANAGER_INTERNAL_FULLNAME" );
209 createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
210 clickLinkWithText( username );
211 clickLinkWithText( "Edit Roles" );
212 checkResourceRoleWithValue( fullname );
213 clickButtonWithValue( "Submit" );
216 login( username, getUserRolePassword() );
217 changePassword( getUserRolePassword(), getUserRoleNewPassword() );
219 // this section will be removed if issue from redback after changing password will be fixed.
220 getSelenium().goBack();
222 // assertTextPresent("You are already logged in.");
224 login( username, getUserRoleNewPassword() );
225 assertLeftNavMenuWithRole( fullname );
227 login( getAdminUsername(), getAdminPassword() );
231 * @Test (dependsOnMethods = { "testUserWithRepoManagerInternalRole" } ) public void
232 * testUserWithRepoManagerSnapshotsRole() { username = getProperty("REPOMANAGER_SNAPSHOTS_USERNAME"); fullname =
233 * getProperty("REPOMANAGER_SNAPSHOTS_FULLNAME"); createUser(username, fullname, getUserEmail(),
234 * getUserRolePassword(), true); clickLinkWithText( username ); clickLinkWithText( "Edit Roles" );
235 * checkResourceRoleWithValue( fullname ); clickButtonWithValue( "Submit" ); clickLinkWithText("Logout");
236 * login(username, getUserRolePassword()); changePassword( getUserRolePassword(), getUserRoleNewPassword()); // this
237 * section will be removed if issue from redback after changing password will be fixed. getSelenium().goBack();
238 * clickLinkWithText("Logout"); //assertTextPresent("You are already logged in."); login(username,
239 * getUserRoleNewPassword()); assertLeftNavMenuWithRole( fullname ); clickLinkWithText("Logout"); login(
240 * getAdminUsername() , getAdminPassword() ); }
243 @Test( dependsOnMethods = { "testUserWithRepoManagerInternalRole" } )
244 public void testUserWithRepoObserverInternalRole()
246 username = getProperty( "REPOOBSERVER_INTERNAL_USERNAME" );
247 fullname = getProperty( "REPOOBSERVER_INTERNAL_FULLNAME" );
249 createUser( username, fullname, getUserEmail(), getUserRolePassword(), true );
250 clickLinkWithText( username );
251 clickLinkWithText( "Edit Roles" );
252 checkResourceRoleWithValue( fullname );
253 clickButtonWithValue( "Submit" );
256 login( username, getUserRolePassword() );
257 changePassword( getUserRolePassword(), getUserRoleNewPassword() );
259 // this section will be removed if issue from redback after changing password will be fixed.
260 getSelenium().goBack();
262 // assertTextPresent("You are already logged in.");
264 login( username, getUserRoleNewPassword() );
265 assertLeftNavMenuWithRole( fullname );
267 login( getAdminUsername(), getAdminPassword() );
271 * @Test (dependsOnMethods = { "testUserWithRepoObserverInternalRole" } ) public void
272 * testUserWithRepoObserverSnapshotsRole() { username = getProperty( "REPOOBSERVER_SNAPSHOTS_USERNAME" ); fullname =
273 * getProperty( "REPOOBSERVER_SNAPSHOTS_FULLNAME" ); createUser(username, fullname, getUserEmail(),
274 * getUserRolePassword(), true); clickLinkWithText( username ); clickLinkWithText( "Edit Roles" );
275 * checkResourceRoleWithValue( fullname ); clickButtonWithValue( "Submit" ); clickLinkWithText("Logout");
276 * login(username, getUserRolePassword()); changePassword( getUserRolePassword(), getUserRoleNewPassword()); // this
277 * section will be removed if issue from redback after changing password will be fixed. getSelenium().goBack();
278 * clickLinkWithText("Logout"); //assertTextPresent("You are already logged in."); login(username,
279 * getUserRoleNewPassword()); assertLeftNavMenuWithRole( fullname ); clickLinkWithText("Logout"); login(
280 * getAdminUsername() , getAdminPassword() ); }