blob: c2e52f29376b130f52b2f5933e3062052babd661 [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
11
12*** Variables ***
rramyasr-in9e2c96f2023-01-24 07:59:34 -060013
14
Rahul Maheshwari142642d2021-08-24 00:00:15 -050015${xpath_user_management_heading} //h1[text()="User management"]
Sushma M M26302992020-08-31 01:15:26 -050016${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 Maheshwari142642d2021-08-24 00:00:15 -050019${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']
manashsarmac67f2262020-09-24 08:16:08 -050029${xpath_add_user_heading} //h5[contains(text(),'Add user')]
manashsarma66f03842020-09-23 08:52:38 -050030${xpath_policy_settings_header} //*[text()="Account policy settings"]
Rahul Maheshwari142642d2021-08-24 00:00:15 -050031${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']
manashsarmacc35bad2020-09-30 04:19:01 -050034${test_user_password} TestPwd1
Nandish-Mattic4024a32023-03-13 01:59:40 -050035@{username} admin_user readonly_user disabled_user
Sushma M M87a5b2d2020-07-31 00:58:48 -050036
rramyasr-in9e2c96f2023-01-24 07:59:34 -060037
Sushma M M87a5b2d2020-07-31 00:58:48 -050038*** Test Cases ***
39
Rahul Maheshwari142642d2021-08-24 00:00:15 -050040Verify Navigation To User Management Page
41 [Documentation] Verify navigation to user management page.
42 [Tags] Verify_Navigation_To_User_Management_Page
Sushma M M26302992020-08-31 01:15:26 -050043
Rahul Maheshwari142642d2021-08-24 00:00:15 -050044 Page Should Contain Element ${xpath_user_management_heading}
Sushma M M26302992020-08-31 01:15:26 -050045
46
Rahul Maheshwari142642d2021-08-24 00:00:15 -050047Verify 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 M87a5b2d2020-07-31 00:58:48 -050050
51 Page should contain View privilege role descriptions
52
53
Rahul Maheshwari142642d2021-08-24 00:00:15 -050054Verify 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 M87a5b2d2020-07-31 00:58:48 -050057
58 Page Should Contain Checkbox ${xpath_select_user}
59
60
Rahul Maheshwari142642d2021-08-24 00:00:15 -050061Verify 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 M87a5b2d2020-07-31 00:58:48 -050064
65 Page should contain Button ${xpath_account_policy}
66 Page should contain Button ${xpath_add_user}
manashsarma90d91fa2021-04-08 07:07:16 -050067 Page Should Contain Element ${xpath_edit_user}
68 Page Should Contain Element ${xpath_delete_user}
Sushma M M87a5b2d2020-07-31 00:58:48 -050069
70
manashsarmac67f2262020-09-24 08:16:08 -050071Verify 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
manashsarma9d67d262020-10-15 11:20:48 -050074 [Teardown] Click Element ${xpath_cancel_button}
manashsarmac67f2262020-09-24 08:16:08 -050075
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
manashsarma66f03842020-09-23 08:52:38 -050087
88Verify 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
manashsarma5c4a7d12020-10-21 05:21:37 -050091 [Teardown] Click Element ${xpath_cancel_button}
manashsarma66f03842020-09-23 08:52:38 -050092
93 Click Element ${xpath_account_policy}
manashsarma5c4a7d12020-10-21 05:21:37 -050094 Wait Until Page Contains Element ${xpath_policy_settings_header}
manashsarma66f03842020-09-23 08:52:38 -050095 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
manashsarma95777412020-09-28 09:52:41 -0500101
manashsarmada29e552020-10-04 12:34:01 -0500102Verify User Access Privilege
George Keishing4d4ef992021-01-28 09:56:53 -0600103 [Documentation] Create a new user with a privilege and verify that user is created.
manashsarmada29e552020-10-04 12:34:01 -0500104 [Tags] Verify_User_Access_Privilege
Nandish-Mattic4024a32023-03-13 01:59:40 -0500105 [Teardown] Delete Users Via Redfish @{username}
manashsarmada29e552020-10-04 12:34:01 -0500106 [Template] Create User And Verify
107
Nandish-Mattic4024a32023-03-13 01:59:40 -0500108 # username privilege_level enabled
109 ${username}[0] Administrator ${True}
110 ${username}[1] ReadOnly ${True}
111 ${username}[2] Administrator ${False}
manashsarmaedd6da02020-10-04 00:11:18 -0500112
manashsarmada29e552020-10-04 12:34:01 -0500113
rramyasr-inc4a5c342023-01-02 01:38:50 -0600114Verify 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
manashsarma165f5272021-08-04 07:37:01 -0500125Verify User Account And Properties Saved Through Reboots
126 [Documentation] Verify that user account and properties saved through reboots.
Nandish-Mattic4024a32023-03-13 01:59:40 -0500127 [Teardown] Delete Users Via Redfish my_admin_user
manashsarma165f5272021-08-04 07:37:01 -0500128 [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
manashsarmada29e552020-10-04 12:34:01 -0500140*** Keywords ***
141
142Create 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.
manashsarmaedd6da02020-10-04 00:11:18 -0500145 [Arguments] ${user_name} ${user_privilege} ${enabled}
manashsarmada29e552020-10-04 12:34:01 -0500146
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.
manashsarmaedd6da02020-10-04 00:11:18 -0500150 # enabled If the user is enabled (e.g True if enabled, False if disabled).
manashsarma95777412020-09-28 09:52:41 -0500151
152 Click Element ${xpath_add_user}
153 Wait Until Page Contains Element ${xpath_add_user_heading}
154
manashsarmaedd6da02020-10-04 00:11:18 -0500155 # Select disabled radio button if user needs to be disabled
156 Run Keyword If ${enabled} == ${False}
manashsarmacb646cc2020-11-17 03:59:04 -0600157 ... Click Element At Coordinates ${xpath_account_status_disabled_button} 0 0
manashsarmaedd6da02020-10-04 00:11:18 -0500158
manashsarma95777412020-09-28 09:52:41 -0500159 # Input username, password and privilege.
manashsarmada29e552020-10-04 12:34:01 -0500160 Input Text ${xpath_username_input_button} ${user_name}
161 Select From List by Value ${xpath_privilege_list_button} ${user_privilege}
manashsarma95777412020-09-28 09:52:41 -0500162
manashsarmacc35bad2020-09-30 04:19:01 -0500163 Input Text ${xpath_password_input_button} ${test_user_password}
manashsarma95777412020-09-28 09:52:41 -0500164
manashsarmacc35bad2020-09-30 04:19:01 -0500165 Input Text ${xpath_password_confirm_button} ${test_user_password}
manashsarma95777412020-09-28 09:52:41 -0500166
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-Mattic4024a32023-03-13 01:59:40 -0500173 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30
manashsarmada29e552020-10-04 12:34:01 -0500174 Wait Until Page Contains ${user_name} timeout=15
manashsarma95777412020-09-28 09:52:41 -0500175
176 # Cross check the privilege of newly added user via Redfish.
Nandish-Mattic4024a32023-03-13 01:59:40 -0500177 Redfish.Login
manashsarma95777412020-09-28 09:52:41 -0500178 ${user_priv_redfish}= Redfish_Utils.Get Attribute
manashsarmada29e552020-10-04 12:34:01 -0500179 ... /redfish/v1/AccountService/Accounts/${user_name} RoleId
180 Should Be Equal ${user_privilege} ${user_priv_redfish}
Nandish-Mattic4024a32023-03-13 01:59:40 -0500181 Redfish.Logout
Sushma M M87a5b2d2020-07-31 00:58:48 -0500182
manashsarmaedd6da02020-10-04 00:11:18 -0500183 # Check enable/disable status for user.
manashsarmaedd6da02020-10-04 00:11:18 -0500184 ${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-Mattic4024a32023-03-13 01:59:40 -0500188 Redfish.Logout
manashsarmaedd6da02020-10-04 00:11:18 -0500189
190
Sushma M M87a5b2d2020-07-31 00:58:48 -0500191Test Setup Execution
192 [Documentation] Do test case setup tasks.
193
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500194 # Navigate to https://xx.xx.xx.xx/#/access-control/user-management user management page.
Sushma M M87a5b2d2020-07-31 00:58:48 -0500195
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500196 Click Element ${xpath_secuity_and_accesss_menu}
197 Click Element ${xpath_user_management_sub_menu}
rramyasr-in9e2c96f2023-01-24 07:59:34 -0600198 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-Mattic4024a32023-03-13 01:59:40 -0500200
201
202Delete 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
215Suite Teardown Execution
216 [Documentation] Do suite teardown tasks.
217
218 Logout GUI
219 Close Browser
220 Redfish.Logout