blob: 63d024028233f1bbe1f4895a361b8d6fe7044be1 [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
Rahul Maheshwari39785c72019-04-02 20:03:54 -050011
Sivas SRR9aadc262018-05-10 12:16:03 -050012*** Variables ***
Rahul Maheshwari39785c72019-04-02 20:03:54 -050013
14${xpath_input_username} //input[@name='UserName']
15${xpath_input_password} //input[@name='Password']
16${xpath_input_retype_password} //input[@name='VerifyPassword']
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050017${xpath_input_user_role} //select[@id='role']
18${xpath_input_enabled_checkbox} //label[@for="user-manage__enabled"]
Rahul Maheshwari39785c72019-04-02 20:03:54 -050019${xpath_input_lockout_time} //input[@id='lockoutTime']
20${xpath_input_failed_login_attempts} //input[@id='lockoutThreshold']
21${xpath_select_manage_users} //a[contains(text(), "Manage user account")]
22${xpath_select_users} //button[contains(@class, "users")]
23${xpath_save_setting_button} //button[text() ="Save settings"]
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050024${xpath_create_user_button} //button[text() ="Create user"]
Rahul Maheshwari39785c72019-04-02 20:03:54 -050025${xpath_edit_button} //button[text() ="Edit"]
26${xpath_delete_button} //button[text() ="Delete"]
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050027${label} //label[@class="control-check"]
28${xpath_edit_save_button} //*[@id="user-accounts"]/form/section/div[7]/button[2]
29&{user_password} testUser1=testUserPwd1 root=0penBmc
30&{action_msg_relation} add=User has been created successfully
31 ... modify=User has been updated successfully
32 ... add_dup=Username exists
33&{user_invalid_password} root=rootPwd1
Anusha Dathatridf365c82019-06-04 01:05:08 -050034${max_num_users} ${15}
35${xpath_table_base} //*[@id="user-accounts"]/div[4]/div[2]
36&{user_table_column_xpath_mapping} Username=/div[1]
37 ... Enabled=/div[2]
38 ... Role=/div[3]
39 ... Edit=/div[5]/button[1]
40 ... Delete=/div[5]/button[2]
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050041
Rahul Maheshwari39785c72019-04-02 20:03:54 -050042
Sivas SRR9aadc262018-05-10 12:16:03 -050043*** Test Cases ***
Sivas SRR9aadc262018-05-10 12:16:03 -050044
Rahul Maheshwari39785c72019-04-02 20:03:54 -050045Verify Existence Of All Section In User Page
Anusha Dathatric32589b2019-06-17 07:59:41 -050046 [Documentation] Verify existence of all sections in user page.
Rahul Maheshwari39785c72019-04-02 20:03:54 -050047 [Tags] Verify_Existence_Of_All_Section_In_User_Page
48
49 Page should contain User account properties
50 Page should contain User account information
51 Page should contain User account settings
Sivas SRR9aadc262018-05-10 12:16:03 -050052
53
Rahul Maheshwari39785c72019-04-02 20:03:54 -050054Verify Existence Of All Input Boxes In User Page
55 [Documentation] Verify existence of all input boxes in user page.
56 [Tags] Verify_Existence_Of_All_Input_Boxes_In_User_Page
Sivas SRR9aadc262018-05-10 12:16:03 -050057
Rahul Maheshwari39785c72019-04-02 20:03:54 -050058 # Input boxes under user account settings
59 Page Should Contain Element ${xpath_input_username}
60 Page Should Contain Element ${xpath_input_password}
61 Page Should Contain Element ${xpath_input_retype_password}
62 Page Should Contain Element ${xpath_input_user_role}
63 Page Should Contain Element ${xpath_input_enabled_checkbox}
64
65 # Input boxes under user account properties
66 Page Should Contain Element ${xpath_input_lockout_time}
67 Page Should Contain Element ${xpath_input_failed_login_attempts}
Sivas SRR9aadc262018-05-10 12:16:03 -050068
69
Rahul Maheshwari39785c72019-04-02 20:03:54 -050070Verify Existence Of All Button In User Page
George Keishing1add5532019-05-31 06:56:06 -050071 [Documentation] Verify existence of all button in user page.
Rahul Maheshwari39785c72019-04-02 20:03:54 -050072 [Tags] Verify_Existence_Of_All_Button_In_User_Page
Sivas SRR9aadc262018-05-10 12:16:03 -050073
Rahul Maheshwari39785c72019-04-02 20:03:54 -050074 # Buttons under user account properties
75 Page Should Contain Element ${xpath_save_setting_button}
76
77 # Buttons under user account settings
78 Page Should Contain Element ${xpath_create_user_button}
79
80 # Buttons under user account properties
81 Page Should Contain Element ${xpath_edit_button}
82 Page Should Contain Element ${xpath_delete_button}
83
Anusha Dathatric32589b2019-06-17 07:59:41 -050084
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050085Verify Error When Duplicate User Is Created
86 [Documentation] Verify error when duplicate user is created.
87 [Tags] Verify_Error_When_Duplicate_User_Is_Created
Anusha Dathatric32589b2019-06-17 07:59:41 -050088 [Setup] Run Keywords Test Setup Execution AND Delete Given Users
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050089
90 Add Or Modify User root &{user_password}[root] action=add_dup
91
Anusha Dathatric32589b2019-06-17 07:59:41 -050092
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050093Delete User And Verify
94 [Documentation] Delete user and verify.
95 [Tags] Delete_User_And_Verify
Anusha Dathatric32589b2019-06-17 07:59:41 -050096 [Setup] Run Keywords Test Setup Execution AND Delete Given Users
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050097
98 Add Or Modify User testUser1 &{user_password}[testUser1]
99 Delete Given Users delete_user=testUser1
100 Page Should Not Contain testUser1
101
Anusha Dathatric32589b2019-06-17 07:59:41 -0500102
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500103Verify Invalid Password Error
104 [Documentation] Verify the error message when user logs in with invalid password.
105 [Tags] Verify_Invalid_Password_Error
Anusha Dathatric32589b2019-06-17 07:59:41 -0500106 [Setup] Run Keywords Test Setup Execution AND Delete Given Users
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500107
108 LogOut OpenBMC GUI
109 Login And Verify Message root &{user_invalid_password}[root] Invalid username or password
Sivas SRR9aadc262018-05-10 12:16:03 -0500110
Anusha Dathatric32589b2019-06-17 07:59:41 -0500111
Anusha Dathatridf365c82019-06-04 01:05:08 -0500112Edit And Verify User Property
113 [Documentation] Edit and verify the user property.
114 [Tags] Edit_And_Verify_User_Property
115 [Setup] Run Keywords Test Setup Execution AND Delete Given Users
116
117 Add Or Modify User testUser1 &{user_password}[testUser1] User
118 Reload Page
119 Edit User Role testUser1 &{user_password}[testUser1] Callback
120 ${user_role}= Get User Property Value testUser1 Role
121 Should Be Equal ${user_role} Callback
122
Anusha Dathatric32589b2019-06-17 07:59:41 -0500123
Sivas SRR9aadc262018-05-10 12:16:03 -0500124*** Keywords ***
125
126Test Setup Execution
Anusha Dathatric32589b2019-06-17 07:59:41 -0500127 [Documentation] Do test case setup tasks.
Sivas SRR9aadc262018-05-10 12:16:03 -0500128
Anusha Dathatric32589b2019-06-17 07:59:41 -0500129 Launch Browser And Login OpenBMC GUI
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500130 Click Button ${xpath_select_users}
131 Sleep 2s
Rahul Maheshwari39785c72019-04-02 20:03:54 -0500132 Wait Until Page Contains Element ${xpath_select_manage_users}
Sivas SRR9aadc262018-05-10 12:16:03 -0500133 Click Element ${xpath_select_manage_users}
Rahul Maheshwari39785c72019-04-02 20:03:54 -0500134 Wait Until Page Contains User account information
Sivas SRR9aadc262018-05-10 12:16:03 -0500135
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500136Add Or Modify User
Anusha Dathatridf365c82019-06-04 01:05:08 -0500137 [Documentation] Create or edit user.
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500138 [Arguments] ${username} ${password} ${role}=Administrator ${enabled}=${True}
139 ... ${action}=add
Anusha Dathatridf365c82019-06-04 01:05:08 -0500140
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500141 # Description of argument(s):
142 # username Name of the user to be created.
143 # role Role of the new user.
144 # enabled If True, User is enabled (Default), False, User is disabled.
145 # action add - Creates a new user.
146 # modify - Edits an existing user.
147 # add_dup - Tries to add a duplicate user and verifies the error message.
148
149 Run Keyword If '${action}' == 'add' or '${action}' == 'add_dup'
150 ... Input Text ${xpath_input_username} ${username}
151 Input Password ${xpath_input_password} ${password}
152 Input Password ${xpath_input_retype_password} ${password}
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500153 Select From List By Value ${xpath_input_user_role} ${role}
154 Run Keyword If '${enabled}' == 'True' Click Element ${xpath_input_enabled_checkbox}
155 Run Keyword If '${action}' == 'modify'
156 ... Click Button ${xpath_edit_save_button}
157 ... ELSE Click Button ${xpath_create_user_button}
158 Capture Page Screenshot
159 Page Should Contain &{action_msg_relation}[${action}]
160
161Delete Given Users
Anusha Dathatridf365c82019-06-04 01:05:08 -0500162 [Documentation] Delete given users.
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500163 [Arguments] ${delete_user}=nonRoot
Anusha Dathatridf365c82019-06-04 01:05:08 -0500164
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500165 # Description of argument(s):
166 # delete_user values - nonRoot/username
167 # If nonRoot - Deletes all non-root users,
168 # username - Deletes the given user.
169
170 Wait Until Page Contains root
171 Run Keyword If '${delete_user}' != 'nonRoot' Page Should Contain ${delete_user}
172 # Row id that gets deleted in every iteration.
173 ${deleting_row_id}= Set Variable 1
Anusha Dathatridf365c82019-06-04 01:05:08 -0500174 :FOR ${row} IN RANGE 1 ${max_num_users+1}
175 \ ${xpath_user}= Get Xpath For User Table Attribute Username ${row}
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500176 \ ${status}= Run Keyword And Return Status Page Should Contain Element ${xpath_user}
177 \ Exit For Loop If '${status}' == 'False'
178 \ ${user}= Get Text ${xpath_user}
Anusha Dathatridf365c82019-06-04 01:05:08 -0500179 \ ${deleting_row_id} Set Variable If '${user}' == 'root' or '${deleting_row_id}' == '2'
180 \ ... 2 1
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500181 \ Continue For Loop If '${user}' == 'root'
182 \ ${xpath_delete_user} Run Keyword If '${user}' == '${delete_user}' or '${delete_user}' == 'nonRoot'
Anusha Dathatridf365c82019-06-04 01:05:08 -0500183 \ ... Get Xpath For User Table Attribute Delete ${deleting_row_id}
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500184 \ Run Keyword If '${user}' == '${delete_user}' or '${delete_user}' == 'nonRoot'
185 \ ... Run Keywords Click Button ${xpath_delete_user}
186 \ ... AND Page Should Contain User has been deleted successfully
187 \ ... AND Reload Page
188 \ ... AND Exit For Loop If '${user}' == '${delete_user}'
189
Anusha Dathatridf365c82019-06-04 01:05:08 -0500190Get User Property Value
191 [Documentation] Return property value for the given user.
192 [Arguments] ${username} ${property}=Role
193
194 # Description of argument(s):
195 # username BMC Username.
196 # property User property (e.g. "Role" or "Enabled").
197
198 # Maximum user limit is 15. Hence iterating only 15 times.
199 :FOR ${row_num} IN RANGE 1 ${max_num_users+1}
200 \ ${xpath_user}= Get Xpath For User Table Attribute Username ${row_num}
201 \ Page Should Contain Element ${xpath_user}
202 \ ${xpath_property}= Get Xpath For User Table Attribute ${property} ${row_num}
203 \ ${user}= Get Text ${xpath_user}
204 \ Run Keyword And Return If '${user}' == '${username}' Get Text ${xpath_property}
205
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500206Login And Verify Message
Anusha Dathatric32589b2019-06-17 07:59:41 -0500207 [Documentation] Verifies the error message displayed on screen while logging in.
208 [Arguments] ${username} ${password} ${msg}
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500209
Anusha Dathatric32589b2019-06-17 07:59:41 -0500210 # Description of argument(s):
211 # username BMC Username.
212 # password BMC Password.
213 # msg Message which is expected to be found on login page after login attempt.
Anusha Dathatridf365c82019-06-04 01:05:08 -0500214
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500215 Input Text ${xpath_textbox_username} ${username}
216 Input Password ${xpath_textbox_password} ${password}
217 Click Element ${xpath_button_login}
218 Page Should Contain ${msg}
Anusha Dathatridf365c82019-06-04 01:05:08 -0500219
220Edit User Role
221 [Documentation] Change the role of user to the given value.
222 [Arguments] ${username} ${password} ${user_role}
223
224 # Description of argument(s):
225 # username BMC Username.
226 # password BMC Password.
Anusha Dathatric32589b2019-06-17 07:59:41 -0500227 # user_role The user role to be assigned ("Administrator", "User", "Operator", "Callback").
Anusha Dathatridf365c82019-06-04 01:05:08 -0500228
229 # Maximum user limit is 15. Hence iterating only 15 times.
230 :FOR ${row_num} IN RANGE 1 ${max_num_users+1}
231 \ ${xpath_user}= Get Xpath For User Table Attribute Username ${row_num}
232 \ Page Should Contain Element ${xpath_user}
233 \ ${xpath_edit_user}= Get Xpath For User Table Attribute Edit ${row_num}
234 \ ${user}= Get Text ${xpath_user}
235 \ Run Keyword If '${user}' == '${username}' Run Keywords Click Element ${xpath_edit_user}
236 \ ... AND Add Or Modify user ${username} ${password} ${user_role} action=modify
237 \ ... AND Exit For Loop
238
239Get Xpath For User Table Attribute
240 [Documentation] Get xpath for given user table attribute.
241 [Arguments] ${attribute} ${row_num}
242
243 # Description of argument(s):
244 # attribute User table attribute ("Username", "Enabled", "Role", "Edit", "Delete").
245 # row_num Row number.
246
247 [Return] ${xpath_table_base}/div[${row_num}]&{user_table_column_xpath_mapping}[${attribute}]