1*** Settings ***
2
3Documentation  Test Open BMC GUI server health under GUI Header.
4
5Resource        ../../lib/resource.robot
6Resource        ../../../lib/boot_utils.robot
7Resource        ../../../lib/utils.robot
8Resource        ../../../lib/openbmc_ffdc.robot
9Resource        ../../../lib/state_manager.robot
10Resource        ../../../lib/openbmc_ffdc_methods.robot
11Resource        ../../../lib/dump_utils.robot
12Resource        ../../../lib/logging_utils.robot
13Library         ../../../lib/gen_robot_keyword.py
14
15Test Setup      Test Setup Execution
16Test Teardown   Test Teardown Execution
17
18*** Variables ***
19
20${xpath_delete_remote_server}  //*[@class="remote-logging-server"]//button[2]
21${xpath_add_server}            //*[@class="remote-logging-server"]//button[1]
22${xpath_remote_server_ip}      //input[@id="remoteServerIP"]
23${xpath_remote_server_port}    //input[@id="remoteServerPort"]
24
25*** Test Cases ***
26
27Verify Event Log Text Appears By Clicking Server Health
28    [Documentation]  Check that "Event Log" text appears by clicking server
29    ...  health in GUI header.
30    [Tags]  Verify_Event_Log_Text_Appears_By_Clicking_Server_Health
31
32    Wait Until Page Contains Element  event-log
33    Page should contain  Event log
34
35
36Verify Filters By Severity Elements Appears
37    [Documentation]  Check that the "event log" filters appears by clicking
38    ...  server health in GUI header.
39    [Tags]  Verify_Filters_By_Severity_Elements_Appears
40
41    # Types of event severity: All, High, Medium, Low.
42    Page Should Contain Element  ${xpath_event_severity_all}  limit=1
43    Page Should Contain Element  ${xpath_event_severity_high}  limit=1
44    Page Should Contain Element  ${xpath_event_severity_medium}  limit=1
45    Page Should Contain Element  ${xpath_event_severity_low}  limit=1
46
47
48Verify Drop Down Button User Timezone Appears
49    [Documentation]  Check that the "drop down" button of user timezone appears
50    ...  by clicking server health in GUI header.
51    [Tags]  Verify_Drop_Down_Button_User_Timezone_Appears
52
53    Page Should Contain Button  ${xpath_drop_down_timezone_edt}
54    # Ensure that page is not in refreshing state.
55    # It helps to click the drop down element.
56    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
57    Click Element  //*[@class='dropdown__button']
58    Page Should Contain Button  ${xpath_drop_down_timezone_utc}
59
60
61Verify Content Search Element Appears
62    [Documentation]  Check that the "event search element is available with
63    ...  filter" button appears.
64    [Tags]  Verify_Content_Search_Element_Appears
65
66    Page Should Contain Element  content__search-input  limit=1
67    # Ensure that page is not in refreshing state.
68    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
69    Page Should Contain Button  content__search-submit
70
71
72Verify Filter By Date Element Appears
73    [Documentation]  Check that the "filter by date" elements are available and
74    ...  visible.
75    [Tags]  Verify_Filter_By_Date_Element_Appears
76
77    Wait Until Element Is Visible  event-filter-start-date
78    Page Should Contain Element  event-filter-start-date  limit=1
79    Page Should Contain Element  event-filter-end-date  limit=1
80
81
82Verify Filter By Event Status Element Appears
83    [Documentation]  Check that the "filter by event status" element appears.
84    [Tags]  Verify_Filter_By_Event_Status_Element_Appears
85
86    # Ensure that page is not in refreshing state.
87    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
88    Wait Until Element is Visible  //*[@class='dropdown__wrapper']
89    Click Element  //*[@class='dropdown__wrapper']
90    Page Should Contain Element  ${xpath_event_filter_all}  limit=2
91    Page Should Contain Element  ${xpath_event_filter_resolved}  limit=1
92    Page Should Contain Element  ${xpath_event_filter_unresolved}  limit=1
93
94
95Verify Event Action Bar Element Appears
96    [Documentation]  Check that "event action bar" element appears.
97    [Tags]  Verify_Event_Action_Bar_Element_Appears
98
99    # Ensure that page is not in refreshing state.
100    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
101    Page Should Contain Element  ${xpath_event_action_bars}  limit=1
102    Page Should Contain Element  ${xpath_select_all_events}
103
104
105Verify Click Events Check Box
106    [Documentation]  Check that "event check box" element appears and on click
107    ...  should be able to see elements like "Delete" button and "Export"
108    ...  element.
109    [Tags]  Verify_Click_Events_Check_Box
110
111    Create Test Error Log
112    Click Element  ${xpath_select_refresh_button}
113    # Ensure that page is not in refreshing state.
114    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
115    Click Element  ${xpath_select_all_events}
116    Page Should Contain Button  ${xpath_event_action_delete}  limit=1
117    Page Should Contain Element  ${xpath_event_action_export}  limit=1
118
119
120Verify Number of Events Appears
121    [Documentation]  Check that "number of events" element appears and value is
122    ...  visible.
123    [Tags]  Verify_Number_of_Events_Appears
124
125    # Ensure that page is not in refreshing state.
126    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
127    Page Should Contain Element  ${xpath_number_of_events}
128    ${number_of_events}=  Get Text  ${xpath_number_of_events}
129    Log To Console  \n Number of Events:${number_of_events}
130
131
132Select All Error Logs And Mark As Resolved
133    [Documentation]  Select all error logs and mark them as resolved.
134    [Tags]  Select_All_Error_Logs_And_Mark_As_Resolved
135
136    Create Test Error Log
137    Create Test Error Log
138    Click Element  ${xpath_select_refresh_button}
139    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
140    Page Should Contain Element  ${xpath_number_of_events}
141    ${number_of_events}=  Get Text  ${xpath_number_of_events}
142    Click Element  ${xpath_select_all_events}
143    Run Keyword If  ${number_of_events} > 0
144    ...  Click Element  ${xpath_mark_as_resolved}
145    Element Should Be Disabled  ${xpath_mark_as_resolved}
146
147
148Select All Error Logs And Click Export
149    [Documentation]  Select all error logs and click export element.
150    [Tags]  Select_All_Error_Logs_And_Click_Export
151
152    Create Test Error Log
153    Create Test Error Log
154    Click Element  ${xpath_select_refresh_button}
155    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
156    Page Should Contain Element  ${xpath_number_of_events}
157    ${number_of_events}=  Get Text  ${xpath_number_of_events}
158    Click Element  ${xpath_select_all_events}
159    Page Should Contain Element  ${xpath_events_export}
160    Run Keyword If  ${number_of_events} > 0
161    ...  Click Element  ${xpath_events_export}
162
163
164Select All Error Logs And Delete
165    [Documentation]  Select all error logs and delete them.
166    [Tags]  Select_All_Error_Logs_And_Delete
167
168    Create Test Error Log
169    Create Test Error Log
170    Click Element  ${xpath_select_refresh_button}
171    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
172    Page Should Contain Element  ${xpath_number_of_events}
173    ${number_of_events}=  Get Text  ${xpath_number_of_events}
174    Run Keyword If  ${number_of_events} > 0
175    ...  Common Event Log Click Element  ${xpath_individual_event_delete}
176    ...  ${xpath_yes_button}  ${xpath_select_all_events}
177    ${number_of_events}=  Get Text  ${xpath_number_of_events}
178    Should Be Equal  ${number_of_events}  0
179
180
181Select Single Error Log And Delete
182    [Documentation]  Select single error log and delete it.
183    [Tags]  Select_Single_Error_Log_And_Delete
184
185    Create Test Error Log
186    # Refresh the GUI to get the latest update.
187    Click Element  ${xpath_select_refresh_button}
188    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
189    Page Should Contain Element  ${xpath_number_of_events}
190    ${number_of_events}=  Get Text  ${xpath_number_of_events}
191    Run Keyword If  ${number_of_events} > 0
192    ...  Common Event Log Click Element  ${xpath_individual_event_delete}
193    ...  ${xpath_yes_button}
194    ${number_of_events}=  Get Text  ${xpath_number_of_events}
195    Should Be Equal  ${number_of_events}  0
196    ...  msg=Failed to delete single error log entry.
197
198
199Select Multiple Error Logs And Delete
200    [Documentation]  Select multiple error logs and delete them.
201    [Tags]  Select_Multiple_Error_Logs_And_Delete
202
203    Create Test Error Log
204    Create Test Error Log
205    # Refresh the GUI to get the latest update.
206    Click Element  ${xpath_select_refresh_button}
207    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
208    Page Should Contain Element  ${xpath_number_of_events}
209    ${number_of_events}=  Get Text  ${xpath_number_of_events}
210    Run Keyword If  ${number_of_events} > 0
211    ...  Double Event Log Click Element  ${xpath_individual_event_delete}
212    ...  ${xpath_yes_button}
213    ${number_of_events}=  Get Text  ${xpath_number_of_events}
214    Should Be Equal  ${number_of_events}  0
215    ...  msg=Failed to delete multiple error log entries.
216
217
218Select Single Error Log And Mark As Resolved
219    [Documentation]  Select single error log and mark as resolved.
220    [Tags]  Select_Single_Error_Log_And_Mark_As_Resolved
221
222    Create Test Error Log
223    # Refresh the GUI to get the latest update.
224    Click Element  ${xpath_select_refresh_button}
225    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
226    Page Should Contain Element  ${xpath_number_of_events}
227    ${number_of_events}=  Get Text  ${xpath_number_of_events}
228    Run Keyword If  ${number_of_events} > 0
229    ...  Common Event Log Click Element  ${xpath_individual_event_resolved}
230    ${number_of_events}=  Get Text  ${xpath_number_of_events}
231    Should Be Equal  ${number_of_events}  1
232    ...  msg=Failed to mark single error log entry as resolved.
233
234
235Select Multiple Error Logs And Mark As Resolved
236    [Documentation]  Select multiple error logs and mark as resolved.
237    [Tags]  Select_Multiple_Error_Logs_And_Mark_As_Resolved
238
239    Create Test Error Log
240    Create Test Error Log
241    # Refresh the GUI to get the latest update.
242    Click Element  ${xpath_select_refresh_button}
243    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
244    Page Should Contain Element  ${xpath_number_of_events}
245    ${number_of_events}=  Get Text  ${xpath_number_of_events}
246    Run Keyword If  ${number_of_events} > 0
247    ...  Double Event Log Click Element  ${xpath_individual_event_resolved}
248    ${number_of_events}=  Get Text  ${xpath_number_of_events}
249    Should Be Equal  ${number_of_events}  2
250    ...  msg=Failed to mark multiple error log entries as resolved.
251
252
253Select Single Error Log And Export
254    [Documentation]  Select single error log and export.
255    [Tags]  Select_Single_Error_Log_And_Export
256
257    Create Test Error Log
258    # Refresh the GUI to get the latest update.
259    Click Element  ${xpath_select_refresh_button}
260    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
261    Page Should Contain Element  ${xpath_number_of_events}
262    ${number_of_events}=  Get Text  ${xpath_number_of_events}
263    Run Keyword If  ${number_of_events} > 0
264    ...  Common Event Log Click Element  ${xpath_individual_event_export}
265    ${number_of_events}=  Get Text  ${xpath_number_of_events}
266    Should Be Equal  ${number_of_events}  1
267    ...  msg=Failed to export single error log entry.
268
269
270Select Multiple Error Log And Export
271    [Documentation]  Select multiple error log and export.
272    [Tags]  Select_Multiple_Error_Log_And_Export
273
274    Create Test Error Log
275    Create Test Error Log
276    # Refresh the GUI to get the latest update.
277    Click Element  ${xpath_select_refresh_button}
278    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
279    Page Should Contain Element  ${xpath_number_of_events}
280    ${number_of_events}=  Get Text  ${xpath_number_of_events}
281    Run Keyword If  ${number_of_events} > 0
282    ...  Double Event Log Click Element  ${xpath_individual_event_export}
283    ${number_of_events}=  Get Text  ${xpath_number_of_events}
284    Should Be Equal  ${number_of_events}  2
285    ...  msg=Failed to export multiple error log entries.
286
287
288Verify Existence Of All Buttons In Remote Logging Server Page
289    [Documentation]  Verify existence of all buttons in remote logging server
290    ...              page.
291    [Tags]  Verify_Existence_Of_All_Buttons_In_Remote_Logging_Server_Page
292    [Setup]  Setup For Remote Logging Server
293    [Teardown]  Teardown For Remote Logging Server
294
295    Page Should Contain Button  ${xpath_cancel_button}
296    Page Should Contain Button  ${xpath_add_button}
297
298
299Verify Existence Of All Input Boxes In Remote Logging Server Page
300    [Documentation]  Verify existence of all input boxes in remote logging server
301    ...              page.
302    [Tags]  Verify_Existence_Of_All_Input_Boxes_In_Remote_Logging_Server_Page
303    [Setup]  Setup For Remote Logging Server
304    [Teardown]  Teardown For Remote Logging Server
305
306    Page Should Contain Textfield  ${xpath_remote_server_ip}
307    Page Should Contain Textfield  ${xpath_remote_server_port}
308
309*** Keywords ***
310
311Common Event Log Click Element
312   [Documentation]  Keep common click elements associated with event log.
313   [Arguments]  ${action_element}  ${action_click_confirmation}=${None}
314   ...  ${xpath_event_select}=${xpath_individual_event_select}
315
316    # Description of argument(s):
317    # action_element             xpath value of the element to be actioned
318    #                            (e.g. "Delete" or "Resolved" or "Export").
319    # action_click_confirmation  Confirmation of action by pressing yes
320    #                            (e.g.  "Yes" or "No").
321    # xpath_event_select         xpath to select event log.
322
323    Click Element  ${xpath_event_select}
324    Page Should Contain Element  ${action_element}
325    Click Element  ${action_element}
326    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
327    Run Keyword If  "${action_click_confirmation}" != "${None}"
328    ...  Click Element  ${action_click_confirmation}
329    Click Element  ${xpath_select_refresh_button}
330    Run Key  Sleep \ 50s
331
332Double Event Log Click Element
333   [Documentation]  Keep double click elements associated with event logs.
334   [Arguments]  ${action_element}  ${action_click_confirmation}=${None}
335
336    # Description of argument(s):
337    # action_element             xpath value of the element to be actioned
338    #                            (e.g. "Delete" or "Resolved" or "Export").
339    # action_click_confirmation  Confirmation of action by pressing yes
340    #                            (e.g.  "Yes" or "No").
341
342   Click Element  ${xpath_second_event_select}
343   Common Event Log Click Element  ${action_element}
344   ...  ${action_click_confirmation}
345
346Navigate To Event Log Page
347   [Documentation]  Go to event log page from BMC homepage.
348
349   Launch Browser And Login OpenBMC GUI
350   Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
351   Click Element  ${xpath_select_server_health}
352   Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
353   Wait Until Page Contains  Event Log
354
355Test Setup Execution
356   [Documentation]  Do test case setup tasks.
357
358   ${status}=  Run Keyword And Return Status  Logging Test Binary Exist
359   Run Keyword If  ${status} == ${False}  Install Tarball
360   Delete Error Logs And Verify
361
362   Navigate To Event Log Page
363
364Test Teardown Execution
365   [Documentation]  Do the post test teardown.
366
367   FFDC On Test Case Fail
368   Delete All Error Logs
369   Close All Connections
370   Close Browser
371
372Delete Remote Logging Server
373   [Documentation]  Delete remote logging server entry.
374
375   Click Button  ${xpath_delete_remote_server}
376   Click Button  ${xpath_remove_button}
377
378Setup For Remote Logging Server
379   [Documentation]  Test setup for remote logging server page.
380
381   Navigate To Event Log Page
382
383   # An entry for remote server may not exist so ignoring if there is a fail
384   # when deleting the entry.
385   Run Keyword And Ignore Error  Delete Remote Logging Server
386   Click Button  ${xpath_add_server}
387   Page Should Contain  Add remote logging server
388
389Teardown For Remote Logging Server
390   [Documentation]  Test teardown for remote logging server page.
391
392   Click Button  ${xpath_cancel_button}
393   FFDC On Test Case Fail
394   Close Browser
395