blob: 391839dd8638adf1929b04bd049ed4cf86175418 [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}
13
George Keishing4d4ef992021-01-28 09:56:53 -060014# Default GUI browser and mode is set to "Firefox" and "headless"
Rahul Maheshwari41747da2020-11-17 09:09:52 -060015# respectively here.
16${GUI_BROWSER} ff
17${GUI_MODE} headless
18
Rahul Maheshwari41747da2020-11-17 09:09:52 -060019
20*** Keywords ***
21
22Open Browser With URL
23 [Documentation] Open browser with specified URL and returns browser id.
24 [Arguments] ${URL} ${browser}=ff ${mode}=${GUI_MODE}
25
26 # Description of argument(s):
27 # URL Openbmc GUI URL to be open
28 # (e.g. https://openbmc-test.mybluemix.net/#/login).
29 # browser Browser used to open above URL
30 # (e.g. gc for google chrome, ff for firefox).
31 # mode Browser opening mode(e.g. headless, header).
32
33 ${browser_ID}= Run Keyword If '${mode}' == 'headless'
34 ... Launch Headless Browser ${URL} ${browser}
35 ... ELSE Open Browser ${URL} ${browser}
36
37 [Return] ${browser_ID}
38
39
40Launch Header Browser
41 [Documentation] Open the browser with the URL and
42 ... login on windows platform.
43 [Arguments] ${browser_type}=${GUI_BROWSER}
44
45 # Description of argument(s):
46 # browser_type Type of browser (e.g. "firefox", "chrome", etc.).
47
48 ${BROWSER_ID}= Open Browser ${obmc_gui_url} ${browser_type}
49 Maximize Browser Window
50 Set Global Variable ${BROWSER_ID}
51
52
53Launch Headless Browser
54 [Documentation] Launch headless browser.
55 [Arguments] ${URL}=${obmc_gui_url} ${browser}=${GUI_BROWSER}
56
57 # Description of argument(s):
58 # URL Openbmc GUI URL to be open
59 # (e.g. https://openbmc-test.mybluemix.net/#/login).
60 # browser Browser to open given URL in headless way
61 # (e.g. gc for google chrome, ff for firefox).
62
63 Start Virtual Display
64 ${browser_ID}= Open Browser ${URL}
65 Set Window Size 1920 1080
66
67 [Return] ${browser_ID}
68
69
70Launch Browser And Login GUI
rramyasr-inb874c312023-02-16 01:33:37 -060071 [Documentation] Launch browser and login to OpenBMC GUI, retry 2 attempts
72 ... in 1 minute time.
73
74 Wait Until Keyword Succeeds 130 sec 65 sec Retry Browser Login Attempts
75
76
77Retry Browser Login Attempts
Rahul Maheshwari41747da2020-11-17 09:09:52 -060078 [Documentation] Launch browser and login to OpenBMC GUI.
79
80 Open Browser With URL ${obmc_gui_url}
81 Login GUI ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
82
83
84Login GUI
85 [Documentation] Login to OpenBMC GUI.
86 [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD}
87
88 # Description of argument(s):
89 # username The username to be used for login.
90 # password The password to be used for login.
91
92 Go To ${obmc_gui_url}
rramyasr-ind1ae7fa2023-02-20 11:00:41 -060093 Wait Until Element Is Enabled ${xpath_login_username_input}
94 Input Text ${xpath_login_username_input} ${username}
95 Input Password ${xpath_login_password_input} ${password}
Rahul Maheshwari41747da2020-11-17 09:09:52 -060096 Click Element ${xpath_login_button}
Rahul Maheshwari7ae30a42021-02-01 20:02:00 -060097 Wait Until Page Contains Overview timeout=60s
Rahul Maheshwari41747da2020-11-17 09:09:52 -060098
99
100Logout GUI
101 [Documentation] Logout of OpenBMC GUI.
102
shrsuman123a9d93412021-07-13 04:06:05 -0500103 Click Element ${xpath_root_button_menu}
Rahul Maheshwari41747da2020-11-17 09:09:52 -0600104 Click Element ${xpath_logout_button}
105 Wait Until Page Contains Element ${xpath_login_button}
106
107
108Generate Test Error Log
109 [Documentation] Generate test error log.
110
rramyasr-inae6a3c22022-10-26 05:15:00 -0500111 BMC Execute Command ${CMD_UNRECOVERABLE_ERROR}
Anusha Dathatri54edcbc2020-12-10 04:04:08 -0600112
113
114Set Timezone In Profile Settings Page
115 [Documentation] Set the given timezone in profile settings page.
116 [Arguments] ${timezone}=Default
117
118 # Description of argument(s):
119 # timezone Timezone to select (eg. Default or Browser_offset).
120
121 Wait Until Page Contains Element ${xpath_root_button_menu}
122 Click Element ${xpath_root_button_menu}
123 Click Element ${xpath_profile_settings}
124 Click Element At Coordinates ${xpath_default_UTC} 0 0
125 Click Element ${xpath_profile_save_button}
Ashwini Chandrappa90c6a812021-07-07 04:50:00 -0500126
127
128Refresh GUI
129 [Documentation] Refresh GUI via refresh button in header.
130
131 Click Element ${xpath_refresh_button}
132 # Added delay for page to load fully after refresh.
133 Sleep 5s
meghagn12345f942dae2021-08-27 02:53:00 -0500134
135
136Refresh GUI And Verify Element Value
137 [Documentation] Refresh GUI using refresh button and verify that given element contains expected value.
138 [Arguments] ${element} ${expected_value}
139
140 # Description of argument(s):
141 # element Element whose value need to be checked.
142 # expected_value Expected value of for the given element.
143
144 # Refresh GUI.
145
146 Click Element ${xpath_refresh_button}
147
148 # Check element value and verify that it contains expected value.
149 ${element_value}= Get Text ${element}
150 Log ${element_value}
151 Should Contain ${element_value} ${expected_value}
152
meghagn2052fdd2021-12-07 02:42:31 -0600153
154Reboot BMC via GUI
155 [Documentation] Reboot BMC via GUI.
156
157 Click Element ${xpath_operations_menu}
158 Click Element ${xpath_reboot_bmc_sub_menu}
159 Click Button ${xpath_reboot_bmc_button}
Megha G Nb9ae25a2023-01-27 06:25:00 -0600160 Wait Until Keyword Succeeds 30 sec 10 sec Click Button ${xpath_confirm_bmc_reboot}
meghagn2052fdd2021-12-07 02:42:31 -0600161 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Unpingable
162 Wait For Host To Ping ${OPENBMC_HOST} 1 min
Megha G N2a31e512023-01-18 04:23:20 -0600163
164
165Add DNS Servers And Verify
166 [Documentation] Login to GUI Network page,add DNS server on BMC
167 ... and verify it via BMC CLI.
168 [Arguments] ${dns_server} ${expected_status}=Valid format
169
170 # Description of the argument(s):
171 # dns_server A list of static name server IPs to be
172 # configured on the BMC.
173 # expected_status Expected status while adding DNS server address
174 # (e.g. Invalid format / Field required).
175
176 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=15sec
177
178 Click Button ${xpath_add_dns_ip_address_button}
179 Input Text ${xpath_input_static_dns} ${dns_server}
180 Click Button ${xpath_add_button}
181 Run keyword if '${expected_status}' != 'Valid format'
182 ... Run keywords Page Should Contain ${expected_status} AND Return From Keyword
183
184 Wait Until Page Contains Element ${xpath_add_dns_ip_address_button} timeout=10sec
185 Wait Until Page Contains ${dns_server} timeout=40sec
186
187 # Check if newly added DNS server is configured on BMC.
188 ${cli_name_servers}= CLI Get Nameservers
189 ${cmd_status}= Run Keyword And Return Status
190 ... List Should Contain Sub List ${cli_name_servers} ${dns_server}