blob: 08ac09e496c3bda86a04a762ad43c88d1e6f1a71 [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
71 [Documentation] Launch browser and login to OpenBMC GUI.
72
73 Open Browser With URL ${obmc_gui_url}
74 Login GUI ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
75
76
77Login GUI
78 [Documentation] Login to OpenBMC GUI.
79 [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD}
80
81 # Description of argument(s):
82 # username The username to be used for login.
83 # password The password to be used for login.
84
85 Go To ${obmc_gui_url}
86 Wait Until Element Is Enabled ${xpath_textbox_username}
87 Input Text ${xpath_textbox_username} ${username}
88 Input Password ${xpath_textbox_password} ${password}
89 Click Element ${xpath_login_button}
Rahul Maheshwari7ae30a42021-02-01 20:02:00 -060090 Wait Until Page Contains Overview timeout=60s
Rahul Maheshwari41747da2020-11-17 09:09:52 -060091
92
93Logout GUI
94 [Documentation] Logout of OpenBMC GUI.
95
shrsuman123a9d93412021-07-13 04:06:05 -050096 Click Element ${xpath_root_button_menu}
Rahul Maheshwari41747da2020-11-17 09:09:52 -060097 Click Element ${xpath_logout_button}
98 Wait Until Page Contains Element ${xpath_login_button}
99
100
101Generate Test Error Log
102 [Documentation] Generate test error log.
103
rramyasr-inae6a3c22022-10-26 05:15:00 -0500104 BMC Execute Command ${CMD_UNRECOVERABLE_ERROR}
Anusha Dathatri54edcbc2020-12-10 04:04:08 -0600105
106
107Set Timezone In Profile Settings Page
108 [Documentation] Set the given timezone in profile settings page.
109 [Arguments] ${timezone}=Default
110
111 # Description of argument(s):
112 # timezone Timezone to select (eg. Default or Browser_offset).
113
114 Wait Until Page Contains Element ${xpath_root_button_menu}
115 Click Element ${xpath_root_button_menu}
116 Click Element ${xpath_profile_settings}
117 Click Element At Coordinates ${xpath_default_UTC} 0 0
118 Click Element ${xpath_profile_save_button}
Ashwini Chandrappa90c6a812021-07-07 04:50:00 -0500119
120
121Refresh GUI
122 [Documentation] Refresh GUI via refresh button in header.
123
124 Click Element ${xpath_refresh_button}
125 # Added delay for page to load fully after refresh.
126 Sleep 5s
meghagn12345f942dae2021-08-27 02:53:00 -0500127
128
129Refresh GUI And Verify Element Value
130 [Documentation] Refresh GUI using refresh button and verify that given element contains expected value.
131 [Arguments] ${element} ${expected_value}
132
133 # Description of argument(s):
134 # element Element whose value need to be checked.
135 # expected_value Expected value of for the given element.
136
137 # Refresh GUI.
138
139 Click Element ${xpath_refresh_button}
140
141 # Check element value and verify that it contains expected value.
142 ${element_value}= Get Text ${element}
143 Log ${element_value}
144 Should Contain ${element_value} ${expected_value}
145
meghagn2052fdd2021-12-07 02:42:31 -0600146
147Reboot BMC via GUI
148 [Documentation] Reboot BMC via GUI.
149
150 Click Element ${xpath_operations_menu}
151 Click Element ${xpath_reboot_bmc_sub_menu}
152 Click Button ${xpath_reboot_bmc_button}
Megha G Nb9ae25a2023-01-27 06:25:00 -0600153 Wait Until Keyword Succeeds 30 sec 10 sec Click Button ${xpath_confirm_bmc_reboot}
meghagn2052fdd2021-12-07 02:42:31 -0600154 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Unpingable
155 Wait For Host To Ping ${OPENBMC_HOST} 1 min