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 | |
| 8 | Suite Setup Launch Browser And Login OpenBMC GUI |
Rahul Maheshwari | 43333ff | 2018-11-26 23:18:36 -0600 | [diff] [blame] | 9 | Suite Teardown Close Browser |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 10 | Test Setup Test Setup Execution |
| 11 | |
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 | |
| 45 | *** Test Cases *** |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 46 | |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 47 | Verify 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 SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 54 | |
| 55 | |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 56 | Verify 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 SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 59 | |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 60 | # 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 SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 70 | |
| 71 | |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 72 | Verify Existence Of All Button In User Page |
George Keishing | 1add553 | 2019-05-31 06:56:06 -0500 | [diff] [blame] | 73 | [Documentation] Verify existence of all button in user page. |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 74 | [Tags] Verify_Existence_Of_All_Button_In_User_Page |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 75 | |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 76 | # 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 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 |
| 89 | [Setup] Delete Given Users |
| 90 | |
| 91 | Add Or Modify User root &{user_password}[root] action=add_dup |
| 92 | |
| 93 | Delete 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 | |
| 102 | Verify 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 SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 110 | |
Anusha Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 111 | Edit 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 SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 122 | *** Keywords *** |
| 123 | |
| 124 | Test Setup Execution |
| 125 | [Documentation] Do test case setup tasks. |
| 126 | |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 127 | Click Button ${xpath_select_users} |
| 128 | Sleep 2s |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 129 | Wait Until Page Contains Element ${xpath_select_manage_users} |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 130 | Click Element ${xpath_select_manage_users} |
Rahul Maheshwari | 39785c7 | 2019-04-02 20:03:54 -0500 | [diff] [blame] | 131 | Wait Until Page Contains User account information |
Sivas SRR | 9aadc26 | 2018-05-10 12:16:03 -0500 | [diff] [blame] | 132 | |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 133 | Add Or Modify User |
Anusha Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 134 | [Documentation] Create or edit user. |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 135 | [Arguments] ${username} ${password} ${role}=Administrator ${enabled}=${True} |
| 136 | ... ${action}=add |
Anusha Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 137 | |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 138 | # 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 Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 150 | 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 | |
| 158 | Delete Given Users |
Anusha Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 159 | [Documentation] Delete given users. |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 160 | [Arguments] ${delete_user}=nonRoot |
Anusha Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 161 | |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 162 | # 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 Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 171 | :FOR ${row} IN RANGE 1 ${max_num_users+1} |
| 172 | \ ${xpath_user}= Get Xpath For User Table Attribute Username ${row} |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 173 | \ ${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 Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 176 | \ ${deleting_row_id} Set Variable If '${user}' == 'root' or '${deleting_row_id}' == '2' |
| 177 | \ ... 2 1 |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 178 | \ Continue For Loop If '${user}' == 'root' |
| 179 | \ ${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] | 180 | \ ... Get Xpath For User Table Attribute Delete ${deleting_row_id} |
Anusha Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 181 | \ 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 Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 187 | Get 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 Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 203 | Login And Verify Message |
| 204 | [Documentation] Verifies the error message displayed on screen while logging in. |
| 205 | [Arguments] ${username} ${password} ${msg} |
| 206 | |
Anusha Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 207 | # 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 Dathatri | 2fe9ad5 | 2019-05-14 21:20:22 -0500 | [diff] [blame] | 212 | 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 Dathatri | df365c8 | 2019-06-04 01:05:08 -0500 | [diff] [blame] | 216 | |
| 217 | Edit 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 | |
| 236 | Get 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}] |