Sathyajith M S | e6956c0 | 2017-08-16 01:50:17 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This is a resource file of OpenBMC ASMI It contains the |
| 3 | ... user-defined keywords which are available to all gui modules |
| 4 | |
| 5 | Library String |
| 6 | Library Collections |
| 7 | Library DateTime |
| 8 | Library XvfbRobot |
| 9 | Library OperatingSystem |
| 10 | Library Selenium2Library 120 120 |
| 11 | Library AngularJSLibrary |
| 12 | Library SSHLibrary 30 Seconds |
| 13 | Library Process |
| 14 | Library supporting_libs.py |
| 15 | Library ../../../lib/gen_print.py |
| 16 | Library ../../../lib/gen_robot_print.py |
| 17 | Library ../../../lib/gen_valid.py |
| 18 | Library ../../../lib/gen_robot_ssh.py |
| 19 | Library ../../../lib/bmc_ssh_utils.py |
Sathyajith M S | e6956c0 | 2017-08-16 01:50:17 -0500 | [diff] [blame] | 20 | Variables ../data/resource_variables.py |
Sivas SRR | 40c1f04 | 2018-01-05 11:00:02 -0600 | [diff] [blame^] | 21 | Resource ../../../lib/resource.txt |
Sathyajith M S | e6956c0 | 2017-08-16 01:50:17 -0500 | [diff] [blame] | 22 | |
| 23 | *** Variables *** |
| 24 | # TO Do: Change the variable once the code finally switches to the OpenBMC. |
Sivas SRR | 40c1f04 | 2018-01-05 11:00:02 -0600 | [diff] [blame^] | 25 | ${openbmc_gui_url} http://localhost:8080/#/login |
Sathyajith M S | e6956c0 | 2017-08-16 01:50:17 -0500 | [diff] [blame] | 26 | # Default Browser. |
| 27 | ${default_browser} chrome |
| 28 | |
| 29 | *** Keywords *** |
| 30 | Launch OpenBMC GUI Browser |
| 31 | [Documentation] Launch the OpenBMC GUI URL on a browser. |
| 32 | # By default uses headless mode, otherwise, the GUI browser. |
| 33 | ${op_system}= Get Operating System |
| 34 | Run Keyword If '${op_system}' == 'windows' |
| 35 | ... Launch Browser in Windows Platform |
| 36 | ... ELSE |
| 37 | ... Launch Headless Browser |
| 38 | |
| 39 | Get Operating System |
| 40 | [Documentation] Identify platform/OS. |
| 41 | ${curdir_lower_case}= Convert To Lowercase ${CURDIR} |
| 42 | ${windows_platform}= Run Keyword And Return Status |
| 43 | ... Should Contain ${curdir_lower_case} c:\ |
| 44 | ${op_system}= Run Keyword If '${windows_platform}' == 'True' |
| 45 | ... Set Variable windows |
| 46 | ... ELSE |
| 47 | ... Set Variable linux |
| 48 | [Return] ${op_system} |
| 49 | |
| 50 | Launch Browser in Windows Platform |
| 51 | [Documentation] Open the browse with the URL and login on windows platform. |
Sivas SRR | 40c1f04 | 2018-01-05 11:00:02 -0600 | [diff] [blame^] | 52 | ${BROWSER_ID}= Open Browser ${openbmc_gui_url} ${default_browser} |
Sathyajith M S | e6956c0 | 2017-08-16 01:50:17 -0500 | [diff] [blame] | 53 | Maximize Browser Window |
| 54 | Set Global Variable ${BROWSER_ID} |
| 55 | |
| 56 | Launch Headless Browser |
| 57 | [Documentation] Launch headless browser. |
| 58 | Start Virtual Display 1920 1080 |
Sivas SRR | 40c1f04 | 2018-01-05 11:00:02 -0600 | [diff] [blame^] | 59 | ${BROWSER_ID}= Open Browser ${openbmc_gui_url} |
Sathyajith M S | e6956c0 | 2017-08-16 01:50:17 -0500 | [diff] [blame] | 60 | Set Global Variable ${BROWSER_ID} |
| 61 | Set Window Size 1920 1080 |
| 62 | |
| 63 | OpenBMC Test Setup |
| 64 | [Documentation] Verify all the preconditions to be tested. |
| 65 | Rprint Timen ${TEST NAME}:${TESTDOCUMENTATION} ==> [STARTED] |
| 66 | Print Dashes 0 100 1 = |
| 67 | Login OpenBMC GUI |
| 68 | |
| 69 | Login OpenBMC GUI |
| 70 | [Documentation] Perform login to open BMC GUI. |
| 71 | [Arguments] ${username}=${OPENBMC_USERNAME} |
| 72 | ... ${password}=${OPENBMC_PASSWORD} |
| 73 | # Description of argument(s): |
| 74 | # username The username. |
| 75 | # password The password. |
Sivas SRR | 40c1f04 | 2018-01-05 11:00:02 -0600 | [diff] [blame^] | 76 | |
| 77 | Register Keyword To Run On Failure Reload Page |
| 78 | Log ${openbmc_gui_url} |
| 79 | Open Browser With URL ${openbmc_gui_url} gc |
| 80 | Page Should Contain Button login__submit |
| 81 | # Wait Until Page Contains Element ${obmc_uname} |
| 82 | Input Text ${xpath_openbmc_ip} ${OPENBMC_HOST} |
Sathyajith M S | e6956c0 | 2017-08-16 01:50:17 -0500 | [diff] [blame] | 83 | Input Text ${xpath_textbox_username} ${username} |
| 84 | Input Password ${xpath_textbox_password} ${password} |
Sivas SRR | 40c1f04 | 2018-01-05 11:00:02 -0600 | [diff] [blame^] | 85 | Click Element login__submit |
Sathyajith M S | e6956c0 | 2017-08-16 01:50:17 -0500 | [diff] [blame] | 86 | Wait Until Element Is Enabled ${xpath_button_logout} |
Sivas SRR | 40c1f04 | 2018-01-05 11:00:02 -0600 | [diff] [blame^] | 87 | Page Should Contain Server information |
Sathyajith M S | e6956c0 | 2017-08-16 01:50:17 -0500 | [diff] [blame] | 88 | |
| 89 | LogOut OpenBMC GUI |
| 90 | [Documentation] Log out of OpenBMC GUI. |
| 91 | SSHLibrary.Close All Connections |
| 92 | click button ${xpath_button_logout} |
| 93 | Wait Until Page Contains Element ${xpath_button_login} |
| 94 | |
| 95 | OpenBMC Test Closure |
| 96 | [Documentation] Do final closure activities of test case execution. |
| 97 | Rprint Pgm Footer |
| 98 | Print Dashes 0 100 1 = |
| 99 | LogOut OpenBMC GUI |
| 100 | |
Sivas SRR | 40c1f04 | 2018-01-05 11:00:02 -0600 | [diff] [blame^] | 101 | Open Browser With URL |
| 102 | [Documentation] Open browser with specified URL and returns browser id. |
| 103 | [Arguments] ${URL} ${browser}=gc |
| 104 | # Description of argument(s): |
| 105 | # URL Openbmc GUI URL to be open |
| 106 | # (e.g. https://openbmc-test.mybluemix.net/#/login ) |
| 107 | # browser browser used to open above URL |
| 108 | # (e.g. gc for google chrome, ff for firefox) |
| 109 | ${browser_ID}= Open Browser ${URL} ${browser} |
| 110 | [Return] ${browser_ID} |
| 111 | |
| 112 | Model Server Power Click Button |
| 113 | [Documentation] Click main server power in the header section. |
| 114 | [Arguments] ${div_element} ${anchor_element} |
| 115 | # Description of argument(s): |
| 116 | # div_element Server power header divisional element |
| 117 | # (e.g. header_wrapper.) |
| 118 | # anchor_element Server power header anchor element |
| 119 | # (e.g. header_wrapper_elt.) |
| 120 | Wait Until Element Is Visible |
| 121 | ... //*[@id='header__wrapper']/div/div[${div_element}]/a[${anchor_element}]/span |
| 122 | Click Element |
| 123 | ... //*[@id='header__wrapper']/div/div[${div_element}]/a[${anchor_element}]/span |
| 124 | |
| 125 | Controller Server Power Click Button |
| 126 | [Documentation] Click main server power in the header section. |
| 127 | [Arguments] ${controller_element} |
| 128 | # Description of argument(s): |
| 129 | # controller_element Server power controller element |
| 130 | # (e.g. power__power-on.) |
| 131 | |
| 132 | Wait Until Element Is Visible ${controller_element} |
| 133 | Click Element ${controller_element} |
| 134 | |
| 135 | Controller Power Operations Confirmation Click Button |
| 136 | [Documentation] Click Common Power Operations Confirmation. |
| 137 | [Arguments] ${main_element} ${sub_element} ${confirm_msg_elt} ${confirmation} |
| 138 | # Description of argument(s): |
| 139 | # main_element Server power operations element |
| 140 | # (e.g. power_operations.) |
| 141 | # sub_element Server power operations sub element |
| 142 | # (e.g. warm_boot, shut_down.) |
| 143 | # confirm_msg_elt Server power operations confirm message element |
| 144 | # (e.g. confirm_msg.) |
| 145 | # confirmation Server power operations confirmation |
| 146 | # (e.g. yes.) |
| 147 | |
| 148 | Click Element |
| 149 | ... //*[@id='power-operations']/div[${main_element}]/div[${sub_element}]/confirm/div/div[${confirm_msg_elt}]/button[${confirmation}] |
| 150 | |
| 151 | GUI Power On |
| 152 | [Documentation] Power on the Host using GUI. |
| 153 | |
| 154 | Model Server Power Click Button ${header_wrapper} ${header_wrapper_elt} |
| 155 | Page Should Contain Attempts to power on the server |
| 156 | Controller Server Power Click Button power__power-on |
| 157 | Page Should Contain Running |
| 158 | |