blob: 7a66c34f7a6319f933132f09567e1a0f5911a142 [file] [log] [blame]
Sathyajith M Se6956c02017-08-16 01:50:17 -05001*** Settings ***
2Documentation This is a resource file of OpenBMC ASMI It contains the
3... user-defined keywords which are available to all gui modules
4
5Library String
6Library Collections
7Library DateTime
8Library XvfbRobot
9Library OperatingSystem
10Library Selenium2Library 120 120
11Library AngularJSLibrary
12Library SSHLibrary 30 Seconds
13Library Process
14Library supporting_libs.py
15Library ../../../lib/gen_print.py
16Library ../../../lib/gen_robot_print.py
17Library ../../../lib/gen_valid.py
18Library ../../../lib/gen_robot_ssh.py
19Library ../../../lib/bmc_ssh_utils.py
Sathyajith M Se6956c02017-08-16 01:50:17 -050020Variables ../data/resource_variables.py
Sivas SRR40c1f042018-01-05 11:00:02 -060021Resource ../../../lib/resource.txt
Sathyajith M Se6956c02017-08-16 01:50:17 -050022
23*** Variables ***
24# TO Do: Change the variable once the code finally switches to the OpenBMC.
Sivas SRR40c1f042018-01-05 11:00:02 -060025${openbmc_gui_url} http://localhost:8080/#/login
Sathyajith M Se6956c02017-08-16 01:50:17 -050026# Default Browser.
27${default_browser} chrome
28
29*** Keywords ***
30Launch 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
39Get 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
50Launch Browser in Windows Platform
51 [Documentation] Open the browse with the URL and login on windows platform.
Sivas SRR40c1f042018-01-05 11:00:02 -060052 ${BROWSER_ID}= Open Browser ${openbmc_gui_url} ${default_browser}
Sathyajith M Se6956c02017-08-16 01:50:17 -050053 Maximize Browser Window
54 Set Global Variable ${BROWSER_ID}
55
56Launch Headless Browser
57 [Documentation] Launch headless browser.
58 Start Virtual Display 1920 1080
Sivas SRR40c1f042018-01-05 11:00:02 -060059 ${BROWSER_ID}= Open Browser ${openbmc_gui_url}
Sathyajith M Se6956c02017-08-16 01:50:17 -050060 Set Global Variable ${BROWSER_ID}
61 Set Window Size 1920 1080
62
63OpenBMC 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
69Login 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 SRR40c1f042018-01-05 11:00:02 -060076
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 Se6956c02017-08-16 01:50:17 -050083 Input Text ${xpath_textbox_username} ${username}
84 Input Password ${xpath_textbox_password} ${password}
Sivas SRR40c1f042018-01-05 11:00:02 -060085 Click Element login__submit
Sathyajith M Se6956c02017-08-16 01:50:17 -050086 Wait Until Element Is Enabled ${xpath_button_logout}
Sivas SRR40c1f042018-01-05 11:00:02 -060087 Page Should Contain Server information
Sathyajith M Se6956c02017-08-16 01:50:17 -050088
89LogOut 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
95OpenBMC 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 SRR40c1f042018-01-05 11:00:02 -0600101Open 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
112Model 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
125Controller 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
135Controller 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
151GUI 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