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 | |
| 19 | ${CMD_INTERNAL_FAILURE} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging |
| 20 | ... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.InternalFailure |
| 21 | ... xyz.openbmc_project.Logging.Entry.Level.Error 0 |
| 22 | |
| 23 | |
| 24 | *** Keywords *** |
| 25 | |
| 26 | Open Browser With URL |
| 27 | [Documentation] Open browser with specified URL and returns browser id. |
| 28 | [Arguments] ${URL} ${browser}=ff ${mode}=${GUI_MODE} |
| 29 | |
| 30 | # Description of argument(s): |
| 31 | # URL Openbmc GUI URL to be open |
| 32 | # (e.g. https://openbmc-test.mybluemix.net/#/login). |
| 33 | # browser Browser used to open above URL |
| 34 | # (e.g. gc for google chrome, ff for firefox). |
| 35 | # mode Browser opening mode(e.g. headless, header). |
| 36 | |
| 37 | ${browser_ID}= Run Keyword If '${mode}' == 'headless' |
| 38 | ... Launch Headless Browser ${URL} ${browser} |
| 39 | ... ELSE Open Browser ${URL} ${browser} |
| 40 | |
| 41 | [Return] ${browser_ID} |
| 42 | |
| 43 | |
| 44 | Launch Header Browser |
| 45 | [Documentation] Open the browser with the URL and |
| 46 | ... login on windows platform. |
| 47 | [Arguments] ${browser_type}=${GUI_BROWSER} |
| 48 | |
| 49 | # Description of argument(s): |
| 50 | # browser_type Type of browser (e.g. "firefox", "chrome", etc.). |
| 51 | |
| 52 | ${BROWSER_ID}= Open Browser ${obmc_gui_url} ${browser_type} |
| 53 | Maximize Browser Window |
| 54 | Set Global Variable ${BROWSER_ID} |
| 55 | |
| 56 | |
| 57 | Launch Headless Browser |
| 58 | [Documentation] Launch headless browser. |
| 59 | [Arguments] ${URL}=${obmc_gui_url} ${browser}=${GUI_BROWSER} |
| 60 | |
| 61 | # Description of argument(s): |
| 62 | # URL Openbmc GUI URL to be open |
| 63 | # (e.g. https://openbmc-test.mybluemix.net/#/login). |
| 64 | # browser Browser to open given URL in headless way |
| 65 | # (e.g. gc for google chrome, ff for firefox). |
| 66 | |
| 67 | Start Virtual Display |
| 68 | ${browser_ID}= Open Browser ${URL} |
| 69 | Set Window Size 1920 1080 |
| 70 | |
| 71 | [Return] ${browser_ID} |
| 72 | |
| 73 | |
| 74 | Launch Browser And Login GUI |
| 75 | [Documentation] Launch browser and login to OpenBMC GUI. |
| 76 | |
| 77 | Open Browser With URL ${obmc_gui_url} |
| 78 | Login GUI ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} |
| 79 | |
| 80 | |
| 81 | Login GUI |
| 82 | [Documentation] Login to OpenBMC GUI. |
| 83 | [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD} |
| 84 | |
| 85 | # Description of argument(s): |
| 86 | # username The username to be used for login. |
| 87 | # password The password to be used for login. |
| 88 | |
| 89 | Go To ${obmc_gui_url} |
| 90 | Wait Until Element Is Enabled ${xpath_textbox_username} |
| 91 | Input Text ${xpath_textbox_username} ${username} |
| 92 | Input Password ${xpath_textbox_password} ${password} |
| 93 | Click Element ${xpath_login_button} |
Rahul Maheshwari | 7ae30a4 | 2021-02-01 20:02:00 -0600 | [diff] [blame] | 94 | Wait Until Page Contains Overview timeout=60s |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 95 | |
| 96 | |
| 97 | Logout GUI |
| 98 | [Documentation] Logout of OpenBMC GUI. |
| 99 | |
shrsuman123 | a9d9341 | 2021-07-13 04:06:05 -0500 | [diff] [blame] | 100 | Click Element ${xpath_root_button_menu} |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 101 | Click Element ${xpath_logout_button} |
| 102 | Wait Until Page Contains Element ${xpath_login_button} |
| 103 | |
| 104 | |
| 105 | Generate Test Error Log |
| 106 | [Documentation] Generate test error log. |
| 107 | |
| 108 | BMC Execute Command ${CMD_INTERNAL_FAILURE} |
Anusha Dathatri | 54edcbc | 2020-12-10 04:04:08 -0600 | [diff] [blame] | 109 | |
| 110 | |
| 111 | Set Timezone In Profile Settings Page |
| 112 | [Documentation] Set the given timezone in profile settings page. |
| 113 | [Arguments] ${timezone}=Default |
| 114 | |
| 115 | # Description of argument(s): |
| 116 | # timezone Timezone to select (eg. Default or Browser_offset). |
| 117 | |
| 118 | Wait Until Page Contains Element ${xpath_root_button_menu} |
| 119 | Click Element ${xpath_root_button_menu} |
| 120 | Click Element ${xpath_profile_settings} |
| 121 | Click Element At Coordinates ${xpath_default_UTC} 0 0 |
| 122 | Click Element ${xpath_profile_save_button} |
Ashwini Chandrappa | 90c6a81 | 2021-07-07 04:50:00 -0500 | [diff] [blame] | 123 | |
| 124 | |
| 125 | Refresh GUI |
| 126 | [Documentation] Refresh GUI via refresh button in header. |
| 127 | |
| 128 | Click Element ${xpath_refresh_button} |
| 129 | # Added delay for page to load fully after refresh. |
| 130 | Sleep 5s |
meghagn12345 | f942dae | 2021-08-27 02:53:00 -0500 | [diff] [blame] | 131 | |
| 132 | |
| 133 | Refresh GUI And Verify Element Value |
| 134 | [Documentation] Refresh GUI using refresh button and verify that given element contains expected value. |
| 135 | [Arguments] ${element} ${expected_value} |
| 136 | |
| 137 | # Description of argument(s): |
| 138 | # element Element whose value need to be checked. |
| 139 | # expected_value Expected value of for the given element. |
| 140 | |
| 141 | # Refresh GUI. |
| 142 | |
| 143 | Click Element ${xpath_refresh_button} |
| 144 | |
| 145 | # Check element value and verify that it contains expected value. |
| 146 | ${element_value}= Get Text ${element} |
| 147 | Log ${element_value} |
| 148 | Should Contain ${element_value} ${expected_value} |
| 149 | |
meghagn | 2052fdd | 2021-12-07 02:42:31 -0600 | [diff] [blame] | 150 | |
| 151 | Reboot BMC via GUI |
| 152 | [Documentation] Reboot BMC via GUI. |
| 153 | |
| 154 | Click Element ${xpath_operations_menu} |
| 155 | Click Element ${xpath_reboot_bmc_sub_menu} |
| 156 | Click Button ${xpath_reboot_bmc_button} |
| 157 | Click Button ${xpath_confirm_bmc_reboot} |
| 158 | Wait Until Keyword Succeeds 2 min 10 sec Is BMC Unpingable |
| 159 | Wait For Host To Ping ${OPENBMC_HOST} 1 min |