Sushma M M | 87a5b2d | 2020-07-31 00:58:48 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 3 | Documentation Test OpenBMC GUI "User management" sub-menu of "Security and access". |
Sushma M M | 87a5b2d | 2020-07-31 00:58:48 -0500 | [diff] [blame] | 4 | |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 5 | Resource ../../lib/gui_resource.robot |
Sushma M M | 87a5b2d | 2020-07-31 00:58:48 -0500 | [diff] [blame] | 6 | |
| 7 | Suite Setup Launch Browser And Login GUI |
Nandish-Matti | c4024a3 | 2023-03-13 01:59:40 -0500 | [diff] [blame] | 8 | Suite Teardown Suite Teardown Execution |
Sushma M M | 87a5b2d | 2020-07-31 00:58:48 -0500 | [diff] [blame] | 9 | Test Setup Test Setup Execution |
| 10 | |
| 11 | |
| 12 | *** Variables *** |
rramyasr-in | 9e2c96f | 2023-01-24 07:59:34 -0600 | [diff] [blame] | 13 | |
| 14 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 15 | ${xpath_user_management_heading} //h1[text()="User management"] |
Sushma M M | 2630299 | 2020-08-31 01:15:26 -0500 | [diff] [blame] | 16 | ${xpath_select_user} //input[contains(@class,"custom-control-input")] |
| 17 | ${xpath_account_policy} //button[contains(text(),'Account policy settings')] |
| 18 | ${xpath_add_user} //button[contains(text(),'Add user')] |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 19 | ${xpath_edit_user} //*[@data-test-id='userManagement-tableRowAction-edit-0'] |
| 20 | ${xpath_delete_user} //*[@data-test-id='userManagement-tableRowAction-delete-1'] |
| 21 | ${xpath_account_status_enabled_button} //*[@data-test-id='userManagement-radioButton-statusEnabled'] |
| 22 | ${xpath_account_status_disabled_button} //*[@data-test-id='userManagement-radioButton-statusDisabled'] |
| 23 | ${xpath_username_input_button} //*[@data-test-id='userManagement-input-username'] |
| 24 | ${xpath_privilege_list_button} //*[@data-test-id='userManagement-select-privilege'] |
| 25 | ${xpath_password_input_button} //*[@data-test-id='userManagement-input-password'] |
| 26 | ${xpath_password_confirm_button} //*[@data-test-id='userManagement-input-passwordConfirmation'] |
| 27 | ${xpath_cancel_button} //*[@data-test-id='userManagement-button-cancel'] |
| 28 | ${xpath_submit_button} //*[@data-test-id='userManagement-button-submit'] |
manashsarma | c67f226 | 2020-09-24 08:16:08 -0500 | [diff] [blame] | 29 | ${xpath_add_user_heading} //h5[contains(text(),'Add user')] |
manashsarma | 66f0384 | 2020-09-23 08:52:38 -0500 | [diff] [blame] | 30 | ${xpath_policy_settings_header} //*[text()="Account policy settings"] |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 31 | ${xpath_auto_unlock} //*[@data-test-id='userManagement-radio-automaticUnlock'] |
| 32 | ${xpath_manual_unlock} //*[@data-test-id='userManagement-radio-manualUnlock'] |
| 33 | ${xpath_max_failed_login} //*[@data-test-id='userManagement-input-lockoutThreshold'] |
manashsarma | cc35bad | 2020-09-30 04:19:01 -0500 | [diff] [blame] | 34 | ${test_user_password} TestPwd1 |
Nandish-Matti | c4024a3 | 2023-03-13 01:59:40 -0500 | [diff] [blame] | 35 | @{username} admin_user readonly_user disabled_user |
Sushma M M | 87a5b2d | 2020-07-31 00:58:48 -0500 | [diff] [blame] | 36 | |
rramyasr-in | 9e2c96f | 2023-01-24 07:59:34 -0600 | [diff] [blame] | 37 | |
Sushma M M | 87a5b2d | 2020-07-31 00:58:48 -0500 | [diff] [blame] | 38 | *** Test Cases *** |
| 39 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 40 | Verify Navigation To User Management Page |
| 41 | [Documentation] Verify navigation to user management page. |
| 42 | [Tags] Verify_Navigation_To_User_Management_Page |
Sushma M M | 2630299 | 2020-08-31 01:15:26 -0500 | [diff] [blame] | 43 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 44 | Page Should Contain Element ${xpath_user_management_heading} |
Sushma M M | 2630299 | 2020-08-31 01:15:26 -0500 | [diff] [blame] | 45 | |
| 46 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 47 | Verify Existence Of All Sections In User Management Page |
| 48 | [Documentation] Verify existence of all sections in user management page. |
| 49 | [Tags] Verify_Existence_Of_All_Sections_In_User_Management_Page |
Sushma M M | 87a5b2d | 2020-07-31 00:58:48 -0500 | [diff] [blame] | 50 | |
| 51 | Page should contain View privilege role descriptions |
| 52 | |
| 53 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 54 | Verify Existence Of All Input Boxes In User Management Page |
| 55 | [Documentation] Verify existence of all sections in user managemnet page. |
| 56 | [Tags] Verify_Existence_Of_All_Input_Boxes_In_User_Management_Page |
Sushma M M | 87a5b2d | 2020-07-31 00:58:48 -0500 | [diff] [blame] | 57 | |
| 58 | Page Should Contain Checkbox ${xpath_select_user} |
| 59 | |
| 60 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 61 | Verify Existence Of All Buttons In User Management Page |
| 62 | [Documentation] Verify existence of all buttons in user management page. |
| 63 | [Tags] Verify_Existence_Of_All_Buttons_In_User_Management_Page |
Sushma M M | 87a5b2d | 2020-07-31 00:58:48 -0500 | [diff] [blame] | 64 | |
| 65 | Page should contain Button ${xpath_account_policy} |
| 66 | Page should contain Button ${xpath_add_user} |
manashsarma | 90d91fa | 2021-04-08 07:07:16 -0500 | [diff] [blame] | 67 | Page Should Contain Element ${xpath_edit_user} |
| 68 | Page Should Contain Element ${xpath_delete_user} |
Sushma M M | 87a5b2d | 2020-07-31 00:58:48 -0500 | [diff] [blame] | 69 | |
| 70 | |
manashsarma | c67f226 | 2020-09-24 08:16:08 -0500 | [diff] [blame] | 71 | Verify Existence Of All Button And Fields In Add User |
| 72 | [Documentation] Verify existence of all buttons and fields in add user page. |
| 73 | [Tags] Verify_Existence_Of_All_Button_And_Fields_In_Add_User |
manashsarma | 9d67d26 | 2020-10-15 11:20:48 -0500 | [diff] [blame] | 74 | [Teardown] Click Element ${xpath_cancel_button} |
manashsarma | c67f226 | 2020-09-24 08:16:08 -0500 | [diff] [blame] | 75 | |
| 76 | Click Element ${xpath_add_user} |
| 77 | Wait Until Page Contains Element ${xpath_add_user_heading} |
| 78 | Page Should Contain Element ${xpath_account_status_enabled_button} |
| 79 | Page Should Contain Element ${xpath_account_status_disabled_button} |
| 80 | Page Should Contain Element ${xpath_username_input_button} |
| 81 | Page Should Contain Element ${xpath_privilege_list_button} |
| 82 | Page Should Contain Element ${xpath_password_input_button} |
| 83 | Page Should Contain Element ${xpath_password_confirm_button} |
| 84 | Page Should Contain Element ${xpath_cancel_button} |
| 85 | Page Should Contain Element ${xpath_submit_button} |
| 86 | |
manashsarma | 66f0384 | 2020-09-23 08:52:38 -0500 | [diff] [blame] | 87 | |
| 88 | Verify Existence Of All Buttons And Fields In Account Policy Settings |
| 89 | [Documentation] Verify existence of all buttons and fields in account policy settings page. |
| 90 | [Tags] Verify_Existence_Of_All_Buttons_And_Fields_In_Account_Policy_Settings |
manashsarma | 5c4a7d1 | 2020-10-21 05:21:37 -0500 | [diff] [blame] | 91 | [Teardown] Click Element ${xpath_cancel_button} |
manashsarma | 66f0384 | 2020-09-23 08:52:38 -0500 | [diff] [blame] | 92 | |
| 93 | Click Element ${xpath_account_policy} |
manashsarma | 5c4a7d1 | 2020-10-21 05:21:37 -0500 | [diff] [blame] | 94 | Wait Until Page Contains Element ${xpath_policy_settings_header} |
manashsarma | 66f0384 | 2020-09-23 08:52:38 -0500 | [diff] [blame] | 95 | Page Should Contain Element ${xpath_auto_unlock} |
| 96 | Page Should Contain Element ${xpath_manual_unlock} |
| 97 | Page Should Contain Element ${xpath_max_failed_login} |
| 98 | Page Should Contain Element ${xpath_submit_button} |
| 99 | Page Should Contain Element ${xpath_cancel_button} |
| 100 | |
manashsarma | 9577741 | 2020-09-28 09:52:41 -0500 | [diff] [blame] | 101 | |
manashsarma | da29e55 | 2020-10-04 12:34:01 -0500 | [diff] [blame] | 102 | Verify User Access Privilege |
George Keishing | 4d4ef99 | 2021-01-28 09:56:53 -0600 | [diff] [blame] | 103 | [Documentation] Create a new user with a privilege and verify that user is created. |
manashsarma | da29e55 | 2020-10-04 12:34:01 -0500 | [diff] [blame] | 104 | [Tags] Verify_User_Access_Privilege |
Nandish-Matti | c4024a3 | 2023-03-13 01:59:40 -0500 | [diff] [blame] | 105 | [Teardown] Delete Users Via Redfish @{username} |
manashsarma | da29e55 | 2020-10-04 12:34:01 -0500 | [diff] [blame] | 106 | [Template] Create User And Verify |
| 107 | |
Nandish-Matti | c4024a3 | 2023-03-13 01:59:40 -0500 | [diff] [blame] | 108 | # username privilege_level enabled |
| 109 | ${username}[0] Administrator ${True} |
| 110 | ${username}[1] ReadOnly ${True} |
| 111 | ${username}[2] Administrator ${False} |
manashsarma | edd6da0 | 2020-10-04 00:11:18 -0500 | [diff] [blame] | 112 | |
manashsarma | da29e55 | 2020-10-04 12:34:01 -0500 | [diff] [blame] | 113 | |
rramyasr-in | c4a5c34 | 2023-01-02 01:38:50 -0600 | [diff] [blame] | 114 | Verify Operator And No Access User Privilege |
| 115 | [Documentation] Create users with different access privilege |
| 116 | ... and verify that the user is getting created. |
| 117 | [Tags] Verify_Operator_And_No_Access_User_Privilege |
| 118 | [Template] Create User And Verify |
| 119 | |
| 120 | # username privilege_level enabled |
| 121 | operator_user Operator ${True} |
| 122 | noaccess_user NoAccess ${True} |
| 123 | |
| 124 | |
manashsarma | 165f527 | 2021-08-04 07:37:01 -0500 | [diff] [blame] | 125 | Verify User Account And Properties Saved Through Reboots |
| 126 | [Documentation] Verify that user account and properties saved through reboots. |
Nandish-Matti | c4024a3 | 2023-03-13 01:59:40 -0500 | [diff] [blame] | 127 | [Teardown] Delete Users Via Redfish my_admin_user |
manashsarma | 165f527 | 2021-08-04 07:37:01 -0500 | [diff] [blame] | 128 | [Tags] Verify_User_Account_And_Properties_Saved_Through_Reboots |
| 129 | |
| 130 | # Create an User account. |
| 131 | Create User And Verify my_admin_user Administrator ${True} |
| 132 | |
| 133 | # Reboot BMC. |
| 134 | Redfish OBMC Reboot (off) stack_mode=normal |
| 135 | |
| 136 | Click Element ${xpath_refresh_button} |
| 137 | Wait Until Page Contains my_admin_user timeout=15 |
| 138 | |
| 139 | |
manashsarma | da29e55 | 2020-10-04 12:34:01 -0500 | [diff] [blame] | 140 | *** Keywords *** |
| 141 | |
| 142 | Create User And Verify |
| 143 | [Documentation] Create a user with given user name and privilege and verify that the |
| 144 | ... user is created successfully via GUI and Redfish. |
manashsarma | edd6da0 | 2020-10-04 00:11:18 -0500 | [diff] [blame] | 145 | [Arguments] ${user_name} ${user_privilege} ${enabled} |
manashsarma | da29e55 | 2020-10-04 12:34:01 -0500 | [diff] [blame] | 146 | |
| 147 | # Description of argument(s): |
| 148 | # user_name The name of the user to be created (e.g. "test", "robert", etc.). |
| 149 | # user_privilege Privilege of the user. |
manashsarma | edd6da0 | 2020-10-04 00:11:18 -0500 | [diff] [blame] | 150 | # enabled If the user is enabled (e.g True if enabled, False if disabled). |
manashsarma | 9577741 | 2020-09-28 09:52:41 -0500 | [diff] [blame] | 151 | |
| 152 | Click Element ${xpath_add_user} |
| 153 | Wait Until Page Contains Element ${xpath_add_user_heading} |
| 154 | |
manashsarma | edd6da0 | 2020-10-04 00:11:18 -0500 | [diff] [blame] | 155 | # Select disabled radio button if user needs to be disabled |
| 156 | Run Keyword If ${enabled} == ${False} |
manashsarma | cb646cc | 2020-11-17 03:59:04 -0600 | [diff] [blame] | 157 | ... Click Element At Coordinates ${xpath_account_status_disabled_button} 0 0 |
manashsarma | edd6da0 | 2020-10-04 00:11:18 -0500 | [diff] [blame] | 158 | |
manashsarma | 9577741 | 2020-09-28 09:52:41 -0500 | [diff] [blame] | 159 | # Input username, password and privilege. |
manashsarma | da29e55 | 2020-10-04 12:34:01 -0500 | [diff] [blame] | 160 | Input Text ${xpath_username_input_button} ${user_name} |
| 161 | Select From List by Value ${xpath_privilege_list_button} ${user_privilege} |
manashsarma | 9577741 | 2020-09-28 09:52:41 -0500 | [diff] [blame] | 162 | |
manashsarma | cc35bad | 2020-09-30 04:19:01 -0500 | [diff] [blame] | 163 | Input Text ${xpath_password_input_button} ${test_user_password} |
manashsarma | 9577741 | 2020-09-28 09:52:41 -0500 | [diff] [blame] | 164 | |
manashsarma | cc35bad | 2020-09-30 04:19:01 -0500 | [diff] [blame] | 165 | Input Text ${xpath_password_confirm_button} ${test_user_password} |
manashsarma | 9577741 | 2020-09-28 09:52:41 -0500 | [diff] [blame] | 166 | |
| 167 | # Submit. |
| 168 | Click Element ${xpath_submit_button} |
| 169 | |
| 170 | # Refresh page and check new user is available. |
| 171 | Wait Until Page Contains Element ${xpath_add_user} |
| 172 | Click Element ${xpath_refresh_button} |
Nandish-Matti | c4024a3 | 2023-03-13 01:59:40 -0500 | [diff] [blame] | 173 | Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30 |
manashsarma | da29e55 | 2020-10-04 12:34:01 -0500 | [diff] [blame] | 174 | Wait Until Page Contains ${user_name} timeout=15 |
manashsarma | 9577741 | 2020-09-28 09:52:41 -0500 | [diff] [blame] | 175 | |
| 176 | # Cross check the privilege of newly added user via Redfish. |
Nandish-Matti | c4024a3 | 2023-03-13 01:59:40 -0500 | [diff] [blame] | 177 | Redfish.Login |
manashsarma | 9577741 | 2020-09-28 09:52:41 -0500 | [diff] [blame] | 178 | ${user_priv_redfish}= Redfish_Utils.Get Attribute |
manashsarma | da29e55 | 2020-10-04 12:34:01 -0500 | [diff] [blame] | 179 | ... /redfish/v1/AccountService/Accounts/${user_name} RoleId |
| 180 | Should Be Equal ${user_privilege} ${user_priv_redfish} |
Nandish-Matti | c4024a3 | 2023-03-13 01:59:40 -0500 | [diff] [blame] | 181 | Redfish.Logout |
Sushma M M | 87a5b2d | 2020-07-31 00:58:48 -0500 | [diff] [blame] | 182 | |
manashsarma | edd6da0 | 2020-10-04 00:11:18 -0500 | [diff] [blame] | 183 | # Check enable/disable status for user. |
manashsarma | edd6da0 | 2020-10-04 00:11:18 -0500 | [diff] [blame] | 184 | ${status}= Run Keyword And Return Status Redfish.Login ${user_name} ${test_user_password} |
| 185 | Run Keyword If ${enabled} == ${False} |
| 186 | ... Should Be Equal ${status} ${False} |
| 187 | ... ELSE Should Be Equal ${status} ${True} |
Nandish-Matti | c4024a3 | 2023-03-13 01:59:40 -0500 | [diff] [blame] | 188 | Redfish.Logout |
manashsarma | edd6da0 | 2020-10-04 00:11:18 -0500 | [diff] [blame] | 189 | |
| 190 | |
Sushma M M | 87a5b2d | 2020-07-31 00:58:48 -0500 | [diff] [blame] | 191 | Test Setup Execution |
| 192 | [Documentation] Do test case setup tasks. |
| 193 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 194 | # Navigate to https://xx.xx.xx.xx/#/access-control/user-management user management page. |
Sushma M M | 87a5b2d | 2020-07-31 00:58:48 -0500 | [diff] [blame] | 195 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 196 | Click Element ${xpath_secuity_and_accesss_menu} |
| 197 | Click Element ${xpath_user_management_sub_menu} |
rramyasr-in | 9e2c96f | 2023-01-24 07:59:34 -0600 | [diff] [blame] | 198 | Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain user-management |
| 199 | Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30 |
Nandish-Matti | c4024a3 | 2023-03-13 01:59:40 -0500 | [diff] [blame] | 200 | |
| 201 | |
| 202 | Delete Users Via Redfish |
| 203 | [Documentation] Delete given users using Redfish. |
| 204 | [Arguments] @{user_list} |
| 205 | # Description of argument(s): |
| 206 | # user_list List of user name to be deleted. |
| 207 | |
| 208 | FOR ${user} IN @{user_list} |
| 209 | Redfish.Login |
| 210 | Redfish.Delete /redfish/v1/AccountService/Accounts/${user} |
| 211 | Redfish.Logout |
| 212 | END |
| 213 | |
| 214 | |
| 215 | Suite Teardown Execution |
| 216 | [Documentation] Do suite teardown tasks. |
| 217 | |
| 218 | Logout GUI |
| 219 | Close Browser |
| 220 | Redfish.Logout |