blob: 2fceed45fbb1ae60ade5c38aef8e9564f1653c86 [file] [log] [blame]
Rahul Maheshwari41747da2020-11-17 09:09:52 -06001*** Settings ***
2Documentation This is a resource file containing user-defined keywords for new Vue based OpenBMC GUI.
3
4Library XvfbRobot
5Library SeleniumLibrary
6Library SSHLibrary 30 Seconds
7Resource ../../lib/state_manager.robot
8Variables ../data/gui_variables.py
9
10
11*** Variables ***
12${obmc_gui_url} https://${OPENBMC_HOST}
shahmo32978f91d2023-04-05 20:59:03 +053013${xpath_power_page} //*[@data-test-id='appHeader-container-power']
14${xpath_power_shutdown} //*[@data-test-id='serverPowerOperations-button-shutDown']
15${xpath_power_power_on} //*[@data-test-id='serverPowerOperations-button-powerOn']
16${xpath_power_reboot} //*[@data-test-id='serverPowerOperations-button-reboot']
17${xpath_confirm} //button[contains(text(),'Confirm')]
Rahul Maheshwari41747da2020-11-17 09:09:52 -060018
George Keishing4d4ef992021-01-28 09:56:53 -060019# Default GUI browser and mode is set to "Firefox" and "headless"
Rahul Maheshwari41747da2020-11-17 09:09:52 -060020# respectively here.
21${GUI_BROWSER} ff
22${GUI_MODE} headless
23
Rahul Maheshwari41747da2020-11-17 09:09:52 -060024
25*** Keywords ***
26
27Open Browser With URL
28 [Documentation] Open browser with specified URL and returns browser id.
29 [Arguments] ${URL} ${browser}=ff ${mode}=${GUI_MODE}
30
31 # Description of argument(s):
32 # URL Openbmc GUI URL to be open
33 # (e.g. https://openbmc-test.mybluemix.net/#/login).
34 # browser Browser used to open above URL
35 # (e.g. gc for google chrome, ff for firefox).
36 # mode Browser opening mode(e.g. headless, header).
37
38 ${browser_ID}= Run Keyword If '${mode}' == 'headless'
39 ... Launch Headless Browser ${URL} ${browser}
40 ... ELSE Open Browser ${URL} ${browser}
41
42 [Return] ${browser_ID}
43
44
45Launch Header Browser
46 [Documentation] Open the browser with the URL and
47 ... login on windows platform.
48 [Arguments] ${browser_type}=${GUI_BROWSER}
49
50 # Description of argument(s):
51 # browser_type Type of browser (e.g. "firefox", "chrome", etc.).
52
53 ${BROWSER_ID}= Open Browser ${obmc_gui_url} ${browser_type}
54 Maximize Browser Window
55 Set Global Variable ${BROWSER_ID}
56
57
58Launch Headless Browser
59 [Documentation] Launch headless browser.
60 [Arguments] ${URL}=${obmc_gui_url} ${browser}=${GUI_BROWSER}
61
62 # Description of argument(s):
63 # URL Openbmc GUI URL to be open
64 # (e.g. https://openbmc-test.mybluemix.net/#/login).
65 # browser Browser to open given URL in headless way
66 # (e.g. gc for google chrome, ff for firefox).
67
68 Start Virtual Display
69 ${browser_ID}= Open Browser ${URL}
70 Set Window Size 1920 1080
71
72 [Return] ${browser_ID}
73
74
75Launch Browser And Login GUI
rramyasr-inb874c312023-02-16 01:33:37 -060076 [Documentation] Launch browser and login to OpenBMC GUI, retry 2 attempts
77 ... in 1 minute time.
78
79 Wait Until Keyword Succeeds 130 sec 65 sec Retry Browser Login Attempts
80
81
82Retry Browser Login Attempts
Rahul Maheshwari41747da2020-11-17 09:09:52 -060083 [Documentation] Launch browser and login to OpenBMC GUI.
84
85 Open Browser With URL ${obmc_gui_url}
86 Login GUI ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
87
88
89Login GUI
90 [Documentation] Login to OpenBMC GUI.
91 [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD}
92
93 # Description of argument(s):
94 # username The username to be used for login.
95 # password The password to be used for login.
96
97 Go To ${obmc_gui_url}
rramyasr-ind1ae7fa2023-02-20 11:00:41 -060098 Wait Until Element Is Enabled ${xpath_login_username_input}
99 Input Text ${xpath_login_username_input} ${username}
100 Input Password ${xpath_login_password_input} ${password}
shahmo32978f91d2023-04-05 20:59:03 +0530101 Wait Until Element Is Enabled ${xpath_login_button}
Rahul Maheshwari41747da2020-11-17 09:09:52 -0600102 Click Element ${xpath_login_button}
Rahul Maheshwari7ae30a42021-02-01 20:02:00 -0600103 Wait Until Page Contains Overview timeout=60s
Rahul Maheshwari41747da2020-11-17 09:09:52 -0600104
105
106Logout GUI
107 [Documentation] Logout of OpenBMC GUI.
108
shrsuman123a9d93412021-07-13 04:06:05 -0500109 Click Element ${xpath_root_button_menu}
Rahul Maheshwari41747da2020-11-17 09:09:52 -0600110 Click Element ${xpath_logout_button}
111 Wait Until Page Contains Element ${xpath_login_button}
112
113
114Generate Test Error Log
115 [Documentation] Generate test error log.
116
rramyasr-inae6a3c22022-10-26 05:15:00 -0500117 BMC Execute Command ${CMD_UNRECOVERABLE_ERROR}
Anusha Dathatri54edcbc2020-12-10 04:04:08 -0600118
119
120Set Timezone In Profile Settings Page
121 [Documentation] Set the given timezone in profile settings page.
122 [Arguments] ${timezone}=Default
123
124 # Description of argument(s):
125 # timezone Timezone to select (eg. Default or Browser_offset).
126
127 Wait Until Page Contains Element ${xpath_root_button_menu}
128 Click Element ${xpath_root_button_menu}
129 Click Element ${xpath_profile_settings}
130 Click Element At Coordinates ${xpath_default_UTC} 0 0
131 Click Element ${xpath_profile_save_button}
Ashwini Chandrappa90c6a812021-07-07 04:50:00 -0500132
133
134Refresh GUI
135 [Documentation] Refresh GUI via refresh button in header.
136
137 Click Element ${xpath_refresh_button}
138 # Added delay for page to load fully after refresh.
139 Sleep 5s
meghagn12345f942dae2021-08-27 02:53:00 -0500140
141
142Refresh GUI And Verify Element Value
143 [Documentation] Refresh GUI using refresh button and verify that given element contains expected value.
144 [Arguments] ${element} ${expected_value}
145
146 # Description of argument(s):
147 # element Element whose value need to be checked.
148 # expected_value Expected value of for the given element.
149
150 # Refresh GUI.
151
152 Click Element ${xpath_refresh_button}
153
154 # Check element value and verify that it contains expected value.
155 ${element_value}= Get Text ${element}
156 Log ${element_value}
157 Should Contain ${element_value} ${expected_value}
158
meghagn2052fdd2021-12-07 02:42:31 -0600159
160Reboot BMC via GUI
161 [Documentation] Reboot BMC via GUI.
162
163 Click Element ${xpath_operations_menu}
164 Click Element ${xpath_reboot_bmc_sub_menu}
165 Click Button ${xpath_reboot_bmc_button}
Megha G Nb9ae25a2023-01-27 06:25:00 -0600166 Wait Until Keyword Succeeds 30 sec 10 sec Click Button ${xpath_confirm_bmc_reboot}
meghagn2052fdd2021-12-07 02:42:31 -0600167 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Unpingable
168 Wait For Host To Ping ${OPENBMC_HOST} 1 min
Megha G N2a31e512023-01-18 04:23:20 -0600169
170
171Add DNS Servers And Verify
172 [Documentation] Login to GUI Network page,add DNS server on BMC
173 ... and verify it via BMC CLI.
174 [Arguments] ${dns_server} ${expected_status}=Valid format
175
176 # Description of the argument(s):
177 # dns_server A list of static name server IPs to be
178 # configured on the BMC.
179 # expected_status Expected status while adding DNS server address
180 # (e.g. Invalid format / Field required).
181
182 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15sec
183
184 Click Button ${xpath_add_dns_ip_address_button}
185 Input Text ${xpath_input_static_dns} ${dns_server}
186 Click Button ${xpath_add_button}
187 Run keyword if '${expected_status}' != 'Valid format'
188 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword
189
190 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=10sec
191 Wait Until Page Contains ${dns_server} timeout=40sec
192
193 # Check if newly added DNS server is configured on BMC.
194 ${cli_name_servers}= CLI Get Nameservers
195 ${cmd_status}= Run Keyword And Return Status
196 ... List Should Contain Sub List ${cli_name_servers} ${dns_server}
shahmo32978f91d2023-04-05 20:59:03 +0530197
198
199Navigate To Server Power Page
200 [Documentation] Navigate To Server Power Page.
201
202 Click Element ${xpath_power_page}
203 Wait Until Element Is Not Visible ${xpath_progress_bar} timeout=30
204
205
206Power Off Server
207 [Documentation] Powering off server.
208
209 Navigate To Server Power Page
210 ${present}= Run Keyword And Return Status
211 ... Element Should Be Visible ${xpath_power_shutdown}
212 IF ${present}
213 Click Element ${xpath_power_shutdown}
214 Click Button ${xpath_confirm}
215 Wait Until Element Is Visible ${xpath_power_poweron} timeout=60
216 ELSE
217 Log To console Server is already powered Off.
218 END
219
220
221Power On Server
222 [Documentation] Powering on server.
223
224 Navigate To Server Power Page
225 ${present}= Run Keyword And Return Status
226 ... Element Should Be Visible ${xpath_power_power_on}
227 IF (${present})
228 Click Element ${xpath_power_power_on}
229 Wait Until Element Is Visible ${xpath_power_shutdown} timeout=60
230 ELSE
231 Log To console Server is already powered On.
232 END
233
234
235Reboot Server
236 [Documentation] Rebooting the server.
237
238 Navigate To Server Power Page
239 ${present}= Run Keyword And Return Status
240 ... Element Should Be Visible ${xpath_power_reboot}
241 IF ${present}
242 Click Element ${xpath_power_reboot}
243 Wait Until Element Is Visible ${xpath_confirm} timeout=30
244 Click Button ${xpath_confirm}
245 Wait Until Element Is Visible ${xpath_power_reboot} timeout=60
246 ELSE
247 Log To console Server is already powered Off, can't reboot.
248 END