blob: 794adf7af71a86da2be2120a9ecd0233c5f9c5b2 [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
19${CMD_INTERNAL_FAILURE} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
20... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.InternalFailure
21... xyz.openbmc_project.Logging.Entry.Level.Error 0
22
23
24*** Keywords ***
25
26Open Browser With URL
27 [Documentation] Open browser with specified URL and returns browser id.
28 [Arguments] ${URL} ${browser}=ff ${mode}=${GUI_MODE}
29
30 # Description of argument(s):
31 # URL Openbmc GUI URL to be open
32 # (e.g. https://openbmc-test.mybluemix.net/#/login).
33 # browser Browser used to open above URL
34 # (e.g. gc for google chrome, ff for firefox).
35 # mode Browser opening mode(e.g. headless, header).
36
37 ${browser_ID}= Run Keyword If '${mode}' == 'headless'
38 ... Launch Headless Browser ${URL} ${browser}
39 ... ELSE Open Browser ${URL} ${browser}
40
41 [Return] ${browser_ID}
42
43
44Launch Header Browser
45 [Documentation] Open the browser with the URL and
46 ... login on windows platform.
47 [Arguments] ${browser_type}=${GUI_BROWSER}
48
49 # Description of argument(s):
50 # browser_type Type of browser (e.g. "firefox", "chrome", etc.).
51
52 ${BROWSER_ID}= Open Browser ${obmc_gui_url} ${browser_type}
53 Maximize Browser Window
54 Set Global Variable ${BROWSER_ID}
55
56
57Launch Headless Browser
58 [Documentation] Launch headless browser.
59 [Arguments] ${URL}=${obmc_gui_url} ${browser}=${GUI_BROWSER}
60
61 # Description of argument(s):
62 # URL Openbmc GUI URL to be open
63 # (e.g. https://openbmc-test.mybluemix.net/#/login).
64 # browser Browser to open given URL in headless way
65 # (e.g. gc for google chrome, ff for firefox).
66
67 Start Virtual Display
68 ${browser_ID}= Open Browser ${URL}
69 Set Window Size 1920 1080
70
71 [Return] ${browser_ID}
72
73
74Launch Browser And Login GUI
75 [Documentation] Launch browser and login to OpenBMC GUI.
76
77 Open Browser With URL ${obmc_gui_url}
78 Login GUI ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
79
80
81Login GUI
82 [Documentation] Login to OpenBMC GUI.
83 [Arguments] ${username}=${OPENBMC_USERNAME} ${password}=${OPENBMC_PASSWORD}
84
85 # Description of argument(s):
86 # username The username to be used for login.
87 # password The password to be used for login.
88
89 Go To ${obmc_gui_url}
90 Wait Until Element Is Enabled ${xpath_textbox_username}
91 Input Text ${xpath_textbox_username} ${username}
92 Input Password ${xpath_textbox_password} ${password}
93 Click Element ${xpath_login_button}
Rahul Maheshwari7ae30a42021-02-01 20:02:00 -060094 Wait Until Page Contains Overview timeout=60s
Rahul Maheshwari41747da2020-11-17 09:09:52 -060095
96
97Logout GUI
98 [Documentation] Logout of OpenBMC GUI.
99
shrsuman123a9d93412021-07-13 04:06:05 -0500100 Click Element ${xpath_root_button_menu}
Rahul Maheshwari41747da2020-11-17 09:09:52 -0600101 Click Element ${xpath_logout_button}
102 Wait Until Page Contains Element ${xpath_login_button}
103
104
105Generate Test Error Log
106 [Documentation] Generate test error log.
107
108 BMC Execute Command ${CMD_INTERNAL_FAILURE}
Anusha Dathatri54edcbc2020-12-10 04:04:08 -0600109
110
111Set Timezone In Profile Settings Page
112 [Documentation] Set the given timezone in profile settings page.
113 [Arguments] ${timezone}=Default
114
115 # Description of argument(s):
116 # timezone Timezone to select (eg. Default or Browser_offset).
117
118 Wait Until Page Contains Element ${xpath_root_button_menu}
119 Click Element ${xpath_root_button_menu}
120 Click Element ${xpath_profile_settings}
121 Click Element At Coordinates ${xpath_default_UTC} 0 0
122 Click Element ${xpath_profile_save_button}
Ashwini Chandrappa90c6a812021-07-07 04:50:00 -0500123
124
125Refresh GUI
126 [Documentation] Refresh GUI via refresh button in header.
127
128 Click Element ${xpath_refresh_button}
129 # Added delay for page to load fully after refresh.
130 Sleep 5s
meghagn12345f942dae2021-08-27 02:53:00 -0500131
132
133Refresh GUI And Verify Element Value
134 [Documentation] Refresh GUI using refresh button and verify that given element contains expected value.
135 [Arguments] ${element} ${expected_value}
136
137 # Description of argument(s):
138 # element Element whose value need to be checked.
139 # expected_value Expected value of for the given element.
140
141 # Refresh GUI.
142
143 Click Element ${xpath_refresh_button}
144
145 # Check element value and verify that it contains expected value.
146 ${element_value}= Get Text ${element}
147 Log ${element_value}
148 Should Contain ${element_value} ${expected_value}
149