blob: d2e445f952bc7971712e30baf542fbbc9c1638ed [file] [log] [blame]
Sushma M M87a5b2d2020-07-31 00:58:48 -05001*** Settings ***
2
Rahul Maheshwari142642d2021-08-24 00:00:15 -05003Documentation Test OpenBMC GUI "User management" sub-menu of "Security and access".
Sushma M M87a5b2d2020-07-31 00:58:48 -05004
Rahul Maheshwari41747da2020-11-17 09:09:52 -06005Resource ../../lib/gui_resource.robot
Sushma M M87a5b2d2020-07-31 00:58:48 -05006
7Suite Setup Launch Browser And Login GUI
Nandish-Mattic4024a32023-03-13 01:59:40 -05008Suite Teardown Suite Teardown Execution
Sushma M M87a5b2d2020-07-31 00:58:48 -05009Test Setup Test Setup Execution
10
George Keishing0302e9a2023-10-12 21:48:35 +053011Force Tags User_Management_Sub_Menu
Sushma M M87a5b2d2020-07-31 00:58:48 -050012
13*** Variables ***
rramyasr-in9e2c96f2023-01-24 07:59:34 -060014
15
Rahul Maheshwari142642d2021-08-24 00:00:15 -050016${xpath_user_management_heading} //h1[text()="User management"]
Sushma M M26302992020-08-31 01:15:26 -050017${xpath_select_user} //input[contains(@class,"custom-control-input")]
18${xpath_account_policy} //button[contains(text(),'Account policy settings')]
19${xpath_add_user} //button[contains(text(),'Add user')]
Rahul Maheshwari142642d2021-08-24 00:00:15 -050020${xpath_edit_user} //*[@data-test-id='userManagement-tableRowAction-edit-0']
21${xpath_delete_user} //*[@data-test-id='userManagement-tableRowAction-delete-1']
22${xpath_account_status_enabled_button} //*[@data-test-id='userManagement-radioButton-statusEnabled']
23${xpath_account_status_disabled_button} //*[@data-test-id='userManagement-radioButton-statusDisabled']
24${xpath_username_input_button} //*[@data-test-id='userManagement-input-username']
25${xpath_privilege_list_button} //*[@data-test-id='userManagement-select-privilege']
26${xpath_password_input_button} //*[@data-test-id='userManagement-input-password']
27${xpath_password_confirm_button} //*[@data-test-id='userManagement-input-passwordConfirmation']
28${xpath_cancel_button} //*[@data-test-id='userManagement-button-cancel']
29${xpath_submit_button} //*[@data-test-id='userManagement-button-submit']
Nandish-Matti6e82f982023-10-19 01:03:08 -050030${xpath_delete_button} //button[text()='Delete user']
manashsarmac67f2262020-09-24 08:16:08 -050031${xpath_add_user_heading} //h5[contains(text(),'Add user')]
manashsarma66f03842020-09-23 08:52:38 -050032${xpath_policy_settings_header} //*[text()="Account policy settings"]
Rahul Maheshwari142642d2021-08-24 00:00:15 -050033${xpath_auto_unlock} //*[@data-test-id='userManagement-radio-automaticUnlock']
34${xpath_manual_unlock} //*[@data-test-id='userManagement-radio-manualUnlock']
35${xpath_max_failed_login} //*[@data-test-id='userManagement-input-lockoutThreshold']
manashsarmacc35bad2020-09-30 04:19:01 -050036${test_user_password} TestPwd1
Nandish-Matti2d6c9042023-11-03 01:04:15 -050037${xpath_user_creation_error_message} //*[contains(text(),'Error creating user')]
38${xpath_close_error_message} //*/*[contains(text(),'Error')]/following-sibling::button
Nandish-Mattic4024a32023-03-13 01:59:40 -050039@{username} admin_user readonly_user disabled_user
Nandish-Matti2d6c9042023-11-03 01:04:15 -050040@{list_user_privilege} Administrator ReadOnly
Sushma M M87a5b2d2020-07-31 00:58:48 -050041
rramyasr-in9e2c96f2023-01-24 07:59:34 -060042
Sushma M M87a5b2d2020-07-31 00:58:48 -050043*** Test Cases ***
44
Rahul Maheshwari142642d2021-08-24 00:00:15 -050045Verify Navigation To User Management Page
46 [Documentation] Verify navigation to user management page.
47 [Tags] Verify_Navigation_To_User_Management_Page
Sushma M M26302992020-08-31 01:15:26 -050048
Rahul Maheshwari142642d2021-08-24 00:00:15 -050049 Page Should Contain Element ${xpath_user_management_heading}
Sushma M M26302992020-08-31 01:15:26 -050050
51
Rahul Maheshwari142642d2021-08-24 00:00:15 -050052Verify Existence Of All Sections In User Management Page
53 [Documentation] Verify existence of all sections in user management page.
54 [Tags] Verify_Existence_Of_All_Sections_In_User_Management_Page
Sushma M M87a5b2d2020-07-31 00:58:48 -050055
56 Page should contain View privilege role descriptions
57
58
Rahul Maheshwari142642d2021-08-24 00:00:15 -050059Verify Existence Of All Input Boxes In User Management Page
60 [Documentation] Verify existence of all sections in user managemnet page.
61 [Tags] Verify_Existence_Of_All_Input_Boxes_In_User_Management_Page
Sushma M M87a5b2d2020-07-31 00:58:48 -050062
63 Page Should Contain Checkbox ${xpath_select_user}
64
65
Rahul Maheshwari142642d2021-08-24 00:00:15 -050066Verify Existence Of All Buttons In User Management Page
67 [Documentation] Verify existence of all buttons in user management page.
68 [Tags] Verify_Existence_Of_All_Buttons_In_User_Management_Page
Sushma M M87a5b2d2020-07-31 00:58:48 -050069
70 Page should contain Button ${xpath_account_policy}
71 Page should contain Button ${xpath_add_user}
manashsarma90d91fa2021-04-08 07:07:16 -050072 Page Should Contain Element ${xpath_edit_user}
73 Page Should Contain Element ${xpath_delete_user}
Sushma M M87a5b2d2020-07-31 00:58:48 -050074
75
manashsarmac67f2262020-09-24 08:16:08 -050076Verify Existence Of All Button And Fields In Add User
77 [Documentation] Verify existence of all buttons and fields in add user page.
78 [Tags] Verify_Existence_Of_All_Button_And_Fields_In_Add_User
manashsarma9d67d262020-10-15 11:20:48 -050079 [Teardown] Click Element ${xpath_cancel_button}
manashsarmac67f2262020-09-24 08:16:08 -050080
81 Click Element ${xpath_add_user}
82 Wait Until Page Contains Element ${xpath_add_user_heading}
83 Page Should Contain Element ${xpath_account_status_enabled_button}
84 Page Should Contain Element ${xpath_account_status_disabled_button}
85 Page Should Contain Element ${xpath_username_input_button}
86 Page Should Contain Element ${xpath_privilege_list_button}
87 Page Should Contain Element ${xpath_password_input_button}
88 Page Should Contain Element ${xpath_password_confirm_button}
89 Page Should Contain Element ${xpath_cancel_button}
90 Page Should Contain Element ${xpath_submit_button}
91
manashsarma66f03842020-09-23 08:52:38 -050092
93Verify Existence Of All Buttons And Fields In Account Policy Settings
94 [Documentation] Verify existence of all buttons and fields in account policy settings page.
95 [Tags] Verify_Existence_Of_All_Buttons_And_Fields_In_Account_Policy_Settings
manashsarma5c4a7d12020-10-21 05:21:37 -050096 [Teardown] Click Element ${xpath_cancel_button}
manashsarma66f03842020-09-23 08:52:38 -050097
98 Click Element ${xpath_account_policy}
manashsarma5c4a7d12020-10-21 05:21:37 -050099 Wait Until Page Contains Element ${xpath_policy_settings_header}
manashsarma66f03842020-09-23 08:52:38 -0500100 Page Should Contain Element ${xpath_auto_unlock}
101 Page Should Contain Element ${xpath_manual_unlock}
102 Page Should Contain Element ${xpath_max_failed_login}
103 Page Should Contain Element ${xpath_submit_button}
104 Page Should Contain Element ${xpath_cancel_button}
105
manashsarma95777412020-09-28 09:52:41 -0500106
manashsarmada29e552020-10-04 12:34:01 -0500107Verify User Access Privilege
George Keishing4d4ef992021-01-28 09:56:53 -0600108 [Documentation] Create a new user with a privilege and verify that user is created.
manashsarmada29e552020-10-04 12:34:01 -0500109 [Tags] Verify_User_Access_Privilege
Nandish-Mattic4024a32023-03-13 01:59:40 -0500110 [Teardown] Delete Users Via Redfish @{username}
manashsarmada29e552020-10-04 12:34:01 -0500111 [Template] Create User And Verify
112
Nandish-Mattic4024a32023-03-13 01:59:40 -0500113 # username privilege_level enabled
114 ${username}[0] Administrator ${True}
115 ${username}[1] ReadOnly ${True}
116 ${username}[2] Administrator ${False}
manashsarmaedd6da02020-10-04 00:11:18 -0500117
manashsarmada29e552020-10-04 12:34:01 -0500118
rramyasr-inc4a5c342023-01-02 01:38:50 -0600119Verify Operator And No Access User Privilege
120 [Documentation] Create users with different access privilege
121 ... and verify that the user is getting created.
122 [Tags] Verify_Operator_And_No_Access_User_Privilege
123 [Template] Create User And Verify
124
125 # username privilege_level enabled
126 operator_user Operator ${True}
127 noaccess_user NoAccess ${True}
128
129
manashsarma165f5272021-08-04 07:37:01 -0500130Verify User Account And Properties Saved Through Reboots
131 [Documentation] Verify that user account and properties saved through reboots.
Nandish-Mattic4024a32023-03-13 01:59:40 -0500132 [Teardown] Delete Users Via Redfish my_admin_user
manashsarma165f5272021-08-04 07:37:01 -0500133 [Tags] Verify_User_Account_And_Properties_Saved_Through_Reboots
134
135 # Create an User account.
136 Create User And Verify my_admin_user Administrator ${True}
137
138 # Reboot BMC.
139 Redfish OBMC Reboot (off) stack_mode=normal
140
141 Click Element ${xpath_refresh_button}
142 Wait Until Page Contains my_admin_user timeout=15
143
144
Nandish-Matti6e82f982023-10-19 01:03:08 -0500145Delete User Account Via GUI
146 [Documentation] Delete user account via GUI.
147 [Tags] Delete_User_Account_Via_GUI
148
149 # Create new user account via GUI.
150 Create User And Verify ${username}[0] Administrator ${True}
151
152 # Delete the user created via GUI.
153 Delete Users Via GUI ${username}[0]
154
155
Nandish-Matti2d6c9042023-11-03 01:04:15 -0500156Verify Error While Creating Users With Same Name
157 [Documentation] Verify proper error message while creating two user accounts with same username.
158 [Tags] Verify_Error_While_Creating_Users_With_Same_Name
159 [Teardown] Delete Users Via Redfish ${username}
160
161 # Get random username and user privilege level.
162 ${username}= Generate Random String 8 [LETTERS]
163 ${privilege_level}= Evaluate random.choice(${list_user_privilege}) random
164
165 # Create new user account.
166 Create User And Verify ${username} ${privilege_level} ${True}
167
168 # Expect failure while creating second user account with same username.
169 Create User And Verify ${username} ${privilege_level} ${True} Failure
170
171
Nandish-Mattid0c0b812023-11-08 02:55:08 -0600172Test Modifying User Privilege Of Existing User Via GUI
173 [Documentation] Modify user privilege of existing user via GUI and verify the changes using Redfish.
174 [Tags] Test_Modifying_User_Privilege_Of_Existing_User_Via_GUI
175 [Teardown] Delete Users Via Redfish ${username}
176
177 # Get random username and user privilege level.
178 ${username}= Generate Random String 8 [LETTERS]
Nandish-Matti0148f202023-11-14 00:00:58 -0600179 ${privilege_level}= Evaluate random.choice(${list_user_privilege}) random
Nandish-Mattid0c0b812023-11-08 02:55:08 -0600180
181 # Create new user account.
182 Create User And Verify ${username} ${privilege_level} ${True}
183
184 # Get user privilege role details distinct from the current ones.
185 FOR ${privilege} IN @{user_privilege_list}
186 IF '${privilege}' != '${privilege_level}'
187 ${modify_privilege}= Set Variable ${privilege}
188 END
189 END
190
191 # Modify user privilege via GUI.
192 Wait Until Keyword Succeeds 30 sec 5 sec Click Element
193 ... //td[text()='${username}']/following-sibling::*/*/*[@title='Edit user']
194 Select From List by Value ${xpath_privilege_list_button} ${modify_privilege}
195
196 # Submit changes.
197 Click Element ${xpath_submit_button}
198
199 # Confirm the successful update.
200 Wait Until Element Is Visible ${xpath_success_message} timeout=30
201 Wait Until Element Is Not Visible ${xpath_success_message} timeout=30
202
203 # Verify user privilege via Redfish.
204 Redfish.Login
205 ${resp}= Redfish.Get /redfish/v1/AccountService/Accounts/${username}
206 Should Be Equal ${resp.dict["RoleId"]} ${modify_privilege}
207 Redfish.Logout
208
209
Nandish-Matti304dea22023-11-09 23:55:42 -0600210Test Modifying User Account Status Of Existing User Via GUI
211 [Documentation] Test modifying user account status of existing user via GUI and verify changes using Redfish.
212 [Tags] Test_Modifying_User_Account_Status_Of_Existing_User_Via_GUI
213 [Teardown] Delete Users Via Redfish ${username}
214
215 # Get random username, user privilege level and account status.
216 ${username}= Generate Random String 8 [LETTERS]
217 ${privilege_level}= Evaluate random.choice(${user_privilege_list}) random
218 ${initial_account_status}= Evaluate random.choice([True, False]) random
219
220 # Create new user account.
221 Create User And Verify ${username} ${privilege_level} ${initial_account_status}
222
223 # Modify user account status via GUI.
224 Wait Until Keyword Succeeds 30 sec 5 sec Click Element
225 ... //td[text()='${username}']/following-sibling::*/*/*[@title='Edit user']
226 Wait Until Element Is Visible ${xpath_submit_button} timeout=30
227
228 # Switch the user account status to its opposite state.
229 IF ${initial_account_status} == ${True}
230 Click Element At Coordinates ${xpath_account_status_disabled_button} 0 0
231 ELSE
232 Click Element At Coordinates ${xpath_account_status_enabled_button} 0 0
233 END
234
235 # Submit changes.
236 Click Element ${xpath_submit_button}
237
238 # Confirm the successful update.
239 Wait Until Element Is Visible ${xpath_success_message} timeout=30
240 Wait Until Element Is Not Visible ${xpath_success_message} timeout=60
241
242 # Verify account status via Redfish.
243 IF ${initial_account_status} == ${True}
244 ${status}= Run Keyword And Return Status Redfish.Login ${username} ${test_user_password}
245 Should Be Equal ${status} ${False}
246 ELSE
247 ${status}= Run Keyword And Return Status Redfish.Login ${username} ${test_user_password}
248 Should Be Equal ${status} ${True}
249 END
250
251
manashsarmada29e552020-10-04 12:34:01 -0500252*** Keywords ***
253
254Create User And Verify
255 [Documentation] Create a user with given user name and privilege and verify that the
256 ... user is created successfully via GUI and Redfish.
Nandish-Matti2d6c9042023-11-03 01:04:15 -0500257 [Arguments] ${user_name} ${user_privilege} ${enabled} ${expected_status}=Success
manashsarmada29e552020-10-04 12:34:01 -0500258
259 # Description of argument(s):
260 # user_name The name of the user to be created (e.g. "test", "robert", etc.).
261 # user_privilege Privilege of the user.
manashsarmaedd6da02020-10-04 00:11:18 -0500262 # enabled If the user is enabled (e.g True if enabled, False if disabled).
Nandish-Matti2d6c9042023-11-03 01:04:15 -0500263 # expected_status Expected status of user creation (e.g. Success, Failure).
manashsarma95777412020-09-28 09:52:41 -0500264
265 Click Element ${xpath_add_user}
266 Wait Until Page Contains Element ${xpath_add_user_heading}
267
manashsarmaedd6da02020-10-04 00:11:18 -0500268 # Select disabled radio button if user needs to be disabled
269 Run Keyword If ${enabled} == ${False}
manashsarmacb646cc2020-11-17 03:59:04 -0600270 ... Click Element At Coordinates ${xpath_account_status_disabled_button} 0 0
manashsarmaedd6da02020-10-04 00:11:18 -0500271
manashsarma95777412020-09-28 09:52:41 -0500272 # Input username, password and privilege.
manashsarmada29e552020-10-04 12:34:01 -0500273 Input Text ${xpath_username_input_button} ${user_name}
274 Select From List by Value ${xpath_privilege_list_button} ${user_privilege}
manashsarma95777412020-09-28 09:52:41 -0500275
manashsarmacc35bad2020-09-30 04:19:01 -0500276 Input Text ${xpath_password_input_button} ${test_user_password}
manashsarma95777412020-09-28 09:52:41 -0500277
manashsarmacc35bad2020-09-30 04:19:01 -0500278 Input Text ${xpath_password_confirm_button} ${test_user_password}
manashsarma95777412020-09-28 09:52:41 -0500279
280 # Submit.
281 Click Element ${xpath_submit_button}
282
Nandish-Matti2d6c9042023-11-03 01:04:15 -0500283 # Proceed with future steps based on the expected execution status.
284 IF '${expected_status}' == 'Success'
285 Wait Until Element Is Visible ${xpath_success_message} timeout=30
manashsarma95777412020-09-28 09:52:41 -0500286
Nandish-Matti2d6c9042023-11-03 01:04:15 -0500287 # Refresh page and check new user is available.
288 Wait Until Page Contains Element ${xpath_add_user}
289 Click Element ${xpath_refresh_button}
290 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30
291 Wait Until Page Contains ${user_name} timeout=15
Sushma M M87a5b2d2020-07-31 00:58:48 -0500292
Nandish-Matti2d6c9042023-11-03 01:04:15 -0500293 # Cross check the privilege of newly added user via Redfish.
294 Redfish.Login
295 ${user_priv_redfish}= Redfish_Utils.Get Attribute
296 ... /redfish/v1/AccountService/Accounts/${user_name} RoleId
297 Should Be Equal ${user_privilege} ${user_priv_redfish}
298 Redfish.Logout
299
300 # Check enable/disable status for user.
301 ${status}= Run Keyword And Return Status Redfish.Login ${user_name} ${test_user_password}
302 Run Keyword If ${enabled} == ${False}
303 ... Should Be Equal ${status} ${False}
304 ... ELSE Should Be Equal ${status} ${True}
305 Redfish.Logout
306
307 ELSE IF '${expected_status}' == 'Failure'
308 Wait Until Element Is Visible ${xpath_user_creation_error_message} timeout=60
George Keishingc55a8992023-11-13 12:03:43 +0530309
Nandish-Matti2d6c9042023-11-03 01:04:15 -0500310 # Close error message popup.
311 Click Element ${xpath_close_error_message}
312 Wait Until Element Is Not Visible ${xpath_user_creation_error_message} timeout=60
313 END
manashsarmaedd6da02020-10-04 00:11:18 -0500314
315
Sushma M M87a5b2d2020-07-31 00:58:48 -0500316Test Setup Execution
317 [Documentation] Do test case setup tasks.
318
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500319 # Navigate to https://xx.xx.xx.xx/#/access-control/user-management user management page.
Sushma M M87a5b2d2020-07-31 00:58:48 -0500320
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500321 Click Element ${xpath_secuity_and_accesss_menu}
322 Click Element ${xpath_user_management_sub_menu}
rramyasr-in9e2c96f2023-01-24 07:59:34 -0600323 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain user-management
324 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30
Nandish-Mattic4024a32023-03-13 01:59:40 -0500325
326
327Delete Users Via Redfish
328 [Documentation] Delete given users using Redfish.
329 [Arguments] @{user_list}
330 # Description of argument(s):
331 # user_list List of user name to be deleted.
332
333 FOR ${user} IN @{user_list}
334 Redfish.Login
335 Redfish.Delete /redfish/v1/AccountService/Accounts/${user}
336 Redfish.Logout
337 END
338
339
Nandish-Matti6e82f982023-10-19 01:03:08 -0500340Delete Users Via GUI
341 [Documentation] Delete given users via GUI.
342 [Arguments] @{user_list}
343 # Description of argument(s):
344 # user_list List of user name to be deleted.
345
346 FOR ${user} IN @{user_list}
347 Wait Until Keyword Succeeds 30 sec 5 sec Click Element
348 ... //td[text()='${user}']/following-sibling::*/*/*[@title='Delete user']
349 Wait Until Keyword Succeeds 30 sec 5 sec Click Element ${xpath_delete_button}
350 Wait Until Element Is Visible ${xpath_success_message} timeout=30
351 Wait Until Element Is Not Visible ${xpath_success_message} timeout=60
352 END
353
354
Nandish-Mattic4024a32023-03-13 01:59:40 -0500355Suite Teardown Execution
356 [Documentation] Do suite teardown tasks.
357
George Keishing7f321ac2023-10-13 19:38:44 +0530358 Run Keyword And Ignore Error Logout GUI
Nandish-Mattic4024a32023-03-13 01:59:40 -0500359 Close Browser
360 Redfish.Logout