Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This is a resource file containing user-defined keywords for new Vue based OpenBMC GUI. |
| 3 | |
| 4 | Library XvfbRobot |
| 5 | Library SeleniumLibrary |
| 6 | Library SSHLibrary 30 Seconds |
| 7 | Resource ../../lib/state_manager.robot |
| 8 | Variables ../data/gui_variables.py |
| 9 | |
| 10 | |
| 11 | *** Variables *** |
Sridevi Ramesh | fba7a39 | 2025-03-27 10:21:40 -0500 | [diff] [blame] | 12 | ${OPENBMC_GUI_URL} https://${OPENBMC_HOST}:${HTTPS_PORT} |
shahmo32 | 978f91d | 2023-04-05 20:59:03 +0530 | [diff] [blame] | 13 | ${xpath_power_page} //*[@data-test-id='appHeader-container-power'] |
| 14 | ${xpath_power_shutdown} //*[@data-test-id='serverPowerOperations-button-shutDown'] |
| 15 | ${xpath_power_power_on} //*[@data-test-id='serverPowerOperations-button-powerOn'] |
| 16 | ${xpath_power_reboot} //*[@data-test-id='serverPowerOperations-button-reboot'] |
| 17 | ${xpath_confirm} //button[contains(text(),'Confirm')] |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 18 | |
George Keishing | 4d4ef99 | 2021-01-28 09:56:53 -0600 | [diff] [blame] | 19 | # Default GUI browser and mode is set to "Firefox" and "headless" |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 20 | # respectively here. |
| 21 | ${GUI_BROWSER} ff |
| 22 | ${GUI_MODE} headless |
| 23 | |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 24 | |
| 25 | *** Keywords *** |
| 26 | |
| 27 | Open Browser With URL |
| 28 | [Documentation] Open browser with specified URL and returns browser id. |
| 29 | [Arguments] ${URL} ${browser}=ff ${mode}=${GUI_MODE} |
| 30 | |
| 31 | # Description of argument(s): |
| 32 | # URL Openbmc GUI URL to be open |
| 33 | # (e.g. https://openbmc-test.mybluemix.net/#/login). |
| 34 | # browser Browser used to open above URL |
| 35 | # (e.g. gc for google chrome, ff for firefox). |
| 36 | # mode Browser opening mode(e.g. headless, header). |
| 37 | |
rramyasr-in | 714ed72 | 2025-05-20 02:19:50 -0500 | [diff] [blame] | 38 | IF '${mode}' == 'headless' |
| 39 | ${browser_ID}= Launch Headless Browser ${URL} ${browser} |
| 40 | ELSE |
| 41 | ${browser_ID}= Open Browser ${URL} ${browser} |
| 42 | END |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 43 | RETURN ${browser_ID} |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 44 | |
| 45 | |
| 46 | Launch Header Browser |
| 47 | [Documentation] Open the browser with the URL and |
| 48 | ... login on windows platform. |
| 49 | [Arguments] ${browser_type}=${GUI_BROWSER} |
| 50 | |
| 51 | # Description of argument(s): |
| 52 | # browser_type Type of browser (e.g. "firefox", "chrome", etc.). |
| 53 | |
Sridevi Ramesh | fba7a39 | 2025-03-27 10:21:40 -0500 | [diff] [blame] | 54 | ${BROWSER_ID}= Open Browser ${OPENBMC_GUI_URL} ${browser_type} |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 55 | Maximize Browser Window |
| 56 | Set Global Variable ${BROWSER_ID} |
| 57 | |
| 58 | |
| 59 | Launch Headless Browser |
| 60 | [Documentation] Launch headless browser. |
Sridevi Ramesh | fba7a39 | 2025-03-27 10:21:40 -0500 | [diff] [blame] | 61 | [Arguments] ${URL}=${OPENBMC_GUI_URL} ${browser}=${GUI_BROWSER} |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 62 | |
| 63 | # Description of argument(s): |
| 64 | # URL Openbmc GUI URL to be open |
| 65 | # (e.g. https://openbmc-test.mybluemix.net/#/login). |
| 66 | # browser Browser to open given URL in headless way |
| 67 | # (e.g. gc for google chrome, ff for firefox). |
| 68 | |
| 69 | Start Virtual Display |
yuvanvarshitha | 761f5d9 | 2024-07-01 17:17:05 +0530 | [diff] [blame] | 70 | ${browser_ID}= Open Browser ${URL} ${browser} |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 71 | Set Window Size 1920 1080 |
| 72 | |
George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 73 | RETURN ${browser_ID} |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 74 | |
| 75 | |
| 76 | Launch Browser And Login GUI |
rramyasr-in | b874c31 | 2023-02-16 01:33:37 -0600 | [diff] [blame] | 77 | [Documentation] Launch browser and login to OpenBMC GUI, retry 2 attempts |
| 78 | ... in 1 minute time. |
| 79 | |
rramyasr-in | 4f16a51 | 2024-02-21 19:18:07 -0600 | [diff] [blame] | 80 | Wait Until Keyword Succeeds 195 sec 65 sec Retry Browser Login Attempts |
rramyasr-in | b874c31 | 2023-02-16 01:33:37 -0600 | [diff] [blame] | 81 | |
| 82 | |
| 83 | Retry Browser Login Attempts |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 84 | [Documentation] Launch browser and login to OpenBMC GUI. |
| 85 | |
Sridevi Ramesh | fba7a39 | 2025-03-27 10:21:40 -0500 | [diff] [blame] | 86 | Open Browser With URL ${OPENBMC_GUI_URL} |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 87 | Login GUI ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 88 | |
| 89 | |
| 90 | Login GUI |
| 91 | [Documentation] Login to OpenBMC GUI. |
| 92 | [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD} |
| 93 | |
| 94 | # Description of argument(s): |
| 95 | # username The username to be used for login. |
| 96 | # password The password to be used for login. |
| 97 | |
Sridevi Ramesh | fba7a39 | 2025-03-27 10:21:40 -0500 | [diff] [blame] | 98 | Go To ${OPENBMC_GUI_URL} |
rramyasr-in | d1ae7fa | 2023-02-20 11:00:41 -0600 | [diff] [blame] | 99 | Wait Until Element Is Enabled ${xpath_login_username_input} |
| 100 | Input Text ${xpath_login_username_input} ${username} |
| 101 | Input Password ${xpath_login_password_input} ${password} |
shahmo32 | 978f91d | 2023-04-05 20:59:03 +0530 | [diff] [blame] | 102 | Wait Until Element Is Enabled ${xpath_login_button} |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 103 | Click Element ${xpath_login_button} |
Rahul Maheshwari | 7ae30a4 | 2021-02-01 20:02:00 -0600 | [diff] [blame] | 104 | Wait Until Page Contains Overview timeout=60s |
rramyasr-in | 319f27e | 2024-02-23 01:15:40 -0600 | [diff] [blame] | 105 | Wait Until Element Is Not Visible |
| 106 | ... ${xpath_page_loading_progress_bar} timeout=120s |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 107 | |
rramyasr-in | f133e8b | 2025-08-18 06:48:13 -0500 | [diff] [blame] | 108 | |
sarandev3 | 7ef2c44 | 2024-09-27 03:15:32 -0500 | [diff] [blame] | 109 | Launch Browser And Login GUI With Given User |
| 110 | [Documentation] Launch browser and login eBMC with specified user |
| 111 | ... credentials through GUI. |
| 112 | [Arguments] ${user_name} ${user_password} |
| 113 | |
| 114 | # Description of argument(s): |
| 115 | # user_name User name to login to eBMC. |
| 116 | # user_password User password to login to eBMC. |
| 117 | |
Sridevi Ramesh | fba7a39 | 2025-03-27 10:21:40 -0500 | [diff] [blame] | 118 | Open Browser With URL ${OPENBMC_GUI_URL} |
sarandev3 | 7ef2c44 | 2024-09-27 03:15:32 -0500 | [diff] [blame] | 119 | LOGIN GUI ${user_name} ${user_password} |
| 120 | |
rramyasr-in | f133e8b | 2025-08-18 06:48:13 -0500 | [diff] [blame] | 121 | |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 122 | Logout GUI |
| 123 | [Documentation] Logout of OpenBMC GUI. |
| 124 | |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 125 | Click Element ${xpath_root_button_menu} |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 126 | Click Element ${xpath_logout_button} |
| 127 | Wait Until Page Contains Element ${xpath_login_button} |
| 128 | |
| 129 | |
| 130 | Generate Test Error Log |
| 131 | [Documentation] Generate test error log. |
| 132 | |
rramyasr-in | ae6a3c2 | 2022-10-26 05:15:00 -0500 | [diff] [blame] | 133 | BMC Execute Command ${CMD_UNRECOVERABLE_ERROR} |
Anusha Dathatri | 54edcbc | 2020-12-10 04:04:08 -0600 | [diff] [blame] | 134 | |
| 135 | |
| 136 | Set Timezone In Profile Settings Page |
| 137 | [Documentation] Set the given timezone in profile settings page. |
| 138 | [Arguments] ${timezone}=Default |
| 139 | |
| 140 | # Description of argument(s): |
| 141 | # timezone Timezone to select (eg. Default or Browser_offset). |
| 142 | |
| 143 | Wait Until Page Contains Element ${xpath_root_button_menu} |
| 144 | Click Element ${xpath_root_button_menu} |
| 145 | Click Element ${xpath_profile_settings} |
| 146 | Click Element At Coordinates ${xpath_default_UTC} 0 0 |
| 147 | Click Element ${xpath_profile_save_button} |
Ashwini Chandrappa | 90c6a81 | 2021-07-07 04:50:00 -0500 | [diff] [blame] | 148 | |
| 149 | |
| 150 | Refresh GUI |
| 151 | [Documentation] Refresh GUI via refresh button in header. |
| 152 | |
| 153 | Click Element ${xpath_refresh_button} |
rramyasr-in | f133e8b | 2025-08-18 06:48:13 -0500 | [diff] [blame] | 154 | # Waiting for page to load fully after refresh. |
| 155 | Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=120s |
meghagn12345 | f942dae | 2021-08-27 02:53:00 -0500 | [diff] [blame] | 156 | |
| 157 | |
| 158 | Refresh GUI And Verify Element Value |
| 159 | [Documentation] Refresh GUI using refresh button and verify that given element contains expected value. |
| 160 | [Arguments] ${element} ${expected_value} |
| 161 | |
| 162 | # Description of argument(s): |
| 163 | # element Element whose value need to be checked. |
| 164 | # expected_value Expected value of for the given element. |
| 165 | |
| 166 | # Refresh GUI. |
| 167 | |
| 168 | Click Element ${xpath_refresh_button} |
| 169 | |
| 170 | # Check element value and verify that it contains expected value. |
| 171 | ${element_value}= Get Text ${element} |
| 172 | Log ${element_value} |
| 173 | Should Contain ${element_value} ${expected_value} |
| 174 | |
meghagn | 2052fdd | 2021-12-07 02:42:31 -0600 | [diff] [blame] | 175 | |
| 176 | Reboot BMC via GUI |
| 177 | [Documentation] Reboot BMC via GUI. |
| 178 | |
| 179 | Click Element ${xpath_operations_menu} |
| 180 | Click Element ${xpath_reboot_bmc_sub_menu} |
| 181 | Click Button ${xpath_reboot_bmc_button} |
Megha G N | b9ae25a | 2023-01-27 06:25:00 -0600 | [diff] [blame] | 182 | Wait Until Keyword Succeeds 30 sec 10 sec Click Button ${xpath_confirm_bmc_reboot} |
meghagn | 2052fdd | 2021-12-07 02:42:31 -0600 | [diff] [blame] | 183 | Wait Until Keyword Succeeds 2 min 10 sec Is BMC Unpingable |
| 184 | Wait For Host To Ping ${OPENBMC_HOST} 1 min |
Megha G N | 2a31e51 | 2023-01-18 04:23:20 -0600 | [diff] [blame] | 185 | |
| 186 | |
| 187 | Add DNS Servers And Verify |
| 188 | [Documentation] Login to GUI Network page,add DNS server on BMC |
| 189 | ... and verify it via BMC CLI. |
| 190 | [Arguments] ${dns_server} ${expected_status}=Valid format |
| 191 | |
| 192 | # Description of the argument(s): |
| 193 | # dns_server A list of static name server IPs to be |
| 194 | # configured on the BMC. |
| 195 | # expected_status Expected status while adding DNS server address |
| 196 | # (e.g. Invalid format / Field required). |
| 197 | |
| 198 | Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15sec |
| 199 | |
| 200 | Click Button ${xpath_add_dns_ip_address_button} |
| 201 | Input Text ${xpath_input_static_dns} ${dns_server} |
| 202 | Click Button ${xpath_add_button} |
George Keishing | 068ff83 | 2025-06-24 11:38:10 +0530 | [diff] [blame] | 203 | IF '${expected_status}' != 'Valid format' |
| 204 | Page Should Contain ${expected_status} AND Return From Keyword |
| 205 | END |
Megha G N | 2a31e51 | 2023-01-18 04:23:20 -0600 | [diff] [blame] | 206 | |
| 207 | Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=10sec |
| 208 | Wait Until Page Contains ${dns_server} timeout=40sec |
| 209 | |
| 210 | # Check if newly added DNS server is configured on BMC. |
| 211 | ${cli_name_servers}= CLI Get Nameservers |
| 212 | ${cmd_status}= Run Keyword And Return Status |
| 213 | ... List Should Contain Sub List ${cli_name_servers} ${dns_server} |
rramyasr-in | 714ed72 | 2025-05-20 02:19:50 -0500 | [diff] [blame] | 214 | IF '${expected_status}' == '${HTTP_OK}' |
| 215 | Should Be True ${cmd_status} == ${True} |
| 216 | ELSE |
| 217 | Should Not Be True ${cmd_status} |
| 218 | END |
shahmo32 | 978f91d | 2023-04-05 20:59:03 +0530 | [diff] [blame] | 219 | |
| 220 | |
| 221 | Navigate To Server Power Page |
| 222 | [Documentation] Navigate To Server Power Page. |
| 223 | |
| 224 | Click Element ${xpath_power_page} |
| 225 | Wait Until Element Is Not Visible ${xpath_progress_bar} timeout=30 |
| 226 | |
| 227 | |
| 228 | Power Off Server |
| 229 | [Documentation] Powering off server. |
| 230 | |
| 231 | Navigate To Server Power Page |
| 232 | ${present}= Run Keyword And Return Status |
| 233 | ... Element Should Be Visible ${xpath_power_shutdown} |
| 234 | IF ${present} |
| 235 | Click Element ${xpath_power_shutdown} |
| 236 | Click Button ${xpath_confirm} |
| 237 | Wait Until Element Is Visible ${xpath_power_poweron} timeout=60 |
| 238 | ELSE |
| 239 | Log To console Server is already powered Off. |
| 240 | END |
| 241 | |
| 242 | |
| 243 | Power On Server |
| 244 | [Documentation] Powering on server. |
| 245 | |
| 246 | Navigate To Server Power Page |
| 247 | ${present}= Run Keyword And Return Status |
| 248 | ... Element Should Be Visible ${xpath_power_power_on} |
| 249 | IF (${present}) |
| 250 | Click Element ${xpath_power_power_on} |
| 251 | Wait Until Element Is Visible ${xpath_power_shutdown} timeout=60 |
| 252 | ELSE |
| 253 | Log To console Server is already powered On. |
| 254 | END |
| 255 | |
| 256 | |
| 257 | Reboot Server |
| 258 | [Documentation] Rebooting the server. |
| 259 | |
| 260 | Navigate To Server Power Page |
| 261 | ${present}= Run Keyword And Return Status |
| 262 | ... Element Should Be Visible ${xpath_power_reboot} |
| 263 | IF ${present} |
| 264 | Click Element ${xpath_power_reboot} |
| 265 | Wait Until Element Is Visible ${xpath_confirm} timeout=30 |
| 266 | Click Button ${xpath_confirm} |
| 267 | Wait Until Element Is Visible ${xpath_power_reboot} timeout=60 |
| 268 | ELSE |
| 269 | Log To console Server is already powered Off, can't reboot. |
| 270 | END |
rramyasr-in | f133e8b | 2025-08-18 06:48:13 -0500 | [diff] [blame] | 271 | |
| 272 | |
| 273 | Verify Success Message On BMC GUI Page |
| 274 | [Documentation] Perform actions on the GUI and verify that a success message is displayed. |
| 275 | |
| 276 | Wait Until Element Is Visible ${xpath_success_message} timeout=30 |
| 277 | Page Should Contain Element ${xpath_success_message} |
| 278 | Wait Until Element Is Not Visible ${xpath_success_message} timeout=30 |
| 279 | |
| 280 | |
| 281 | Verify Error And Unauthorized Message On GUI |
| 282 | [Documentation] Perform operations on GUI with Readonly user and |
| 283 | ... verify Error and Unauthorized messages. |
| 284 | |
| 285 | Wait Until Element Is Visible ${xpath_error_popup} |
| 286 | Page Should Contain Error |
| 287 | Page Should Contain Unauthorized |
| 288 | Click Element ${xpath_error_popup} |
| 289 | Click Element ${xpath_Unauthorized_popup} |
| 290 | |
| 291 | |
| 292 | Create Readonly User And Login To GUI |
| 293 | [Documentation] Logout current GUI sessions and Created Readonly_user via Redfish |
| 294 | ... and Login BMC GUI with Readonly user |
| 295 | |
| 296 | # Logout current GUI session. |
| 297 | Logout GUI |
| 298 | |
| 299 | # Created readonly_user via redfish and login BMC GUI with readonly user to perfrom test. |
| 300 | Redfish.Login |
| 301 | Redfish Create User readonly_user ${OPENBMC_PASSWORD} ReadOnly ${True} |
| 302 | Login GUI readonly_user ${OPENBMC_PASSWORD} |
| 303 | |
| 304 | |
| 305 | Delete Readonly User And Logout Current GUI Session |
| 306 | [Documentation] Logout current GUI session and delete Readonly user, |
| 307 | ... Perform Login GUI with default user and password. |
| 308 | |
| 309 | # Delete Read-only user and Logout current GUI session. |
| 310 | Logout GUI |
| 311 | Redfish.Delete /redfish/v1/AccountService/Accounts/readonly_user |
| 312 | |
| 313 | # Login BMC GUI with default user. |
| 314 | Launch Browser And Login GUI |
| 315 | |