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 |
| 71 | [Documentation] Launch browser and login to OpenBMC GUI. |
| 72 | |
| 73 | Open Browser With URL ${obmc_gui_url} |
| 74 | Login GUI ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 75 | |
| 76 | |
| 77 | Login GUI |
| 78 | [Documentation] Login to OpenBMC GUI. |
| 79 | [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD} |
| 80 | |
| 81 | # Description of argument(s): |
| 82 | # username The username to be used for login. |
| 83 | # password The password to be used for login. |
| 84 | |
| 85 | Go To ${obmc_gui_url} |
| 86 | Wait Until Element Is Enabled ${xpath_textbox_username} |
| 87 | Input Text ${xpath_textbox_username} ${username} |
| 88 | Input Password ${xpath_textbox_password} ${password} |
| 89 | Click Element ${xpath_login_button} |
Rahul Maheshwari | 7ae30a4 | 2021-02-01 20:02:00 -0600 | [diff] [blame] | 90 | Wait Until Page Contains Overview timeout=60s |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 91 | |
| 92 | |
| 93 | Logout GUI |
| 94 | [Documentation] Logout of OpenBMC GUI. |
| 95 | |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 96 | Click Element ${xpath_root_button_menu} |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 97 | Click Element ${xpath_logout_button} |
| 98 | Wait Until Page Contains Element ${xpath_login_button} |
| 99 | |
| 100 | |
| 101 | Generate Test Error Log |
| 102 | [Documentation] Generate test error log. |
| 103 | |
rramyasr-in | ae6a3c2 | 2022-10-26 05:15:00 -0500 | [diff] [blame] | 104 | BMC Execute Command ${CMD_UNRECOVERABLE_ERROR} |
Anusha Dathatri | 54edcbc | 2020-12-10 04:04:08 -0600 | [diff] [blame] | 105 | |
| 106 | |
| 107 | Set Timezone In Profile Settings Page |
| 108 | [Documentation] Set the given timezone in profile settings page. |
| 109 | [Arguments] ${timezone}=Default |
| 110 | |
| 111 | # Description of argument(s): |
| 112 | # timezone Timezone to select (eg. Default or Browser_offset). |
| 113 | |
| 114 | Wait Until Page Contains Element ${xpath_root_button_menu} |
| 115 | Click Element ${xpath_root_button_menu} |
| 116 | Click Element ${xpath_profile_settings} |
| 117 | Click Element At Coordinates ${xpath_default_UTC} 0 0 |
| 118 | Click Element ${xpath_profile_save_button} |
Ashwini Chandrappa | 90c6a81 | 2021-07-07 04:50:00 -0500 | [diff] [blame] | 119 | |
| 120 | |
| 121 | Refresh GUI |
| 122 | [Documentation] Refresh GUI via refresh button in header. |
| 123 | |
| 124 | Click Element ${xpath_refresh_button} |
| 125 | # Added delay for page to load fully after refresh. |
| 126 | Sleep 5s |
meghagn12345 | f942dae | 2021-08-27 02:53:00 -0500 | [diff] [blame] | 127 | |
| 128 | |
| 129 | Refresh GUI And Verify Element Value |
| 130 | [Documentation] Refresh GUI using refresh button and verify that given element contains expected value. |
| 131 | [Arguments] ${element} ${expected_value} |
| 132 | |
| 133 | # Description of argument(s): |
| 134 | # element Element whose value need to be checked. |
| 135 | # expected_value Expected value of for the given element. |
| 136 | |
| 137 | # Refresh GUI. |
| 138 | |
| 139 | Click Element ${xpath_refresh_button} |
| 140 | |
| 141 | # Check element value and verify that it contains expected value. |
| 142 | ${element_value}= Get Text ${element} |
| 143 | Log ${element_value} |
| 144 | Should Contain ${element_value} ${expected_value} |
| 145 | |
meghagn | 2052fdd | 2021-12-07 02:42:31 -0600 | [diff] [blame] | 146 | |
| 147 | Reboot BMC via GUI |
| 148 | [Documentation] Reboot BMC via GUI. |
| 149 | |
| 150 | Click Element ${xpath_operations_menu} |
| 151 | Click Element ${xpath_reboot_bmc_sub_menu} |
| 152 | Click Button ${xpath_reboot_bmc_button} |
Megha G N | b9ae25a | 2023-01-27 06:25:00 -0600 | [diff] [blame] | 153 | 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] | 154 | Wait Until Keyword Succeeds 2 min 10 sec Is BMC Unpingable |
| 155 | Wait For Host To Ping ${OPENBMC_HOST} 1 min |
Megha G N | 2a31e51 | 2023-01-18 04:23:20 -0600 | [diff] [blame] | 156 | |
| 157 | |
| 158 | Add DNS Servers And Verify |
| 159 | [Documentation] Login to GUI Network page,add DNS server on BMC |
| 160 | ... and verify it via BMC CLI. |
| 161 | [Arguments] ${dns_server} ${expected_status}=Valid format |
| 162 | |
| 163 | # Description of the argument(s): |
| 164 | # dns_server A list of static name server IPs to be |
| 165 | # configured on the BMC. |
| 166 | # expected_status Expected status while adding DNS server address |
| 167 | # (e.g. Invalid format / Field required). |
| 168 | |
| 169 | Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15sec |
| 170 | |
| 171 | Click Button ${xpath_add_dns_ip_address_button} |
| 172 | Input Text ${xpath_input_static_dns} ${dns_server} |
| 173 | Click Button ${xpath_add_button} |
| 174 | Run keyword if '${expected_status}' != 'Valid format' |
| 175 | ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword |
| 176 | |
| 177 | Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=10sec |
| 178 | Wait Until Page Contains ${dns_server} timeout=40sec |
| 179 | |
| 180 | # Check if newly added DNS server is configured on BMC. |
| 181 | ${cli_name_servers}= CLI Get Nameservers |
| 182 | ${cmd_status}= Run Keyword And Return Status |
| 183 | ... List Should Contain Sub List ${cli_name_servers} ${dns_server} |