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() );
37 clickLinkWithText( "Logout" );
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" );
53 clickLinkWithText("Logout");
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();
59 clickLinkWithText("Logout");
60 //assertTextPresent("You are already logged in.");
62 login(username, getUserRoleNewPassword());
63 assertLeftNavMenuWithRole( fullname );
64 clickLinkWithText("Logout");
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" );
80 clickLinkWithText("Logout");
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();
86 clickLinkWithText("Logout");
87 //assertTextPresent("You are already logged in.");
89 login(username, getUserRoleNewPassword());
90 assertLeftNavMenuWithRole( fullname );
91 clickLinkWithText("Logout");
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" );
107 clickLinkWithText("Logout");
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();
113 clickLinkWithText("Logout");
114 //assertTextPresent("You are already logged in.");
116 login(username, getUserRoleNewPassword());
117 assertLeftNavMenuWithRole( fullname );
118 clickLinkWithText("Logout");
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" );
134 clickLinkWithText("Logout");
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();
140 clickLinkWithText("Logout");
141 //assertTextPresent("You are already logged in.");
143 login(username, getUserRoleNewPassword());
144 assertLeftNavMenuWithRole( fullname );
145 clickLinkWithText("Logout");
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" );
161 clickLinkWithText("Logout");
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();
167 clickLinkWithText("Logout");
168 //assertTextPresent("You are already logged in.");
170 login(username, getUserRoleNewPassword());
171 assertLeftNavMenuWithRole( fullname );
172 clickLinkWithText("Logout");
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" );
188 clickLinkWithText("Logout");
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();
194 clickLinkWithText("Logout");
195 //assertTextPresent("You are already logged in.");
197 login(username, getUserRoleNewPassword());
198 assertLeftNavMenuWithRole( fullname );
199 clickLinkWithText("Logout");
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" );
215 clickLinkWithText("Logout");
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();
221 clickLinkWithText("Logout");
222 //assertTextPresent("You are already logged in.");
224 login(username, getUserRoleNewPassword());
225 assertLeftNavMenuWithRole( fullname );
226 clickLinkWithText("Logout");
227 login( getAdminUsername() , getAdminPassword() );
230 /*@Test (dependsOnMethods = { "testUserWithRepoManagerInternalRole" } )
231 public void testUserWithRepoManagerSnapshotsRole()
233 username = getProperty("REPOMANAGER_SNAPSHOTS_USERNAME");
234 fullname = getProperty("REPOMANAGER_SNAPSHOTS_FULLNAME");
236 createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
237 clickLinkWithText( username );
238 clickLinkWithText( "Edit Roles" );
239 checkResourceRoleWithValue( fullname );
240 clickButtonWithValue( "Submit" );
242 clickLinkWithText("Logout");
243 login(username, getUserRolePassword());
244 changePassword( getUserRolePassword(), getUserRoleNewPassword());
246 // this section will be removed if issue from redback after changing password will be fixed.
247 getSelenium().goBack();
248 clickLinkWithText("Logout");
249 //assertTextPresent("You are already logged in.");
251 login(username, getUserRoleNewPassword());
252 assertLeftNavMenuWithRole( fullname );
253 clickLinkWithText("Logout");
254 login( getAdminUsername() , getAdminPassword() );
257 @Test (dependsOnMethods = { "testUserWithRepoManagerInternalRole" } )
258 public void testUserWithRepoObserverInternalRole()
260 username = getProperty( "REPOOBSERVER_INTERNAL_USERNAME" );
261 fullname = getProperty( "REPOOBSERVER_INTERNAL_FULLNAME" );
263 createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
264 clickLinkWithText( username );
265 clickLinkWithText( "Edit Roles" );
266 checkResourceRoleWithValue( fullname );
267 clickButtonWithValue( "Submit" );
269 clickLinkWithText("Logout");
270 login(username, getUserRolePassword());
271 changePassword( getUserRolePassword(), getUserRoleNewPassword());
273 // this section will be removed if issue from redback after changing password will be fixed.
274 getSelenium().goBack();
275 clickLinkWithText("Logout");
276 //assertTextPresent("You are already logged in.");
278 login(username, getUserRoleNewPassword());
279 assertLeftNavMenuWithRole( fullname );
280 clickLinkWithText("Logout");
281 login( getAdminUsername() , getAdminPassword() );
284 /*@Test (dependsOnMethods = { "testUserWithRepoObserverInternalRole" } )
285 public void testUserWithRepoObserverSnapshotsRole()
287 username = getProperty( "REPOOBSERVER_SNAPSHOTS_USERNAME" );
288 fullname = getProperty( "REPOOBSERVER_SNAPSHOTS_FULLNAME" );
290 createUser(username, fullname, getUserEmail(), getUserRolePassword(), true);
291 clickLinkWithText( username );
292 clickLinkWithText( "Edit Roles" );
293 checkResourceRoleWithValue( fullname );
294 clickButtonWithValue( "Submit" );
296 clickLinkWithText("Logout");
297 login(username, getUserRolePassword());
298 changePassword( getUserRolePassword(), getUserRoleNewPassword());
300 // this section will be removed if issue from redback after changing password will be fixed.
301 getSelenium().goBack();
302 clickLinkWithText("Logout");
303 //assertTextPresent("You are already logged in.");
305 login(username, getUserRoleNewPassword());
306 assertLeftNavMenuWithRole( fullname );
307 clickLinkWithText("Logout");
308 login( getAdminUsername() , getAdminPassword() );