blob: a6c6163f695995effed3161d2df841a34cfcad01 [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']
manashsarmac67f2262020-09-24 08:16:08 -050030${xpath_add_user_heading} //h5[contains(text(),'Add user')]
manashsarma66f03842020-09-23 08:52:38 -050031${xpath_policy_settings_header} //*[text()="Account policy settings"]
Rahul Maheshwari142642d2021-08-24 00:00:15 -050032${xpath_auto_unlock} //*[@data-test-id='userManagement-radio-automaticUnlock']
33${xpath_manual_unlock} //*[@data-test-id='userManagement-radio-manualUnlock']
34${xpath_max_failed_login} //*[@data-test-id='userManagement-input-lockoutThreshold']
manashsarmacc35bad2020-09-30 04:19:01 -050035${test_user_password} TestPwd1
Nandish-Mattic4024a32023-03-13 01:59:40 -050036@{username} admin_user readonly_user disabled_user
Sushma M M87a5b2d2020-07-31 00:58:48 -050037
rramyasr-in9e2c96f2023-01-24 07:59:34 -060038
Sushma M M87a5b2d2020-07-31 00:58:48 -050039*** Test Cases ***
40
Rahul Maheshwari142642d2021-08-24 00:00:15 -050041Verify Navigation To User Management Page
42 [Documentation] Verify navigation to user management page.
43 [Tags] Verify_Navigation_To_User_Management_Page
Sushma M M26302992020-08-31 01:15:26 -050044
Rahul Maheshwari142642d2021-08-24 00:00:15 -050045 Page Should Contain Element ${xpath_user_management_heading}
Sushma M M26302992020-08-31 01:15:26 -050046
47
Rahul Maheshwari142642d2021-08-24 00:00:15 -050048Verify Existence Of All Sections In User Management Page
49 [Documentation] Verify existence of all sections in user management page.
50 [Tags] Verify_Existence_Of_All_Sections_In_User_Management_Page
Sushma M M87a5b2d2020-07-31 00:58:48 -050051
52 Page should contain View privilege role descriptions
53
54
Rahul Maheshwari142642d2021-08-24 00:00:15 -050055Verify Existence Of All Input Boxes In User Management Page
56 [Documentation] Verify existence of all sections in user managemnet page.
57 [Tags] Verify_Existence_Of_All_Input_Boxes_In_User_Management_Page
Sushma M M87a5b2d2020-07-31 00:58:48 -050058
59 Page Should Contain Checkbox ${xpath_select_user}
60
61
Rahul Maheshwari142642d2021-08-24 00:00:15 -050062Verify Existence Of All Buttons In User Management Page
63 [Documentation] Verify existence of all buttons in user management page.
64 [Tags] Verify_Existence_Of_All_Buttons_In_User_Management_Page
Sushma M M87a5b2d2020-07-31 00:58:48 -050065
66 Page should contain Button ${xpath_account_policy}
67 Page should contain Button ${xpath_add_user}
manashsarma90d91fa2021-04-08 07:07:16 -050068 Page Should Contain Element ${xpath_edit_user}
69 Page Should Contain Element ${xpath_delete_user}
Sushma M M87a5b2d2020-07-31 00:58:48 -050070
71
manashsarmac67f2262020-09-24 08:16:08 -050072Verify Existence Of All Button And Fields In Add User
73 [Documentation] Verify existence of all buttons and fields in add user page.
74 [Tags] Verify_Existence_Of_All_Button_And_Fields_In_Add_User
manashsarma9d67d262020-10-15 11:20:48 -050075 [Teardown] Click Element ${xpath_cancel_button}
manashsarmac67f2262020-09-24 08:16:08 -050076
77 Click Element ${xpath_add_user}
78 Wait Until Page Contains Element ${xpath_add_user_heading}
79 Page Should Contain Element ${xpath_account_status_enabled_button}
80 Page Should Contain Element ${xpath_account_status_disabled_button}
81 Page Should Contain Element ${xpath_username_input_button}
82 Page Should Contain Element ${xpath_privilege_list_button}
83 Page Should Contain Element ${xpath_password_input_button}
84 Page Should Contain Element ${xpath_password_confirm_button}
85 Page Should Contain Element ${xpath_cancel_button}
86 Page Should Contain Element ${xpath_submit_button}
87
manashsarma66f03842020-09-23 08:52:38 -050088
89Verify Existence Of All Buttons And Fields In Account Policy Settings
90 [Documentation] Verify existence of all buttons and fields in account policy settings page.
91 [Tags] Verify_Existence_Of_All_Buttons_And_Fields_In_Account_Policy_Settings
manashsarma5c4a7d12020-10-21 05:21:37 -050092 [Teardown] Click Element ${xpath_cancel_button}
manashsarma66f03842020-09-23 08:52:38 -050093
94 Click Element ${xpath_account_policy}
manashsarma5c4a7d12020-10-21 05:21:37 -050095 Wait Until Page Contains Element ${xpath_policy_settings_header}
manashsarma66f03842020-09-23 08:52:38 -050096 Page Should Contain Element ${xpath_auto_unlock}
97 Page Should Contain Element ${xpath_manual_unlock}
98 Page Should Contain Element ${xpath_max_failed_login}
99 Page Should Contain Element ${xpath_submit_button}
100 Page Should Contain Element ${xpath_cancel_button}
101
manashsarma95777412020-09-28 09:52:41 -0500102
manashsarmada29e552020-10-04 12:34:01 -0500103Verify User Access Privilege
George Keishing4d4ef992021-01-28 09:56:53 -0600104 [Documentation] Create a new user with a privilege and verify that user is created.
manashsarmada29e552020-10-04 12:34:01 -0500105 [Tags] Verify_User_Access_Privilege
Nandish-Mattic4024a32023-03-13 01:59:40 -0500106 [Teardown] Delete Users Via Redfish @{username}
manashsarmada29e552020-10-04 12:34:01 -0500107 [Template] Create User And Verify
108
Nandish-Mattic4024a32023-03-13 01:59:40 -0500109 # username privilege_level enabled
110 ${username}[0] Administrator ${True}
111 ${username}[1] ReadOnly ${True}
112 ${username}[2] Administrator ${False}
manashsarmaedd6da02020-10-04 00:11:18 -0500113
manashsarmada29e552020-10-04 12:34:01 -0500114
rramyasr-inc4a5c342023-01-02 01:38:50 -0600115Verify Operator And No Access User Privilege
116 [Documentation] Create users with different access privilege
117 ... and verify that the user is getting created.
118 [Tags] Verify_Operator_And_No_Access_User_Privilege
119 [Template] Create User And Verify
120
121 # username privilege_level enabled
122 operator_user Operator ${True}
123 noaccess_user NoAccess ${True}
124
125
manashsarma165f5272021-08-04 07:37:01 -0500126Verify User Account And Properties Saved Through Reboots
127 [Documentation] Verify that user account and properties saved through reboots.
Nandish-Mattic4024a32023-03-13 01:59:40 -0500128 [Teardown] Delete Users Via Redfish my_admin_user
manashsarma165f5272021-08-04 07:37:01 -0500129 [Tags] Verify_User_Account_And_Properties_Saved_Through_Reboots
130
131 # Create an User account.
132 Create User And Verify my_admin_user Administrator ${True}
133
134 # Reboot BMC.
135 Redfish OBMC Reboot (off) stack_mode=normal
136
137 Click Element ${xpath_refresh_button}
138 Wait Until Page Contains my_admin_user timeout=15
139
140
manashsarmada29e552020-10-04 12:34:01 -0500141*** Keywords ***
142
143Create User And Verify
144 [Documentation] Create a user with given user name and privilege and verify that the
145 ... user is created successfully via GUI and Redfish.
manashsarmaedd6da02020-10-04 00:11:18 -0500146 [Arguments] ${user_name} ${user_privilege} ${enabled}
manashsarmada29e552020-10-04 12:34:01 -0500147
148 # Description of argument(s):
149 # user_name The name of the user to be created (e.g. "test", "robert", etc.).
150 # user_privilege Privilege of the user.
manashsarmaedd6da02020-10-04 00:11:18 -0500151 # enabled If the user is enabled (e.g True if enabled, False if disabled).
manashsarma95777412020-09-28 09:52:41 -0500152
153 Click Element ${xpath_add_user}
154 Wait Until Page Contains Element ${xpath_add_user_heading}
155
manashsarmaedd6da02020-10-04 00:11:18 -0500156 # Select disabled radio button if user needs to be disabled
157 Run Keyword If ${enabled} == ${False}
manashsarmacb646cc2020-11-17 03:59:04 -0600158 ... Click Element At Coordinates ${xpath_account_status_disabled_button} 0 0
manashsarmaedd6da02020-10-04 00:11:18 -0500159
manashsarma95777412020-09-28 09:52:41 -0500160 # Input username, password and privilege.
manashsarmada29e552020-10-04 12:34:01 -0500161 Input Text ${xpath_username_input_button} ${user_name}
162 Select From List by Value ${xpath_privilege_list_button} ${user_privilege}
manashsarma95777412020-09-28 09:52:41 -0500163
manashsarmacc35bad2020-09-30 04:19:01 -0500164 Input Text ${xpath_password_input_button} ${test_user_password}
manashsarma95777412020-09-28 09:52:41 -0500165
manashsarmacc35bad2020-09-30 04:19:01 -0500166 Input Text ${xpath_password_confirm_button} ${test_user_password}
manashsarma95777412020-09-28 09:52:41 -0500167
168 # Submit.
169 Click Element ${xpath_submit_button}
170
171 # Refresh page and check new user is available.
172 Wait Until Page Contains Element ${xpath_add_user}
173 Click Element ${xpath_refresh_button}
Nandish-Mattic4024a32023-03-13 01:59:40 -0500174 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30
manashsarmada29e552020-10-04 12:34:01 -0500175 Wait Until Page Contains ${user_name} timeout=15
manashsarma95777412020-09-28 09:52:41 -0500176
177 # Cross check the privilege of newly added user via Redfish.
Nandish-Mattic4024a32023-03-13 01:59:40 -0500178 Redfish.Login
manashsarma95777412020-09-28 09:52:41 -0500179 ${user_priv_redfish}= Redfish_Utils.Get Attribute
manashsarmada29e552020-10-04 12:34:01 -0500180 ... /redfish/v1/AccountService/Accounts/${user_name} RoleId
181 Should Be Equal ${user_privilege} ${user_priv_redfish}
Nandish-Mattic4024a32023-03-13 01:59:40 -0500182 Redfish.Logout
Sushma M M87a5b2d2020-07-31 00:58:48 -0500183
manashsarmaedd6da02020-10-04 00:11:18 -0500184 # Check enable/disable status for user.
manashsarmaedd6da02020-10-04 00:11:18 -0500185 ${status}= Run Keyword And Return Status Redfish.Login ${user_name} ${test_user_password}
186 Run Keyword If ${enabled} == ${False}
187 ... Should Be Equal ${status} ${False}
188 ... ELSE Should Be Equal ${status} ${True}
Nandish-Mattic4024a32023-03-13 01:59:40 -0500189 Redfish.Logout
manashsarmaedd6da02020-10-04 00:11:18 -0500190
191
Sushma M M87a5b2d2020-07-31 00:58:48 -0500192Test Setup Execution
193 [Documentation] Do test case setup tasks.
194
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500195 # Navigate to https://xx.xx.xx.xx/#/access-control/user-management user management page.
Sushma M M87a5b2d2020-07-31 00:58:48 -0500196
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500197 Click Element ${xpath_secuity_and_accesss_menu}
198 Click Element ${xpath_user_management_sub_menu}
rramyasr-in9e2c96f2023-01-24 07:59:34 -0600199 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain user-management
200 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30
Nandish-Mattic4024a32023-03-13 01:59:40 -0500201
202
203Delete Users Via Redfish
204 [Documentation] Delete given users using Redfish.
205 [Arguments] @{user_list}
206 # Description of argument(s):
207 # user_list List of user name to be deleted.
208
209 FOR ${user} IN @{user_list}
210 Redfish.Login
211 Redfish.Delete /redfish/v1/AccountService/Accounts/${user}
212 Redfish.Logout
213 END
214
215
216Suite Teardown Execution
217 [Documentation] Do suite teardown tasks.
218
George Keishing7f321ac2023-10-13 19:38:44 +0530219 Run Keyword And Ignore Error Logout GUI
Nandish-Mattic4024a32023-03-13 01:59:40 -0500220 Close Browser
221 Redfish.Logout