blob: 894b95da453b23b951472b8f57bb1f1b0970df54 [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
8Suite Setup Launch Browser And Login OpenBMC GUI
Rahul Maheshwari43333ff2018-11-26 23:18:36 -06009Suite Teardown Close Browser
Sivas SRR9aadc262018-05-10 12:16:03 -050010Test Setup Test Setup Execution
11
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
45*** Test Cases ***
Sivas SRR9aadc262018-05-10 12:16:03 -050046
Rahul Maheshwari39785c72019-04-02 20:03:54 -050047Verify Existence Of All Section In User Page
48 [Documentation] Verify existence of all sections in user page..
49 [Tags] Verify_Existence_Of_All_Section_In_User_Page
50
51 Page should contain User account properties
52 Page should contain User account information
53 Page should contain User account settings
Sivas SRR9aadc262018-05-10 12:16:03 -050054
55
Rahul Maheshwari39785c72019-04-02 20:03:54 -050056Verify Existence Of All Input Boxes In User Page
57 [Documentation] Verify existence of all input boxes in user page.
58 [Tags] Verify_Existence_Of_All_Input_Boxes_In_User_Page
Sivas SRR9aadc262018-05-10 12:16:03 -050059
Rahul Maheshwari39785c72019-04-02 20:03:54 -050060 # Input boxes under user account settings
61 Page Should Contain Element ${xpath_input_username}
62 Page Should Contain Element ${xpath_input_password}
63 Page Should Contain Element ${xpath_input_retype_password}
64 Page Should Contain Element ${xpath_input_user_role}
65 Page Should Contain Element ${xpath_input_enabled_checkbox}
66
67 # Input boxes under user account properties
68 Page Should Contain Element ${xpath_input_lockout_time}
69 Page Should Contain Element ${xpath_input_failed_login_attempts}
Sivas SRR9aadc262018-05-10 12:16:03 -050070
71
Rahul Maheshwari39785c72019-04-02 20:03:54 -050072Verify Existence Of All Button In User Page
George Keishing1add5532019-05-31 06:56:06 -050073 [Documentation] Verify existence of all button in user page.
Rahul Maheshwari39785c72019-04-02 20:03:54 -050074 [Tags] Verify_Existence_Of_All_Button_In_User_Page
Sivas SRR9aadc262018-05-10 12:16:03 -050075
Rahul Maheshwari39785c72019-04-02 20:03:54 -050076 # Buttons under user account properties
77 Page Should Contain Element ${xpath_save_setting_button}
78
79 # Buttons under user account settings
80 Page Should Contain Element ${xpath_create_user_button}
81
82 # Buttons under user account properties
83 Page Should Contain Element ${xpath_edit_button}
84 Page Should Contain Element ${xpath_delete_button}
85
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
89 [Setup] Delete Given Users
90
91 Add Or Modify User root &{user_password}[root] action=add_dup
92
93Delete User And Verify
94 [Documentation] Delete user and verify.
95 [Tags] Delete_User_And_Verify
96 [Setup] Delete Given Users
97
98 Add Or Modify User testUser1 &{user_password}[testUser1]
99 Delete Given Users delete_user=testUser1
100 Page Should Not Contain testUser1
101
102Verify Invalid Password Error
103 [Documentation] Verify the error message when user logs in with invalid password.
104 [Tags] Verify_Invalid_Password_Error
105 [Setup] Delete Given Users
106 [Teardown] Login OpenBMC GUI
107
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 Dathatridf365c82019-06-04 01:05:08 -0500111Edit And Verify User Property
112 [Documentation] Edit and verify the user property.
113 [Tags] Edit_And_Verify_User_Property
114 [Setup] Run Keywords Test Setup Execution AND Delete Given Users
115
116 Add Or Modify User testUser1 &{user_password}[testUser1] User
117 Reload Page
118 Edit User Role testUser1 &{user_password}[testUser1] Callback
119 ${user_role}= Get User Property Value testUser1 Role
120 Should Be Equal ${user_role} Callback
121
Sivas SRR9aadc262018-05-10 12:16:03 -0500122*** Keywords ***
123
124Test Setup Execution
125 [Documentation] Do test case setup tasks.
126
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500127 Click Button ${xpath_select_users}
128 Sleep 2s
Rahul Maheshwari39785c72019-04-02 20:03:54 -0500129 Wait Until Page Contains Element ${xpath_select_manage_users}
Sivas SRR9aadc262018-05-10 12:16:03 -0500130 Click Element ${xpath_select_manage_users}
Rahul Maheshwari39785c72019-04-02 20:03:54 -0500131 Wait Until Page Contains User account information
Sivas SRR9aadc262018-05-10 12:16:03 -0500132
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500133Add Or Modify User
Anusha Dathatridf365c82019-06-04 01:05:08 -0500134 [Documentation] Create or edit user.
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500135 [Arguments] ${username} ${password} ${role}=Administrator ${enabled}=${True}
136 ... ${action}=add
Anusha Dathatridf365c82019-06-04 01:05:08 -0500137
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500138 # Description of argument(s):
139 # username Name of the user to be created.
140 # role Role of the new user.
141 # enabled If True, User is enabled (Default), False, User is disabled.
142 # action add - Creates a new user.
143 # modify - Edits an existing user.
144 # add_dup - Tries to add a duplicate user and verifies the error message.
145
146 Run Keyword If '${action}' == 'add' or '${action}' == 'add_dup'
147 ... Input Text ${xpath_input_username} ${username}
148 Input Password ${xpath_input_password} ${password}
149 Input Password ${xpath_input_retype_password} ${password}
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500150 Select From List By Value ${xpath_input_user_role} ${role}
151 Run Keyword If '${enabled}' == 'True' Click Element ${xpath_input_enabled_checkbox}
152 Run Keyword If '${action}' == 'modify'
153 ... Click Button ${xpath_edit_save_button}
154 ... ELSE Click Button ${xpath_create_user_button}
155 Capture Page Screenshot
156 Page Should Contain &{action_msg_relation}[${action}]
157
158Delete Given Users
Anusha Dathatridf365c82019-06-04 01:05:08 -0500159 [Documentation] Delete given users.
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500160 [Arguments] ${delete_user}=nonRoot
Anusha Dathatridf365c82019-06-04 01:05:08 -0500161
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500162 # Description of argument(s):
163 # delete_user values - nonRoot/username
164 # If nonRoot - Deletes all non-root users,
165 # username - Deletes the given user.
166
167 Wait Until Page Contains root
168 Run Keyword If '${delete_user}' != 'nonRoot' Page Should Contain ${delete_user}
169 # Row id that gets deleted in every iteration.
170 ${deleting_row_id}= Set Variable 1
Anusha Dathatridf365c82019-06-04 01:05:08 -0500171 :FOR ${row} IN RANGE 1 ${max_num_users+1}
172 \ ${xpath_user}= Get Xpath For User Table Attribute Username ${row}
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500173 \ ${status}= Run Keyword And Return Status Page Should Contain Element ${xpath_user}
174 \ Exit For Loop If '${status}' == 'False'
175 \ ${user}= Get Text ${xpath_user}
Anusha Dathatridf365c82019-06-04 01:05:08 -0500176 \ ${deleting_row_id} Set Variable If '${user}' == 'root' or '${deleting_row_id}' == '2'
177 \ ... 2 1
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500178 \ Continue For Loop If '${user}' == 'root'
179 \ ${xpath_delete_user} Run Keyword If '${user}' == '${delete_user}' or '${delete_user}' == 'nonRoot'
Anusha Dathatridf365c82019-06-04 01:05:08 -0500180 \ ... Get Xpath For User Table Attribute Delete ${deleting_row_id}
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500181 \ Run Keyword If '${user}' == '${delete_user}' or '${delete_user}' == 'nonRoot'
182 \ ... Run Keywords Click Button ${xpath_delete_user}
183 \ ... AND Page Should Contain User has been deleted successfully
184 \ ... AND Reload Page
185 \ ... AND Exit For Loop If '${user}' == '${delete_user}'
186
Anusha Dathatridf365c82019-06-04 01:05:08 -0500187Get User Property Value
188 [Documentation] Return property value for the given user.
189 [Arguments] ${username} ${property}=Role
190
191 # Description of argument(s):
192 # username BMC Username.
193 # property User property (e.g. "Role" or "Enabled").
194
195 # Maximum user limit is 15. Hence iterating only 15 times.
196 :FOR ${row_num} IN RANGE 1 ${max_num_users+1}
197 \ ${xpath_user}= Get Xpath For User Table Attribute Username ${row_num}
198 \ Page Should Contain Element ${xpath_user}
199 \ ${xpath_property}= Get Xpath For User Table Attribute ${property} ${row_num}
200 \ ${user}= Get Text ${xpath_user}
201 \ Run Keyword And Return If '${user}' == '${username}' Get Text ${xpath_property}
202
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500203Login And Verify Message
204 [Documentation] Verifies the error message displayed on screen while logging in.
205 [Arguments] ${username} ${password} ${msg}
206
Anusha Dathatridf365c82019-06-04 01:05:08 -0500207 # Description of argument(s):
208 # username BMC Username.
209 # password BMC Password.
210 # msg Message which is expected to be found on login page after login attempt.
211
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500212 Input Text ${xpath_textbox_username} ${username}
213 Input Password ${xpath_textbox_password} ${password}
214 Click Element ${xpath_button_login}
215 Page Should Contain ${msg}
Anusha Dathatridf365c82019-06-04 01:05:08 -0500216
217Edit User Role
218 [Documentation] Change the role of user to the given value.
219 [Arguments] ${username} ${password} ${user_role}
220
221 # Description of argument(s):
222 # username BMC Username.
223 # password BMC Password.
224 # user_role The user role to be assigned ("administrator", "user", "operator", "callback").
225
226 # Maximum user limit is 15. Hence iterating only 15 times.
227 :FOR ${row_num} IN RANGE 1 ${max_num_users+1}
228 \ ${xpath_user}= Get Xpath For User Table Attribute Username ${row_num}
229 \ Page Should Contain Element ${xpath_user}
230 \ ${xpath_edit_user}= Get Xpath For User Table Attribute Edit ${row_num}
231 \ ${user}= Get Text ${xpath_user}
232 \ Run Keyword If '${user}' == '${username}' Run Keywords Click Element ${xpath_edit_user}
233 \ ... AND Add Or Modify user ${username} ${password} ${user_role} action=modify
234 \ ... AND Exit For Loop
235
236Get Xpath For User Table Attribute
237 [Documentation] Get xpath for given user table attribute.
238 [Arguments] ${attribute} ${row_num}
239
240 # Description of argument(s):
241 # attribute User table attribute ("Username", "Enabled", "Role", "Edit", "Delete").
242 # row_num Row number.
243
244 [Return] ${xpath_table_base}/div[${row_num}]&{user_table_column_xpath_mapping}[${attribute}]