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 *** |
| 12 | ${obmc_gui_url} https://${OPENBMC_HOST} |
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 | |
| 38 | ${browser_ID}= Run Keyword If '${mode}' == 'headless' |
| 39 | ... Launch Headless Browser ${URL} ${browser} |
| 40 | ... ELSE Open Browser ${URL} ${browser} |
| 41 | |
| 42 | [Return] ${browser_ID} |
| 43 | |
| 44 | |
| 45 | Launch Header Browser |
| 46 | [Documentation] Open the browser with the URL and |
| 47 | ... login on windows platform. |
| 48 | [Arguments] ${browser_type}=${GUI_BROWSER} |
| 49 | |
| 50 | # Description of argument(s): |
| 51 | # browser_type Type of browser (e.g. "firefox", "chrome", etc.). |
| 52 | |
| 53 | ${BROWSER_ID}= Open Browser ${obmc_gui_url} ${browser_type} |
| 54 | Maximize Browser Window |
| 55 | Set Global Variable ${BROWSER_ID} |
| 56 | |
| 57 | |
| 58 | Launch Headless Browser |
| 59 | [Documentation] Launch headless browser. |
| 60 | [Arguments] ${URL}=${obmc_gui_url} ${browser}=${GUI_BROWSER} |
| 61 | |
| 62 | # Description of argument(s): |
| 63 | # URL Openbmc GUI URL to be open |
| 64 | # (e.g. https://openbmc-test.mybluemix.net/#/login). |
| 65 | # browser Browser to open given URL in headless way |
| 66 | # (e.g. gc for google chrome, ff for firefox). |
| 67 | |
| 68 | Start Virtual Display |
| 69 | ${browser_ID}= Open Browser ${URL} |
| 70 | Set Window Size 1920 1080 |
| 71 | |
| 72 | [Return] ${browser_ID} |
| 73 | |
| 74 | |
| 75 | Launch Browser And Login GUI |
rramyasr-in | b874c31 | 2023-02-16 01:33:37 -0600 | [diff] [blame] | 76 | [Documentation] Launch browser and login to OpenBMC GUI, retry 2 attempts |
| 77 | ... in 1 minute time. |
| 78 | |
| 79 | Wait Until Keyword Succeeds 130 sec 65 sec Retry Browser Login Attempts |
| 80 | |
| 81 | |
| 82 | Retry Browser Login Attempts |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 83 | [Documentation] Launch browser and login to OpenBMC GUI. |
| 84 | |
| 85 | Open Browser With URL ${obmc_gui_url} |
| 86 | Login GUI ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 87 | |
| 88 | |
| 89 | Login GUI |
| 90 | [Documentation] Login to OpenBMC GUI. |
| 91 | [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD} |
| 92 | |
| 93 | # Description of argument(s): |
| 94 | # username The username to be used for login. |
| 95 | # password The password to be used for login. |
| 96 | |
| 97 | Go To ${obmc_gui_url} |
rramyasr-in | d1ae7fa | 2023-02-20 11:00:41 -0600 | [diff] [blame] | 98 | Wait Until Element Is Enabled ${xpath_login_username_input} |
| 99 | Input Text ${xpath_login_username_input} ${username} |
| 100 | Input Password ${xpath_login_password_input} ${password} |
shahmo32 | 978f91d | 2023-04-05 20:59:03 +0530 | [diff] [blame] | 101 | Wait Until Element Is Enabled ${xpath_login_button} |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 102 | Click Element ${xpath_login_button} |
Rahul Maheshwari | 7ae30a4 | 2021-02-01 20:02:00 -0600 | [diff] [blame] | 103 | Wait Until Page Contains Overview timeout=60s |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 104 | |
| 105 | |
| 106 | Logout GUI |
| 107 | [Documentation] Logout of OpenBMC GUI. |
| 108 | |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 109 | Click Element ${xpath_root_button_menu} |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 110 | Click Element ${xpath_logout_button} |
| 111 | Wait Until Page Contains Element ${xpath_login_button} |
| 112 | |
| 113 | |
| 114 | Generate Test Error Log |
| 115 | [Documentation] Generate test error log. |
| 116 | |
rramyasr-in | ae6a3c2 | 2022-10-26 05:15:00 -0500 | [diff] [blame] | 117 | BMC Execute Command ${CMD_UNRECOVERABLE_ERROR} |
Anusha Dathatri | 54edcbc | 2020-12-10 04:04:08 -0600 | [diff] [blame] | 118 | |
| 119 | |
| 120 | Set Timezone In Profile Settings Page |
| 121 | [Documentation] Set the given timezone in profile settings page. |
| 122 | [Arguments] ${timezone}=Default |
| 123 | |
| 124 | # Description of argument(s): |
| 125 | # timezone Timezone to select (eg. Default or Browser_offset). |
| 126 | |
| 127 | Wait Until Page Contains Element ${xpath_root_button_menu} |
| 128 | Click Element ${xpath_root_button_menu} |
| 129 | Click Element ${xpath_profile_settings} |
| 130 | Click Element At Coordinates ${xpath_default_UTC} 0 0 |
| 131 | Click Element ${xpath_profile_save_button} |
Ashwini Chandrappa | 90c6a81 | 2021-07-07 04:50:00 -0500 | [diff] [blame] | 132 | |
| 133 | |
| 134 | Refresh GUI |
| 135 | [Documentation] Refresh GUI via refresh button in header. |
| 136 | |
| 137 | Click Element ${xpath_refresh_button} |
| 138 | # Added delay for page to load fully after refresh. |
| 139 | Sleep 5s |
meghagn12345 | f942dae | 2021-08-27 02:53:00 -0500 | [diff] [blame] | 140 | |
| 141 | |
| 142 | Refresh GUI And Verify Element Value |
| 143 | [Documentation] Refresh GUI using refresh button and verify that given element contains expected value. |
| 144 | [Arguments] ${element} ${expected_value} |
| 145 | |
| 146 | # Description of argument(s): |
| 147 | # element Element whose value need to be checked. |
| 148 | # expected_value Expected value of for the given element. |
| 149 | |
| 150 | # Refresh GUI. |
| 151 | |
| 152 | Click Element ${xpath_refresh_button} |
| 153 | |
| 154 | # Check element value and verify that it contains expected value. |
| 155 | ${element_value}= Get Text ${element} |
| 156 | Log ${element_value} |
| 157 | Should Contain ${element_value} ${expected_value} |
| 158 | |
meghagn | 2052fdd | 2021-12-07 02:42:31 -0600 | [diff] [blame] | 159 | |
| 160 | Reboot BMC via GUI |
| 161 | [Documentation] Reboot BMC via GUI. |
| 162 | |
| 163 | Click Element ${xpath_operations_menu} |
| 164 | Click Element ${xpath_reboot_bmc_sub_menu} |
| 165 | Click Button ${xpath_reboot_bmc_button} |
Megha G N | b9ae25a | 2023-01-27 06:25:00 -0600 | [diff] [blame] | 166 | 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] | 167 | Wait Until Keyword Succeeds 2 min 10 sec Is BMC Unpingable |
| 168 | Wait For Host To Ping ${OPENBMC_HOST} 1 min |
Megha G N | 2a31e51 | 2023-01-18 04:23:20 -0600 | [diff] [blame] | 169 | |
| 170 | |
| 171 | Add DNS Servers And Verify |
| 172 | [Documentation] Login to GUI Network page,add DNS server on BMC |
| 173 | ... and verify it via BMC CLI. |
| 174 | [Arguments] ${dns_server} ${expected_status}=Valid format |
| 175 | |
| 176 | # Description of the argument(s): |
| 177 | # dns_server A list of static name server IPs to be |
| 178 | # configured on the BMC. |
| 179 | # expected_status Expected status while adding DNS server address |
| 180 | # (e.g. Invalid format / Field required). |
| 181 | |
| 182 | Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15sec |
| 183 | |
| 184 | Click Button ${xpath_add_dns_ip_address_button} |
| 185 | Input Text ${xpath_input_static_dns} ${dns_server} |
| 186 | Click Button ${xpath_add_button} |
| 187 | Run keyword if '${expected_status}' != 'Valid format' |
| 188 | ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword |
| 189 | |
| 190 | Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=10sec |
| 191 | Wait Until Page Contains ${dns_server} timeout=40sec |
| 192 | |
| 193 | # Check if newly added DNS server is configured on BMC. |
| 194 | ${cli_name_servers}= CLI Get Nameservers |
| 195 | ${cmd_status}= Run Keyword And Return Status |
| 196 | ... List Should Contain Sub List ${cli_name_servers} ${dns_server} |
shahmo32 | 978f91d | 2023-04-05 20:59:03 +0530 | [diff] [blame] | 197 | |
| 198 | |
| 199 | Navigate To Server Power Page |
| 200 | [Documentation] Navigate To Server Power Page. |
| 201 | |
| 202 | Click Element ${xpath_power_page} |
| 203 | Wait Until Element Is Not Visible ${xpath_progress_bar} timeout=30 |
| 204 | |
| 205 | |
| 206 | Power Off Server |
| 207 | [Documentation] Powering off server. |
| 208 | |
| 209 | Navigate To Server Power Page |
| 210 | ${present}= Run Keyword And Return Status |
| 211 | ... Element Should Be Visible ${xpath_power_shutdown} |
| 212 | IF ${present} |
| 213 | Click Element ${xpath_power_shutdown} |
| 214 | Click Button ${xpath_confirm} |
| 215 | Wait Until Element Is Visible ${xpath_power_poweron} timeout=60 |
| 216 | ELSE |
| 217 | Log To console Server is already powered Off. |
| 218 | END |
| 219 | |
| 220 | |
| 221 | Power On Server |
| 222 | [Documentation] Powering on server. |
| 223 | |
| 224 | Navigate To Server Power Page |
| 225 | ${present}= Run Keyword And Return Status |
| 226 | ... Element Should Be Visible ${xpath_power_power_on} |
| 227 | IF (${present}) |
| 228 | Click Element ${xpath_power_power_on} |
| 229 | Wait Until Element Is Visible ${xpath_power_shutdown} timeout=60 |
| 230 | ELSE |
| 231 | Log To console Server is already powered On. |
| 232 | END |
| 233 | |
| 234 | |
| 235 | Reboot Server |
| 236 | [Documentation] Rebooting the server. |
| 237 | |
| 238 | Navigate To Server Power Page |
| 239 | ${present}= Run Keyword And Return Status |
| 240 | ... Element Should Be Visible ${xpath_power_reboot} |
| 241 | IF ${present} |
| 242 | Click Element ${xpath_power_reboot} |
| 243 | Wait Until Element Is Visible ${xpath_confirm} timeout=30 |
| 244 | Click Button ${xpath_confirm} |
| 245 | Wait Until Element Is Visible ${xpath_power_reboot} timeout=60 |
| 246 | ELSE |
| 247 | Log To console Server is already powered Off, can't reboot. |
| 248 | END |
| 249 | |
| 250 | |