Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Test OpenBMC GUI "Manage user account" sub-menu of |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 4 | ... "Users". |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 5 | |
| 6 | Resource ../../lib/resource.robot |
| 7 | |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 8 | Test Setup Test Setup Execution |
Anusha Dathatri | c32589b | 2019-06-17 07:59:41 -0500 | [diff] [blame] | 9 | Test Teardown Close Browser |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 10 | |
Anusha Dathatri | 883ff7c | 2019-10-01 01:56:30 -0500 | [diff] [blame] | 11 | Force Tags Manage_User |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 12 | |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 13 | *** Variables *** |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 14 | |
| 15 | ${xpath_input_username} //input[@name='UserName'] |
| 16 | ${xpath_input_password} //input[@name='Password'] |
| 17 | ${xpath_input_retype_password} //input[@name='VerifyPassword'] |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 18 | ${xpath_input_user_role} //select[@id='role'] |
| 19 | ${xpath_input_enabled_checkbox} //label[@for="user-manage__enabled"] |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 20 | ${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 Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 25 | ${xpath_create_user_button} //button[text() ="Create user"] |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 26 | ${xpath_edit_button} //button[text() ="Edit"] |
| 27 | ${xpath_delete_button} //button[text() ="Delete"] |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 28 | ${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 Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 35 | ${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 Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 42 | |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 43 | |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 44 | *** Test Cases *** |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 45 | |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 46 | Verify Existence Of All Section In User Page |
Anusha Dathatri | c32589b | 2019-06-17 07:59:41 -0500 | [diff] [blame] | 47 | [Documentation] Verify existence of all sections in user page. |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 48 | [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 SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 53 | |
| 54 | |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 55 | Verify 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 SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 58 | |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 59 | # 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 SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 69 | |
| 70 | |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 71 | Verify Existence Of All Button In User Page |
George Keishing | 1add553 | 2019-05-31 06:56:06 -0500 | [diff] [blame] | 72 | [Documentation] Verify existence of all button in user page. |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 73 | [Tags] Verify_Existence_Of_All_Button_In_User_Page |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 74 | |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 75 | # 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 Dathatri | c32589b | 2019-06-17 07:59:41 -0500 | [diff] [blame] | 85 | |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 86 | Verify 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 Dathatri | c32589b | 2019-06-17 07:59:41 -0500 | [diff] [blame] | 89 | [Setup] Run Keywords Test Setup Execution AND Delete Given Users |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 90 | |
| 91 | Add Or Modify User root &{user_password}[root] action=add_dup |
| 92 | |
Anusha Dathatri | c32589b | 2019-06-17 07:59:41 -0500 | [diff] [blame] | 93 | |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 94 | Delete User And Verify |
| 95 | [Documentation] Delete user and verify. |
| 96 | [Tags] Delete_User_And_Verify |
Anusha Dathatri | c32589b | 2019-06-17 07:59:41 -0500 | [diff] [blame] | 97 | [Setup] Run Keywords Test Setup Execution AND Delete Given Users |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 98 | |
| 99 | Add Or Modify User testUser1 &{user_password}[testUser1] |
| 100 | Delete Given Users delete_user=testUser1 |
| 101 | Page Should Not Contain testUser1 |
| 102 | |
Anusha Dathatri | c32589b | 2019-06-17 07:59:41 -0500 | [diff] [blame] | 103 | |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 104 | Verify Invalid Password Error |
| 105 | [Documentation] Verify the error message when user logs in with invalid password. |
| 106 | [Tags] Verify_Invalid_Password_Error |
Anusha Dathatri | c32589b | 2019-06-17 07:59:41 -0500 | [diff] [blame] | 107 | [Setup] Run Keywords Test Setup Execution AND Delete Given Users |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 108 | |
| 109 | LogOut OpenBMC GUI |
| 110 | Login And Verify Message root &{user_invalid_password}[root] Invalid username or password |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 111 | |
Anusha Dathatri | c32589b | 2019-06-17 07:59:41 -0500 | [diff] [blame] | 112 | |
Anusha Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 113 | Edit 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 Dathatri | c32589b | 2019-06-17 07:59:41 -0500 | [diff] [blame] | 124 | |
Anusha Dathatri | be5e27c | 2019-06-11 08:30:33 -0500 | [diff] [blame] | 125 | Create 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 SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 135 | *** Keywords *** |
| 136 | |
| 137 | Test Setup Execution |
Anusha Dathatri | c32589b | 2019-06-17 07:59:41 -0500 | [diff] [blame] | 138 | [Documentation] Do test case setup tasks. |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 139 | |
Anusha Dathatri | c32589b | 2019-06-17 07:59:41 -0500 | [diff] [blame] | 140 | Launch Browser And Login OpenBMC GUI |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 141 | Click Button ${xpath_select_users} |
| 142 | Sleep 2s |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 143 | Wait Until Page Contains Element ${xpath_select_manage_users} |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 144 | Click Element ${xpath_select_manage_users} |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 145 | Wait Until Page Contains User account information |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 146 | |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 147 | Add Or Modify User |
Anusha Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 148 | [Documentation] Create or edit user. |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 149 | [Arguments] ${username} ${password} ${role}=Administrator ${enabled}=${True} |
| 150 | ... ${action}=add |
Anusha Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 151 | |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 152 | # 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 Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 164 | 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 | |
| 172 | Delete Given Users |
Anusha Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 173 | [Documentation] Delete given users. |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 174 | [Arguments] ${delete_user}=nonRoot |
Anusha Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 175 | |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 176 | # 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 Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 185 | :FOR ${row} IN RANGE 1 ${max_num_users+1} |
| 186 | \ ${xpath_user}= Get Xpath For User Table Attribute Username ${row} |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 187 | \ ${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 Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 190 | \ ${deleting_row_id} Set Variable If '${user}' == 'root' or '${deleting_row_id}' == '2' |
| 191 | \ ... 2 1 |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 192 | \ Continue For Loop If '${user}' == 'root' |
| 193 | \ ${xpath_delete_user} Run Keyword If '${user}' == '${delete_user}' or '${delete_user}' == 'nonRoot' |
Anusha Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 194 | \ ... Get Xpath For User Table Attribute Delete ${deleting_row_id} |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 195 | \ 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 Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 201 | Get 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 Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 217 | Login And Verify Message |
Anusha Dathatri | c32589b | 2019-06-17 07:59:41 -0500 | [diff] [blame] | 218 | [Documentation] Verifies the error message displayed on screen while logging in. |
| 219 | [Arguments] ${username} ${password} ${msg} |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 220 | |
Anusha Dathatri | c32589b | 2019-06-17 07:59:41 -0500 | [diff] [blame] | 221 | # 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 Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 225 | |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 226 | 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 Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 230 | |
| 231 | Edit 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 Dathatri | c32589b | 2019-06-17 07:59:41 -0500 | [diff] [blame] | 238 | # user_role The user role to be assigned ("Administrator", "User", "Operator", "Callback"). |
Anusha Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 239 | |
| 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 | |
| 250 | Get 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}] |