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} |
| 13 | |
George Keishing | 4d4ef99 | 2021-01-28 09:56:53 -0600 | [diff] [blame] | 14 | # Default GUI browser and mode is set to "Firefox" and "headless" |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 15 | # respectively here. |
| 16 | ${GUI_BROWSER} ff |
| 17 | ${GUI_MODE} headless |
| 18 | |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 19 | |
| 20 | *** Keywords *** |
| 21 | |
| 22 | Open Browser With URL |
| 23 | [Documentation] Open browser with specified URL and returns browser id. |
| 24 | [Arguments] ${URL} ${browser}=ff ${mode}=${GUI_MODE} |
| 25 | |
| 26 | # Description of argument(s): |
| 27 | # URL Openbmc GUI URL to be open |
| 28 | # (e.g. https://openbmc-test.mybluemix.net/#/login). |
| 29 | # browser Browser used to open above URL |
| 30 | # (e.g. gc for google chrome, ff for firefox). |
| 31 | # mode Browser opening mode(e.g. headless, header). |
| 32 | |
| 33 | ${browser_ID}= Run Keyword If '${mode}' == 'headless' |
| 34 | ... Launch Headless Browser ${URL} ${browser} |
| 35 | ... ELSE Open Browser ${URL} ${browser} |
| 36 | |
| 37 | [Return] ${browser_ID} |
| 38 | |
| 39 | |
| 40 | Launch Header Browser |
| 41 | [Documentation] Open the browser with the URL and |
| 42 | ... login on windows platform. |
| 43 | [Arguments] ${browser_type}=${GUI_BROWSER} |
| 44 | |
| 45 | # Description of argument(s): |
| 46 | # browser_type Type of browser (e.g. "firefox", "chrome", etc.). |
| 47 | |
| 48 | ${BROWSER_ID}= Open Browser ${obmc_gui_url} ${browser_type} |
| 49 | Maximize Browser Window |
| 50 | Set Global Variable ${BROWSER_ID} |
| 51 | |
| 52 | |
| 53 | Launch Headless Browser |
| 54 | [Documentation] Launch headless browser. |
| 55 | [Arguments] ${URL}=${obmc_gui_url} ${browser}=${GUI_BROWSER} |
| 56 | |
| 57 | # Description of argument(s): |
| 58 | # URL Openbmc GUI URL to be open |
| 59 | # (e.g. https://openbmc-test.mybluemix.net/#/login). |
| 60 | # browser Browser to open given URL in headless way |
| 61 | # (e.g. gc for google chrome, ff for firefox). |
| 62 | |
| 63 | Start Virtual Display |
| 64 | ${browser_ID}= Open Browser ${URL} |
| 65 | Set Window Size 1920 1080 |
| 66 | |
| 67 | [Return] ${browser_ID} |
| 68 | |
| 69 | |
| 70 | Launch Browser And Login GUI |
rramyasr-in | b874c31 | 2023-02-16 01:33:37 -0600 | [diff] [blame] | 71 | [Documentation] Launch browser and login to OpenBMC GUI, retry 2 attempts |
| 72 | ... in 1 minute time. |
| 73 | |
| 74 | Wait Until Keyword Succeeds 130 sec 65 sec Retry Browser Login Attempts |
| 75 | |
| 76 | |
| 77 | Retry Browser Login Attempts |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 78 | [Documentation] Launch browser and login to OpenBMC GUI. |
| 79 | |
| 80 | Open Browser With URL ${obmc_gui_url} |
| 81 | Login GUI ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 82 | |
| 83 | |
| 84 | Login GUI |
| 85 | [Documentation] Login to OpenBMC GUI. |
| 86 | [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD} |
| 87 | |
| 88 | # Description of argument(s): |
| 89 | # username The username to be used for login. |
| 90 | # password The password to be used for login. |
| 91 | |
| 92 | Go To ${obmc_gui_url} |
rramyasr-in | d1ae7fa | 2023-02-20 11:00:41 -0600 | [diff] [blame] | 93 | Wait Until Element Is Enabled ${xpath_login_username_input} |
| 94 | Input Text ${xpath_login_username_input} ${username} |
| 95 | Input Password ${xpath_login_password_input} ${password} |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 96 | Click Element ${xpath_login_button} |
Rahul Maheshwari | 7ae30a4 | 2021-02-01 20:02:00 -0600 | [diff] [blame] | 97 | Wait Until Page Contains Overview timeout=60s |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 98 | |
| 99 | |
| 100 | Logout GUI |
| 101 | [Documentation] Logout of OpenBMC GUI. |
| 102 | |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 103 | Click Element ${xpath_root_button_menu} |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 104 | Click Element ${xpath_logout_button} |
| 105 | Wait Until Page Contains Element ${xpath_login_button} |
| 106 | |
| 107 | |
| 108 | Generate Test Error Log |
| 109 | [Documentation] Generate test error log. |
| 110 | |
rramyasr-in | ae6a3c2 | 2022-10-26 05:15:00 -0500 | [diff] [blame] | 111 | BMC Execute Command ${CMD_UNRECOVERABLE_ERROR} |
Anusha Dathatri | 54edcbc | 2020-12-10 04:04:08 -0600 | [diff] [blame] | 112 | |
| 113 | |
| 114 | Set Timezone In Profile Settings Page |
| 115 | [Documentation] Set the given timezone in profile settings page. |
| 116 | [Arguments] ${timezone}=Default |
| 117 | |
| 118 | # Description of argument(s): |
| 119 | # timezone Timezone to select (eg. Default or Browser_offset). |
| 120 | |
| 121 | Wait Until Page Contains Element ${xpath_root_button_menu} |
| 122 | Click Element ${xpath_root_button_menu} |
| 123 | Click Element ${xpath_profile_settings} |
| 124 | Click Element At Coordinates ${xpath_default_UTC} 0 0 |
| 125 | Click Element ${xpath_profile_save_button} |
Ashwini Chandrappa | 90c6a81 | 2021-07-07 04:50:00 -0500 | [diff] [blame] | 126 | |
| 127 | |
| 128 | Refresh GUI |
| 129 | [Documentation] Refresh GUI via refresh button in header. |
| 130 | |
| 131 | Click Element ${xpath_refresh_button} |
| 132 | # Added delay for page to load fully after refresh. |
| 133 | Sleep 5s |
meghagn12345 | f942dae | 2021-08-27 02:53:00 -0500 | [diff] [blame] | 134 | |
| 135 | |
| 136 | Refresh GUI And Verify Element Value |
| 137 | [Documentation] Refresh GUI using refresh button and verify that given element contains expected value. |
| 138 | [Arguments] ${element} ${expected_value} |
| 139 | |
| 140 | # Description of argument(s): |
| 141 | # element Element whose value need to be checked. |
| 142 | # expected_value Expected value of for the given element. |
| 143 | |
| 144 | # Refresh GUI. |
| 145 | |
| 146 | Click Element ${xpath_refresh_button} |
| 147 | |
| 148 | # Check element value and verify that it contains expected value. |
| 149 | ${element_value}= Get Text ${element} |
| 150 | Log ${element_value} |
| 151 | Should Contain ${element_value} ${expected_value} |
| 152 | |
meghagn | 2052fdd | 2021-12-07 02:42:31 -0600 | [diff] [blame] | 153 | |
| 154 | Reboot BMC via GUI |
| 155 | [Documentation] Reboot BMC via GUI. |
| 156 | |
| 157 | Click Element ${xpath_operations_menu} |
| 158 | Click Element ${xpath_reboot_bmc_sub_menu} |
| 159 | Click Button ${xpath_reboot_bmc_button} |
Megha G N | b9ae25a | 2023-01-27 06:25:00 -0600 | [diff] [blame] | 160 | 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] | 161 | Wait Until Keyword Succeeds 2 min 10 sec Is BMC Unpingable |
| 162 | Wait For Host To Ping ${OPENBMC_HOST} 1 min |
Megha G N | 2a31e51 | 2023-01-18 04:23:20 -0600 | [diff] [blame] | 163 | |
| 164 | |
| 165 | Add DNS Servers And Verify |
| 166 | [Documentation] Login to GUI Network page,add DNS server on BMC |
| 167 | ... and verify it via BMC CLI. |
| 168 | [Arguments] ${dns_server} ${expected_status}=Valid format |
| 169 | |
| 170 | # Description of the argument(s): |
| 171 | # dns_server A list of static name server IPs to be |
| 172 | # configured on the BMC. |
| 173 | # expected_status Expected status while adding DNS server address |
| 174 | # (e.g. Invalid format / Field required). |
| 175 | |
| 176 | Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15sec |
| 177 | |
| 178 | Click Button ${xpath_add_dns_ip_address_button} |
| 179 | Input Text ${xpath_input_static_dns} ${dns_server} |
| 180 | Click Button ${xpath_add_button} |
| 181 | Run keyword if '${expected_status}' != 'Valid format' |
| 182 | ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword |
| 183 | |
| 184 | Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=10sec |
| 185 | Wait Until Page Contains ${dns_server} timeout=40sec |
| 186 | |
| 187 | # Check if newly added DNS server is configured on BMC. |
| 188 | ${cli_name_servers}= CLI Get Nameservers |
| 189 | ${cmd_status}= Run Keyword And Return Status |
| 190 | ... List Should Contain Sub List ${cli_name_servers} ${dns_server} |