blob: a66c3782e2aae180aa4b793d47f8ba2f44430f80 [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 ***
Matt Fischerd315df42023-11-13 16:26:21 -070012${obmc_gui_url} https://${OPENBMC_HOST}:${HTTPS_PORT}
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
rramyasr-in4f16a512024-02-21 19:18:07 -060079 Wait Until Keyword Succeeds 195 sec 65 sec Retry Browser Login Attempts
rramyasr-inb874c312023-02-16 01:33:37 -060080
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
rramyasr-in319f27e2024-02-23 01:15:40 -0600104 Wait Until Element Is Not Visible
105 ... ${xpath_page_loading_progress_bar} timeout=120s
Rahul Maheshwari41747da2020-11-17 09:09:52 -0600106
Rahul Maheshwari41747da2020-11-17 09:09:52 -0600107Logout GUI
108 [Documentation] Logout of OpenBMC GUI.
109
shrsuman123a9d93412021-07-13 04:06:05 -0500110 Click Element ${xpath_root_button_menu}
Rahul Maheshwari41747da2020-11-17 09:09:52 -0600111 Click Element ${xpath_logout_button}
112 Wait Until Page Contains Element ${xpath_login_button}
113
114
115Generate Test Error Log
116 [Documentation] Generate test error log.
117
rramyasr-inae6a3c22022-10-26 05:15:00 -0500118 BMC Execute Command ${CMD_UNRECOVERABLE_ERROR}
Anusha Dathatri54edcbc2020-12-10 04:04:08 -0600119
120
121Set Timezone In Profile Settings Page
122 [Documentation] Set the given timezone in profile settings page.
123 [Arguments] ${timezone}=Default
124
125 # Description of argument(s):
126 # timezone Timezone to select (eg. Default or Browser_offset).
127
128 Wait Until Page Contains Element ${xpath_root_button_menu}
129 Click Element ${xpath_root_button_menu}
130 Click Element ${xpath_profile_settings}
131 Click Element At Coordinates ${xpath_default_UTC} 0 0
132 Click Element ${xpath_profile_save_button}
Ashwini Chandrappa90c6a812021-07-07 04:50:00 -0500133
134
135Refresh GUI
136 [Documentation] Refresh GUI via refresh button in header.
137
138 Click Element ${xpath_refresh_button}
139 # Added delay for page to load fully after refresh.
140 Sleep 5s
meghagn12345f942dae2021-08-27 02:53:00 -0500141
142
143Refresh GUI And Verify Element Value
144 [Documentation] Refresh GUI using refresh button and verify that given element contains expected value.
145 [Arguments] ${element} ${expected_value}
146
147 # Description of argument(s):
148 # element Element whose value need to be checked.
149 # expected_value Expected value of for the given element.
150
151 # Refresh GUI.
152
153 Click Element ${xpath_refresh_button}
154
155 # Check element value and verify that it contains expected value.
156 ${element_value}= Get Text ${element}
157 Log ${element_value}
158 Should Contain ${element_value} ${expected_value}
159
meghagn2052fdd2021-12-07 02:42:31 -0600160
161Reboot BMC via GUI
162 [Documentation] Reboot BMC via GUI.
163
164 Click Element ${xpath_operations_menu}
165 Click Element ${xpath_reboot_bmc_sub_menu}
166 Click Button ${xpath_reboot_bmc_button}
Megha G Nb9ae25a2023-01-27 06:25:00 -0600167 Wait Until Keyword Succeeds 30 sec 10 sec Click Button ${xpath_confirm_bmc_reboot}
meghagn2052fdd2021-12-07 02:42:31 -0600168 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Unpingable
169 Wait For Host To Ping ${OPENBMC_HOST} 1 min
Megha G N2a31e512023-01-18 04:23:20 -0600170
171
172Add DNS Servers And Verify
173 [Documentation] Login to GUI Network page,add DNS server on BMC
174 ... and verify it via BMC CLI.
175 [Arguments] ${dns_server} ${expected_status}=Valid format
176
177 # Description of the argument(s):
178 # dns_server A list of static name server IPs to be
179 # configured on the BMC.
180 # expected_status Expected status while adding DNS server address
181 # (e.g. Invalid format / Field required).
182
183 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15sec
184
185 Click Button ${xpath_add_dns_ip_address_button}
186 Input Text ${xpath_input_static_dns} ${dns_server}
187 Click Button ${xpath_add_button}
188 Run keyword if '${expected_status}' != 'Valid format'
189 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword
190
191 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=10sec
192 Wait Until Page Contains ${dns_server} timeout=40sec
193
194 # Check if newly added DNS server is configured on BMC.
195 ${cli_name_servers}= CLI Get Nameservers
196 ${cmd_status}= Run Keyword And Return Status
197 ... List Should Contain Sub List ${cli_name_servers} ${dns_server}
Megha G Nb9e3c712024-01-09 04:48:43 -0600198 Run Keyword If '${expected_status}' == '${HTTP_OK}'
199 ... Should Be True ${cmd_status} == ${True}
200 ... ELSE Should Not Be True ${cmd_status}
shahmo32978f91d2023-04-05 20:59:03 +0530201
202
203Navigate To Server Power Page
204 [Documentation] Navigate To Server Power Page.
205
206 Click Element ${xpath_power_page}
207 Wait Until Element Is Not Visible ${xpath_progress_bar} timeout=30
208
209
210Power Off Server
211 [Documentation] Powering off server.
212
213 Navigate To Server Power Page
214 ${present}= Run Keyword And Return Status
215 ... Element Should Be Visible ${xpath_power_shutdown}
216 IF ${present}
217 Click Element ${xpath_power_shutdown}
218 Click Button ${xpath_confirm}
219 Wait Until Element Is Visible ${xpath_power_poweron} timeout=60
220 ELSE
221 Log To console Server is already powered Off.
222 END
223
224
225Power On Server
226 [Documentation] Powering on server.
227
228 Navigate To Server Power Page
229 ${present}= Run Keyword And Return Status
230 ... Element Should Be Visible ${xpath_power_power_on}
231 IF (${present})
232 Click Element ${xpath_power_power_on}
233 Wait Until Element Is Visible ${xpath_power_shutdown} timeout=60
234 ELSE
235 Log To console Server is already powered On.
236 END
237
238
239Reboot Server
240 [Documentation] Rebooting the server.
241
242 Navigate To Server Power Page
243 ${present}= Run Keyword And Return Status
244 ... Element Should Be Visible ${xpath_power_reboot}
245 IF ${present}
246 Click Element ${xpath_power_reboot}
247 Wait Until Element Is Visible ${xpath_confirm} timeout=30
248 Click Button ${xpath_confirm}
249 Wait Until Element Is Visible ${xpath_power_reboot} timeout=60
250 ELSE
251 Log To console Server is already powered Off, can't reboot.
252 END