blob: 94aa4996c46a7801352c93a5cbcf6ff7e188dcc0 [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
Anusha Dathatribe5e27c2019-06-11 08:30:33 -0500124Create And Verify User Without Enabling
125 [Documentation] Verify login failure while logging into GUI with disabled user.
126 [Tags] Create_And_Verify_User_Without_Enabling
127 [Setup] Run Keywords Test Setup Execution AND Delete Given Users
128
129 Add Or Modify User testUser1 &{user_password}[testUser1] role=User enabled=False
130 LogOut OpenBMC GUI
131 Login And Verify Message testUser1 &{user_password}[testUser1] Invalid username or password
132
133
Sivas SRR9aadc262018-05-10 12:16:03 -0500134*** Keywords ***
135
136Test Setup Execution
Anusha Dathatric32589b2019-06-17 07:59:41 -0500137 [Documentation] Do test case setup tasks.
Sivas SRR9aadc262018-05-10 12:16:03 -0500138
Anusha Dathatric32589b2019-06-17 07:59:41 -0500139 Launch Browser And Login OpenBMC GUI
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500140 Click Button ${xpath_select_users}
141 Sleep 2s
Rahul Maheshwari39785c72019-04-02 20:03:54 -0500142 Wait Until Page Contains Element ${xpath_select_manage_users}
Sivas SRR9aadc262018-05-10 12:16:03 -0500143 Click Element ${xpath_select_manage_users}
Rahul Maheshwari39785c72019-04-02 20:03:54 -0500144 Wait Until Page Contains User account information
Sivas SRR9aadc262018-05-10 12:16:03 -0500145
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500146Add Or Modify User
Anusha Dathatridf365c82019-06-04 01:05:08 -0500147 [Documentation] Create or edit user.
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500148 [Arguments] ${username} ${password} ${role}=Administrator ${enabled}=${True}
149 ... ${action}=add
Anusha Dathatridf365c82019-06-04 01:05:08 -0500150
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500151 # Description of argument(s):
152 # username Name of the user to be created.
153 # role Role of the new user.
154 # enabled If True, User is enabled (Default), False, User is disabled.
155 # action add - Creates a new user.
156 # modify - Edits an existing user.
157 # add_dup - Tries to add a duplicate user and verifies the error message.
158
159 Run Keyword If '${action}' == 'add' or '${action}' == 'add_dup'
160 ... Input Text ${xpath_input_username} ${username}
161 Input Password ${xpath_input_password} ${password}
162 Input Password ${xpath_input_retype_password} ${password}
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500163 Select From List By Value ${xpath_input_user_role} ${role}
164 Run Keyword If '${enabled}' == 'True' Click Element ${xpath_input_enabled_checkbox}
165 Run Keyword If '${action}' == 'modify'
166 ... Click Button ${xpath_edit_save_button}
167 ... ELSE Click Button ${xpath_create_user_button}
168 Capture Page Screenshot
169 Page Should Contain &{action_msg_relation}[${action}]
170
171Delete Given Users
Anusha Dathatridf365c82019-06-04 01:05:08 -0500172 [Documentation] Delete given users.
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500173 [Arguments] ${delete_user}=nonRoot
Anusha Dathatridf365c82019-06-04 01:05:08 -0500174
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500175 # Description of argument(s):
176 # delete_user values - nonRoot/username
177 # If nonRoot - Deletes all non-root users,
178 # username - Deletes the given user.
179
180 Wait Until Page Contains root
181 Run Keyword If '${delete_user}' != 'nonRoot' Page Should Contain ${delete_user}
182 # Row id that gets deleted in every iteration.
183 ${deleting_row_id}= Set Variable 1
Anusha Dathatridf365c82019-06-04 01:05:08 -0500184 :FOR ${row} IN RANGE 1 ${max_num_users+1}
185 \ ${xpath_user}= Get Xpath For User Table Attribute Username ${row}
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500186 \ ${status}= Run Keyword And Return Status Page Should Contain Element ${xpath_user}
187 \ Exit For Loop If '${status}' == 'False'
188 \ ${user}= Get Text ${xpath_user}
Anusha Dathatridf365c82019-06-04 01:05:08 -0500189 \ ${deleting_row_id} Set Variable If '${user}' == 'root' or '${deleting_row_id}' == '2'
190 \ ... 2 1
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500191 \ Continue For Loop If '${user}' == 'root'
192 \ ${xpath_delete_user} Run Keyword If '${user}' == '${delete_user}' or '${delete_user}' == 'nonRoot'
Anusha Dathatridf365c82019-06-04 01:05:08 -0500193 \ ... Get Xpath For User Table Attribute Delete ${deleting_row_id}
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500194 \ Run Keyword If '${user}' == '${delete_user}' or '${delete_user}' == 'nonRoot'
195 \ ... Run Keywords Click Button ${xpath_delete_user}
196 \ ... AND Page Should Contain User has been deleted successfully
197 \ ... AND Reload Page
198 \ ... AND Exit For Loop If '${user}' == '${delete_user}'
199
Anusha Dathatridf365c82019-06-04 01:05:08 -0500200Get User Property Value
201 [Documentation] Return property value for the given user.
202 [Arguments] ${username} ${property}=Role
203
204 # Description of argument(s):
205 # username BMC Username.
206 # property User property (e.g. "Role" or "Enabled").
207
208 # Maximum user limit is 15. Hence iterating only 15 times.
209 :FOR ${row_num} IN RANGE 1 ${max_num_users+1}
210 \ ${xpath_user}= Get Xpath For User Table Attribute Username ${row_num}
211 \ Page Should Contain Element ${xpath_user}
212 \ ${xpath_property}= Get Xpath For User Table Attribute ${property} ${row_num}
213 \ ${user}= Get Text ${xpath_user}
214 \ Run Keyword And Return If '${user}' == '${username}' Get Text ${xpath_property}
215
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500216Login And Verify Message
Anusha Dathatric32589b2019-06-17 07:59:41 -0500217 [Documentation] Verifies the error message displayed on screen while logging in.
218 [Arguments] ${username} ${password} ${msg}
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500219
Anusha Dathatric32589b2019-06-17 07:59:41 -0500220 # Description of argument(s):
221 # username BMC Username.
222 # password BMC Password.
223 # msg Message which is expected to be found on login page after login attempt.
Anusha Dathatridf365c82019-06-04 01:05:08 -0500224
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500225 Input Text ${xpath_textbox_username} ${username}
226 Input Password ${xpath_textbox_password} ${password}
227 Click Element ${xpath_button_login}
228 Page Should Contain ${msg}
Anusha Dathatridf365c82019-06-04 01:05:08 -0500229
230Edit User Role
231 [Documentation] Change the role of user to the given value.
232 [Arguments] ${username} ${password} ${user_role}
233
234 # Description of argument(s):
235 # username BMC Username.
236 # password BMC Password.
Anusha Dathatric32589b2019-06-17 07:59:41 -0500237 # user_role The user role to be assigned ("Administrator", "User", "Operator", "Callback").
Anusha Dathatridf365c82019-06-04 01:05:08 -0500238
239 # Maximum user limit is 15. Hence iterating only 15 times.
240 :FOR ${row_num} IN RANGE 1 ${max_num_users+1}
241 \ ${xpath_user}= Get Xpath For User Table Attribute Username ${row_num}
242 \ Page Should Contain Element ${xpath_user}
243 \ ${xpath_edit_user}= Get Xpath For User Table Attribute Edit ${row_num}
244 \ ${user}= Get Text ${xpath_user}
245 \ Run Keyword If '${user}' == '${username}' Run Keywords Click Element ${xpath_edit_user}
246 \ ... AND Add Or Modify user ${username} ${password} ${user_role} action=modify
247 \ ... AND Exit For Loop
248
249Get Xpath For User Table Attribute
250 [Documentation] Get xpath for given user table attribute.
251 [Arguments] ${attribute} ${row_num}
252
253 # Description of argument(s):
254 # attribute User table attribute ("Username", "Enabled", "Role", "Edit", "Delete").
255 # row_num Row number.
256
257 [Return] ${xpath_table_base}/div[${row_num}]&{user_table_column_xpath_mapping}[${attribute}]