blob: 2fcb24a0bbbfaf0acdac0ec56fcc672cc5ac1af6 [file] [log] [blame]
Sivas SRR9aadc262018-05-10 12:16:03 -05001*** Settings ***
2
3Documentation Test OpenBMC GUI "Manage user account" sub-menu of
Rahul Maheshwari39785c72019-04-02 20:03:54 -05004... "Users".
Sivas SRR9aadc262018-05-10 12:16:03 -05005
6Resource ../../lib/resource.robot
7
Sivas SRR9aadc262018-05-10 12:16:03 -05008Test Setup Test Setup Execution
Anusha Dathatric32589b2019-06-17 07:59:41 -05009Test Teardown Close Browser
Sivas SRR9aadc262018-05-10 12:16:03 -050010
Anusha Dathatri883ff7c2019-10-01 01:56:30 -050011Force Tags Manage_User
Rahul Maheshwari39785c72019-04-02 20:03:54 -050012
Sivas SRR9aadc262018-05-10 12:16:03 -050013*** Variables ***
Rahul Maheshwari39785c72019-04-02 20:03:54 -050014
15${xpath_input_username} //input[@name='UserName']
16${xpath_input_password} //input[@name='Password']
17${xpath_input_retype_password} //input[@name='VerifyPassword']
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050018${xpath_input_user_role} //select[@id='role']
19${xpath_input_enabled_checkbox} //label[@for="user-manage__enabled"]
Rahul Maheshwari39785c72019-04-02 20:03:54 -050020${xpath_input_lockout_time} //input[@id='lockoutTime']
21${xpath_input_failed_login_attempts} //input[@id='lockoutThreshold']
22${xpath_select_manage_users} //a[contains(text(), "Manage user account")]
23${xpath_select_users} //button[contains(@class, "users")]
24${xpath_save_setting_button} //button[text() ="Save settings"]
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050025${xpath_create_user_button} //button[text() ="Create user"]
Rahul Maheshwari39785c72019-04-02 20:03:54 -050026${xpath_edit_button} //button[text() ="Edit"]
27${xpath_delete_button} //button[text() ="Delete"]
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050028${label} //label[@class="control-check"]
29${xpath_edit_save_button} //*[@id="user-accounts"]/form/section/div[7]/button[2]
30&{user_password} testUser1=testUserPwd1 root=0penBmc
31&{action_msg_relation} add=User has been created successfully
32 ... modify=User has been updated successfully
33 ... add_dup=Username exists
34&{user_invalid_password} root=rootPwd1
Anusha Dathatridf365c82019-06-04 01:05:08 -050035${max_num_users} ${15}
36${xpath_table_base} //*[@id="user-accounts"]/div[4]/div[2]
37&{user_table_column_xpath_mapping} Username=/div[1]
38 ... Enabled=/div[2]
39 ... Role=/div[3]
40 ... Edit=/div[5]/button[1]
41 ... Delete=/div[5]/button[2]
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050042
Rahul Maheshwari39785c72019-04-02 20:03:54 -050043
Sivas SRR9aadc262018-05-10 12:16:03 -050044*** Test Cases ***
Sivas SRR9aadc262018-05-10 12:16:03 -050045
Rahul Maheshwari39785c72019-04-02 20:03:54 -050046Verify Existence Of All Section In User Page
Anusha Dathatric32589b2019-06-17 07:59:41 -050047 [Documentation] Verify existence of all sections in user page.
Rahul Maheshwari39785c72019-04-02 20:03:54 -050048 [Tags] Verify_Existence_Of_All_Section_In_User_Page
49
50 Page should contain User account properties
51 Page should contain User account information
52 Page should contain User account settings
Sivas SRR9aadc262018-05-10 12:16:03 -050053
54
Rahul Maheshwari39785c72019-04-02 20:03:54 -050055Verify Existence Of All Input Boxes In User Page
56 [Documentation] Verify existence of all input boxes in user page.
57 [Tags] Verify_Existence_Of_All_Input_Boxes_In_User_Page
Sivas SRR9aadc262018-05-10 12:16:03 -050058
Rahul Maheshwari39785c72019-04-02 20:03:54 -050059 # Input boxes under user account settings
60 Page Should Contain Element ${xpath_input_username}
61 Page Should Contain Element ${xpath_input_password}
62 Page Should Contain Element ${xpath_input_retype_password}
63 Page Should Contain Element ${xpath_input_user_role}
64 Page Should Contain Element ${xpath_input_enabled_checkbox}
65
66 # Input boxes under user account properties
67 Page Should Contain Element ${xpath_input_lockout_time}
68 Page Should Contain Element ${xpath_input_failed_login_attempts}
Sivas SRR9aadc262018-05-10 12:16:03 -050069
70
Rahul Maheshwari39785c72019-04-02 20:03:54 -050071Verify Existence Of All Button In User Page
George Keishing1add5532019-05-31 06:56:06 -050072 [Documentation] Verify existence of all button in user page.
Rahul Maheshwari39785c72019-04-02 20:03:54 -050073 [Tags] Verify_Existence_Of_All_Button_In_User_Page
Sivas SRR9aadc262018-05-10 12:16:03 -050074
Rahul Maheshwari39785c72019-04-02 20:03:54 -050075 # Buttons under user account properties
76 Page Should Contain Element ${xpath_save_setting_button}
77
78 # Buttons under user account settings
79 Page Should Contain Element ${xpath_create_user_button}
80
81 # Buttons under user account properties
82 Page Should Contain Element ${xpath_edit_button}
83 Page Should Contain Element ${xpath_delete_button}
84
Anusha Dathatric32589b2019-06-17 07:59:41 -050085
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050086Verify Error When Duplicate User Is Created
87 [Documentation] Verify error when duplicate user is created.
88 [Tags] Verify_Error_When_Duplicate_User_Is_Created
Anusha Dathatric32589b2019-06-17 07:59:41 -050089 [Setup] Run Keywords Test Setup Execution AND Delete Given Users
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050090
91 Add Or Modify User root &{user_password}[root] action=add_dup
92
Anusha Dathatric32589b2019-06-17 07:59:41 -050093
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050094Delete User And Verify
95 [Documentation] Delete user and verify.
96 [Tags] Delete_User_And_Verify
Anusha Dathatric32589b2019-06-17 07:59:41 -050097 [Setup] Run Keywords Test Setup Execution AND Delete Given Users
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050098
99 Add Or Modify User testUser1 &{user_password}[testUser1]
100 Delete Given Users delete_user=testUser1
101 Page Should Not Contain testUser1
102
Anusha Dathatric32589b2019-06-17 07:59:41 -0500103
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500104Verify Invalid Password Error
105 [Documentation] Verify the error message when user logs in with invalid password.
106 [Tags] Verify_Invalid_Password_Error
Anusha Dathatric32589b2019-06-17 07:59:41 -0500107 [Setup] Run Keywords Test Setup Execution AND Delete Given Users
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500108
109 LogOut OpenBMC GUI
110 Login And Verify Message root &{user_invalid_password}[root] Invalid username or password
Sivas SRR9aadc262018-05-10 12:16:03 -0500111
Anusha Dathatric32589b2019-06-17 07:59:41 -0500112
Anusha Dathatridf365c82019-06-04 01:05:08 -0500113Edit And Verify User Property
114 [Documentation] Edit and verify the user property.
115 [Tags] Edit_And_Verify_User_Property
116 [Setup] Run Keywords Test Setup Execution AND Delete Given Users
117
118 Add Or Modify User testUser1 &{user_password}[testUser1] User
119 Reload Page
120 Edit User Role testUser1 &{user_password}[testUser1] Callback
121 ${user_role}= Get User Property Value testUser1 Role
122 Should Be Equal ${user_role} Callback
123
Anusha Dathatric32589b2019-06-17 07:59:41 -0500124
Anusha Dathatribe5e27c2019-06-11 08:30:33 -0500125Create And Verify User Without Enabling
126 [Documentation] Verify login failure while logging into GUI with disabled user.
127 [Tags] Create_And_Verify_User_Without_Enabling
128 [Setup] Run Keywords Test Setup Execution AND Delete Given Users
129
130 Add Or Modify User testUser1 &{user_password}[testUser1] role=User enabled=False
131 LogOut OpenBMC GUI
132 Login And Verify Message testUser1 &{user_password}[testUser1] Invalid username or password
133
134
Sivas SRR9aadc262018-05-10 12:16:03 -0500135*** Keywords ***
136
137Test Setup Execution
Anusha Dathatric32589b2019-06-17 07:59:41 -0500138 [Documentation] Do test case setup tasks.
Sivas SRR9aadc262018-05-10 12:16:03 -0500139
Anusha Dathatric32589b2019-06-17 07:59:41 -0500140 Launch Browser And Login OpenBMC GUI
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500141 Click Button ${xpath_select_users}
142 Sleep 2s
Rahul Maheshwari39785c72019-04-02 20:03:54 -0500143 Wait Until Page Contains Element ${xpath_select_manage_users}
Sivas SRR9aadc262018-05-10 12:16:03 -0500144 Click Element ${xpath_select_manage_users}
Rahul Maheshwari39785c72019-04-02 20:03:54 -0500145 Wait Until Page Contains User account information
Sivas SRR9aadc262018-05-10 12:16:03 -0500146
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500147Add Or Modify User
Anusha Dathatridf365c82019-06-04 01:05:08 -0500148 [Documentation] Create or edit user.
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500149 [Arguments] ${username} ${password} ${role}=Administrator ${enabled}=${True}
150 ... ${action}=add
Anusha Dathatridf365c82019-06-04 01:05:08 -0500151
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500152 # Description of argument(s):
153 # username Name of the user to be created.
154 # role Role of the new user.
155 # enabled If True, User is enabled (Default), False, User is disabled.
156 # action add - Creates a new user.
157 # modify - Edits an existing user.
158 # add_dup - Tries to add a duplicate user and verifies the error message.
159
160 Run Keyword If '${action}' == 'add' or '${action}' == 'add_dup'
161 ... Input Text ${xpath_input_username} ${username}
162 Input Password ${xpath_input_password} ${password}
163 Input Password ${xpath_input_retype_password} ${password}
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500164 Select From List By Value ${xpath_input_user_role} ${role}
165 Run Keyword If '${enabled}' == 'True' Click Element ${xpath_input_enabled_checkbox}
166 Run Keyword If '${action}' == 'modify'
167 ... Click Button ${xpath_edit_save_button}
168 ... ELSE Click Button ${xpath_create_user_button}
169 Capture Page Screenshot
170 Page Should Contain &{action_msg_relation}[${action}]
171
172Delete Given Users
Anusha Dathatridf365c82019-06-04 01:05:08 -0500173 [Documentation] Delete given users.
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500174 [Arguments] ${delete_user}=nonRoot
Anusha Dathatridf365c82019-06-04 01:05:08 -0500175
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500176 # Description of argument(s):
177 # delete_user values - nonRoot/username
178 # If nonRoot - Deletes all non-root users,
179 # username - Deletes the given user.
180
181 Wait Until Page Contains root
182 Run Keyword If '${delete_user}' != 'nonRoot' Page Should Contain ${delete_user}
183 # Row id that gets deleted in every iteration.
184 ${deleting_row_id}= Set Variable 1
Anusha Dathatridf365c82019-06-04 01:05:08 -0500185 :FOR ${row} IN RANGE 1 ${max_num_users+1}
186 \ ${xpath_user}= Get Xpath For User Table Attribute Username ${row}
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500187 \ ${status}= Run Keyword And Return Status Page Should Contain Element ${xpath_user}
188 \ Exit For Loop If '${status}' == 'False'
189 \ ${user}= Get Text ${xpath_user}
Anusha Dathatridf365c82019-06-04 01:05:08 -0500190 \ ${deleting_row_id} Set Variable If '${user}' == 'root' or '${deleting_row_id}' == '2'
191 \ ... 2 1
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500192 \ Continue For Loop If '${user}' == 'root'
193 \ ${xpath_delete_user} Run Keyword If '${user}' == '${delete_user}' or '${delete_user}' == 'nonRoot'
Anusha Dathatridf365c82019-06-04 01:05:08 -0500194 \ ... Get Xpath For User Table Attribute Delete ${deleting_row_id}
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500195 \ Run Keyword If '${user}' == '${delete_user}' or '${delete_user}' == 'nonRoot'
196 \ ... Run Keywords Click Button ${xpath_delete_user}
197 \ ... AND Page Should Contain User has been deleted successfully
198 \ ... AND Reload Page
199 \ ... AND Exit For Loop If '${user}' == '${delete_user}'
200
Anusha Dathatridf365c82019-06-04 01:05:08 -0500201Get User Property Value
202 [Documentation] Return property value for the given user.
203 [Arguments] ${username} ${property}=Role
204
205 # Description of argument(s):
206 # username BMC Username.
207 # property User property (e.g. "Role" or "Enabled").
208
209 # Maximum user limit is 15. Hence iterating only 15 times.
210 :FOR ${row_num} IN RANGE 1 ${max_num_users+1}
211 \ ${xpath_user}= Get Xpath For User Table Attribute Username ${row_num}
212 \ Page Should Contain Element ${xpath_user}
213 \ ${xpath_property}= Get Xpath For User Table Attribute ${property} ${row_num}
214 \ ${user}= Get Text ${xpath_user}
215 \ Run Keyword And Return If '${user}' == '${username}' Get Text ${xpath_property}
216
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500217Login And Verify Message
Anusha Dathatric32589b2019-06-17 07:59:41 -0500218 [Documentation] Verifies the error message displayed on screen while logging in.
219 [Arguments] ${username} ${password} ${msg}
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500220
Anusha Dathatric32589b2019-06-17 07:59:41 -0500221 # Description of argument(s):
222 # username BMC Username.
223 # password BMC Password.
224 # msg Message which is expected to be found on login page after login attempt.
Anusha Dathatridf365c82019-06-04 01:05:08 -0500225
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500226 Input Text ${xpath_textbox_username} ${username}
227 Input Password ${xpath_textbox_password} ${password}
228 Click Element ${xpath_button_login}
229 Page Should Contain ${msg}
Anusha Dathatridf365c82019-06-04 01:05:08 -0500230
231Edit User Role
232 [Documentation] Change the role of user to the given value.
233 [Arguments] ${username} ${password} ${user_role}
234
235 # Description of argument(s):
236 # username BMC Username.
237 # password BMC Password.
Anusha Dathatric32589b2019-06-17 07:59:41 -0500238 # user_role The user role to be assigned ("Administrator", "User", "Operator", "Callback").
Anusha Dathatridf365c82019-06-04 01:05:08 -0500239
240 # Maximum user limit is 15. Hence iterating only 15 times.
241 :FOR ${row_num} IN RANGE 1 ${max_num_users+1}
242 \ ${xpath_user}= Get Xpath For User Table Attribute Username ${row_num}
243 \ Page Should Contain Element ${xpath_user}
244 \ ${xpath_edit_user}= Get Xpath For User Table Attribute Edit ${row_num}
245 \ ${user}= Get Text ${xpath_user}
246 \ Run Keyword If '${user}' == '${username}' Run Keywords Click Element ${xpath_edit_user}
247 \ ... AND Add Or Modify user ${username} ${password} ${user_role} action=modify
248 \ ... AND Exit For Loop
249
250Get Xpath For User Table Attribute
251 [Documentation] Get xpath for given user table attribute.
252 [Arguments] ${attribute} ${row_num}
253
254 # Description of argument(s):
255 # attribute User table attribute ("Username", "Enabled", "Role", "Edit", "Delete").
256 # row_num Row number.
257
258 [Return] ${xpath_table_base}/div[${row_num}]&{user_table_column_xpath_mapping}[${attribute}]