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