blob: de361b5d4300c4e2d5cf684ee90d6ea60a41056d [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
35
Rahul Maheshwari39785c72019-04-02 20:03:54 -050036
Sivas SRR9aadc262018-05-10 12:16:03 -050037
38*** Test Cases ***
Sivas SRR9aadc262018-05-10 12:16:03 -050039
Rahul Maheshwari39785c72019-04-02 20:03:54 -050040Verify Existence Of All Section In User Page
41 [Documentation] Verify existence of all sections in user page..
42 [Tags] Verify_Existence_Of_All_Section_In_User_Page
43
44 Page should contain User account properties
45 Page should contain User account information
46 Page should contain User account settings
Sivas SRR9aadc262018-05-10 12:16:03 -050047
48
Rahul Maheshwari39785c72019-04-02 20:03:54 -050049Verify Existence Of All Input Boxes In User Page
50 [Documentation] Verify existence of all input boxes in user page.
51 [Tags] Verify_Existence_Of_All_Input_Boxes_In_User_Page
Sivas SRR9aadc262018-05-10 12:16:03 -050052
Rahul Maheshwari39785c72019-04-02 20:03:54 -050053 # Input boxes under user account settings
54 Page Should Contain Element ${xpath_input_username}
55 Page Should Contain Element ${xpath_input_password}
56 Page Should Contain Element ${xpath_input_retype_password}
57 Page Should Contain Element ${xpath_input_user_role}
58 Page Should Contain Element ${xpath_input_enabled_checkbox}
59
60 # Input boxes under user account properties
61 Page Should Contain Element ${xpath_input_lockout_time}
62 Page Should Contain Element ${xpath_input_failed_login_attempts}
Sivas SRR9aadc262018-05-10 12:16:03 -050063
64
Rahul Maheshwari39785c72019-04-02 20:03:54 -050065Verify Existence Of All Button In User Page
George Keishing1add5532019-05-31 06:56:06 -050066 [Documentation] Verify existence of all button in user page.
Rahul Maheshwari39785c72019-04-02 20:03:54 -050067 [Tags] Verify_Existence_Of_All_Button_In_User_Page
Sivas SRR9aadc262018-05-10 12:16:03 -050068
Rahul Maheshwari39785c72019-04-02 20:03:54 -050069 # Buttons under user account properties
70 Page Should Contain Element ${xpath_save_setting_button}
71
72 # Buttons under user account settings
73 Page Should Contain Element ${xpath_create_user_button}
74
75 # Buttons under user account properties
76 Page Should Contain Element ${xpath_edit_button}
77 Page Should Contain Element ${xpath_delete_button}
78
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -050079Verify Error When Duplicate User Is Created
80 [Documentation] Verify error when duplicate user is created.
81 [Tags] Verify_Error_When_Duplicate_User_Is_Created
82 [Setup] Delete Given Users
83
84 Add Or Modify User root &{user_password}[root] action=add_dup
85
86Delete User And Verify
87 [Documentation] Delete user and verify.
88 [Tags] Delete_User_And_Verify
89 [Setup] Delete Given Users
90
91 Add Or Modify User testUser1 &{user_password}[testUser1]
92 Delete Given Users delete_user=testUser1
93 Page Should Not Contain testUser1
94
95Verify Invalid Password Error
96 [Documentation] Verify the error message when user logs in with invalid password.
97 [Tags] Verify_Invalid_Password_Error
98 [Setup] Delete Given Users
99 [Teardown] Login OpenBMC GUI
100
101 LogOut OpenBMC GUI
102 Login And Verify Message root &{user_invalid_password}[root] Invalid username or password
Sivas SRR9aadc262018-05-10 12:16:03 -0500103
104*** Keywords ***
105
106Test Setup Execution
107 [Documentation] Do test case setup tasks.
108
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500109 Click Button ${xpath_select_users}
110 Sleep 2s
Rahul Maheshwari39785c72019-04-02 20:03:54 -0500111 Wait Until Page Contains Element ${xpath_select_manage_users}
Sivas SRR9aadc262018-05-10 12:16:03 -0500112 Click Element ${xpath_select_manage_users}
Rahul Maheshwari39785c72019-04-02 20:03:54 -0500113 Wait Until Page Contains User account information
Sivas SRR9aadc262018-05-10 12:16:03 -0500114
Anusha Dathatri2fe9ad52019-05-14 21:20:22 -0500115Add Or Modify User
116 [Documentation] Creates or edits user.
117 [Arguments] ${username} ${password} ${role}=Administrator ${enabled}=${True}
118 ... ${action}=add
119 # Description of argument(s):
120 # username Name of the user to be created.
121 # role Role of the new user.
122 # enabled If True, User is enabled (Default), False, User is disabled.
123 # action add - Creates a new user.
124 # modify - Edits an existing user.
125 # add_dup - Tries to add a duplicate user and verifies the error message.
126
127 Run Keyword If '${action}' == 'add' or '${action}' == 'add_dup'
128 ... Input Text ${xpath_input_username} ${username}
129 Input Password ${xpath_input_password} ${password}
130 Input Password ${xpath_input_retype_password} ${password}
131 Log ${role}
132 Select From List By Value ${xpath_input_user_role} ${role}
133 Run Keyword If '${enabled}' == 'True' Click Element ${xpath_input_enabled_checkbox}
134 Run Keyword If '${action}' == 'modify'
135 ... Click Button ${xpath_edit_save_button}
136 ... ELSE Click Button ${xpath_create_user_button}
137 Capture Page Screenshot
138 Page Should Contain &{action_msg_relation}[${action}]
139
140Delete Given Users
141 [Documentation] Deletes users based on the input.
142 [Arguments] ${delete_user}=nonRoot
143 # Description of argument(s):
144 # delete_user values - nonRoot/username
145 # If nonRoot - Deletes all non-root users,
146 # username - Deletes the given user.
147
148 Wait Until Page Contains root
149 Run Keyword If '${delete_user}' != 'nonRoot' Page Should Contain ${delete_user}
150 # Row id that gets deleted in every iteration.
151 ${deleting_row_id}= Set Variable 1
152 :FOR ${row} IN RANGE 1 16
153 \ ${xpath_user}= Set Variable //*[@id="user-accounts"]/div[4]/div[2]/div[${deleting_row_id}]/div[1]
154 \ ${status}= Run Keyword And Return Status Page Should Contain Element ${xpath_user}
155 \ Exit For Loop If '${status}' == 'False'
156 \ ${user}= Get Text ${xpath_user}
157 \ ${deleting_row_id} Run Keyword If '${user}' == 'root' or '${deleting_row_id}' == '2' Set Variable 2
158 \ ... ELSE Set Variable 1
159 \ Continue For Loop If '${user}' == 'root'
160 \ ${xpath_delete_user} Run Keyword If '${user}' == '${delete_user}' or '${delete_user}' == 'nonRoot'
161 \ ... Set Variable //*[@id="user-accounts"]/div[4]/div[2]/div[${deleting_row_id}]/div[5]/button[2]
162 \ Run Keyword If '${user}' == '${delete_user}' or '${delete_user}' == 'nonRoot'
163 \ ... Run Keywords Click Button ${xpath_delete_user}
164 \ ... AND Page Should Contain User has been deleted successfully
165 \ ... AND Reload Page
166 \ ... AND Exit For Loop If '${user}' == '${delete_user}'
167
168Login And Verify Message
169 [Documentation] Verifies the error message displayed on screen while logging in.
170 [Arguments] ${username} ${password} ${msg}
171
172 Input Text ${xpath_textbox_username} ${username}
173 Input Password ${xpath_textbox_password} ${password}
174 Click Element ${xpath_button_login}
175 Page Should Contain ${msg}