xref: /openbmc/openbmc-test-automation/gui/test/gui_header/test_obmc_gui_server_health.robot (revision f133e8b61580620f1285d5a0413cbea7f078a05f)
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    IF  ${number_of_events} > 0
144       Click Element  ${xpath_mark_as_resolved}
145    END
146    Element Should Be Disabled  ${xpath_mark_as_resolved}
147
148
149Select All Error Logs And Click Export
150    [Documentation]  Select all error logs and click export element.
151    [Tags]  Select_All_Error_Logs_And_Click_Export
152
153    Create Test Error Log
154    Create Test Error Log
155    Click Element  ${xpath_select_refresh_button}
156    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
157    Page Should Contain Element  ${xpath_number_of_events}
158    ${number_of_events}=  Get Text  ${xpath_number_of_events}
159    Click Element  ${xpath_select_all_events}
160    Page Should Contain Element  ${xpath_events_export}
161    IF  ${number_of_events} > 0
162      Click Element  ${xpath_events_export}
163    END
164
165Select All Error Logs And Delete
166    [Documentation]  Select all error logs and delete them.
167    [Tags]  Select_All_Error_Logs_And_Delete
168
169    Create Test Error Log
170    Create Test Error Log
171    Click Element  ${xpath_select_refresh_button}
172    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
173    Page Should Contain Element  ${xpath_number_of_events}
174    ${number_of_events}=  Get Text  ${xpath_number_of_events}
175    IF  ${number_of_events} > 0
176       Common Event Log Click Element  ${xpath_individual_event_delete}
177       ${xpath_yes_button}  ${xpath_select_all_events}
178    END
179    ${number_of_events}=  Get Text  ${xpath_number_of_events}
180    Should Be Equal  ${number_of_events}  0
181
182
183Select Single Error Log And Delete
184    [Documentation]  Select single error log and delete it.
185    [Tags]  Select_Single_Error_Log_And_Delete
186
187    Create Test Error Log
188    # Refresh the GUI to get the latest update.
189    Click Element  ${xpath_select_refresh_button}
190    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
191    Page Should Contain Element  ${xpath_number_of_events}
192    ${number_of_events}=  Get Text  ${xpath_number_of_events}
193    IF  ${number_of_events} > 0
194       Common Event Log Click Element  ${xpath_individual_event_delete}
195       ${xpath_yes_button}
196    END
197    ${number_of_events}=  Get Text  ${xpath_number_of_events}
198    Should Be Equal  ${number_of_events}  0
199    ...  msg=Failed to delete single error log entry.
200
201
202Select Multiple Error Logs And Delete
203    [Documentation]  Select multiple error logs and delete them.
204    [Tags]  Select_Multiple_Error_Logs_And_Delete
205
206    Create Test Error Log
207    Create Test Error Log
208    # Refresh the GUI to get the latest update.
209    Click Element  ${xpath_select_refresh_button}
210    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
211    Page Should Contain Element  ${xpath_number_of_events}
212    ${number_of_events}=  Get Text  ${xpath_number_of_events}
213    IF  ${number_of_events} > 0
214       Double Event Log Click Element  ${xpath_individual_event_delete}
215       ${xpath_yes_button}
216    END
217    ${number_of_events}=  Get Text  ${xpath_number_of_events}
218    Should Be Equal  ${number_of_events}  0
219    ...  msg=Failed to delete multiple error log entries.
220
221
222Select Single Error Log And Mark As Resolved
223    [Documentation]  Select single error log and mark as resolved.
224    [Tags]  Select_Single_Error_Log_And_Mark_As_Resolved
225
226    Create Test Error Log
227    # Refresh the GUI to get the latest update.
228    Click Element  ${xpath_select_refresh_button}
229    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
230    Page Should Contain Element  ${xpath_number_of_events}
231    ${number_of_events}=  Get Text  ${xpath_number_of_events}
232    IF  ${number_of_events} > 0
233       Common Event Log Click Element  ${xpath_individual_event_resolved}
234    END
235    ${number_of_events}=  Get Text  ${xpath_number_of_events}
236    Should Be Equal  ${number_of_events}  1
237    ...  msg=Failed to mark single error log entry as resolved.
238
239
240Select Multiple Error Logs And Mark As Resolved
241    [Documentation]  Select multiple error logs and mark as resolved.
242    [Tags]  Select_Multiple_Error_Logs_And_Mark_As_Resolved
243
244    Create Test Error Log
245    Create Test Error Log
246    # Refresh the GUI to get the latest update.
247    Click Element  ${xpath_select_refresh_button}
248    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
249    Page Should Contain Element  ${xpath_number_of_events}
250    ${number_of_events}=  Get Text  ${xpath_number_of_events}
251    IF  ${number_of_events} > 0
252       Double Event Log Click Element  ${xpath_individual_event_resolved}
253    END
254    ${number_of_events}=  Get Text  ${xpath_number_of_events}
255    Should Be Equal  ${number_of_events}  2
256    ...  msg=Failed to mark multiple error log entries as resolved.
257
258
259Select Single Error Log And Export
260    [Documentation]  Select single error log and export.
261    [Tags]  Select_Single_Error_Log_And_Export
262
263    Create Test Error Log
264    # Refresh the GUI to get the latest update.
265    Click Element  ${xpath_select_refresh_button}
266    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
267    Page Should Contain Element  ${xpath_number_of_events}
268    ${number_of_events}=  Get Text  ${xpath_number_of_events}
269    IF  ${number_of_events} > 0
270       Common Event Log Click Element  ${xpath_individual_event_export}
271    END
272    ${number_of_events}=  Get Text  ${xpath_number_of_events}
273    Should Be Equal  ${number_of_events}  1
274    ...  msg=Failed to export single error log entry.
275
276
277Select Multiple Error Log And Export
278    [Documentation]  Select multiple error log and export.
279    [Tags]  Select_Multiple_Error_Log_And_Export
280
281    Create Test Error Log
282    Create Test Error Log
283    # Refresh the GUI to get the latest update.
284    Click Element  ${xpath_select_refresh_button}
285    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
286    Page Should Contain Element  ${xpath_number_of_events}
287    ${number_of_events}=  Get Text  ${xpath_number_of_events}
288    IF  ${number_of_events} > 0
289       Double Event Log Click Element  ${xpath_individual_event_export}
290    END
291    ${number_of_events}=  Get Text  ${xpath_number_of_events}
292    Should Be Equal  ${number_of_events}  2
293    ...  msg=Failed to export multiple error log entries.
294
295
296Verify Existence Of All Buttons In Remote Logging Server Page
297    [Documentation]  Verify existence of all buttons in remote logging server
298    ...              page.
299    [Tags]  Verify_Existence_Of_All_Buttons_In_Remote_Logging_Server_Page
300    [Setup]  Setup For Remote Logging Server
301    [Teardown]  Teardown For Remote Logging Server
302
303    Page Should Contain Button  ${xpath_cancel_button}
304    Page Should Contain Button  ${xpath_add_button}
305
306
307Verify Existence Of All Input Boxes In Remote Logging Server Page
308    [Documentation]  Verify existence of all input boxes in remote logging server
309    ...              page.
310    [Tags]  Verify_Existence_Of_All_Input_Boxes_In_Remote_Logging_Server_Page
311    [Setup]  Setup For Remote Logging Server
312    [Teardown]  Teardown For Remote Logging Server
313
314    Page Should Contain Textfield  ${xpath_remote_server_ip}
315    Page Should Contain Textfield  ${xpath_remote_server_port}
316
317*** Keywords ***
318
319Common Event Log Click Element
320   [Documentation]  Keep common click elements associated with event log.
321   [Arguments]  ${action_element}  ${action_click_confirmation}=${None}
322   ...  ${xpath_event_select}=${xpath_individual_event_select}
323
324    # Description of argument(s):
325    # action_element             xpath value of the element to be actioned
326    #                            (e.g. "Delete" or "Resolved" or "Export").
327    # action_click_confirmation  Confirmation of action by pressing yes
328    #                            (e.g.  "Yes" or "No").
329    # xpath_event_select         xpath to select event log.
330
331    Click Element  ${xpath_event_select}
332    Page Should Contain Element  ${action_element}
333    Click Element  ${action_element}
334    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
335    IF  "${action_click_confirmation}" != "${None}"
336       Click Element  ${action_click_confirmation}
337    END
338    Click Element  ${xpath_select_refresh_button}
339    Run Key  Sleep \ 50s
340
341Double Event Log Click Element
342   [Documentation]  Keep double click elements associated with event logs.
343   [Arguments]  ${action_element}  ${action_click_confirmation}=${None}
344
345    # Description of argument(s):
346    # action_element             xpath value of the element to be actioned
347    #                            (e.g. "Delete" or "Resolved" or "Export").
348    # action_click_confirmation  Confirmation of action by pressing yes
349    #                            (e.g.  "Yes" or "No").
350
351   Click Element  ${xpath_second_event_select}
352   Common Event Log Click Element  ${action_element}
353   ...  ${action_click_confirmation}
354
355Navigate To Event Log Page
356   [Documentation]  Go to event log page from BMC homepage.
357
358   Launch Browser And Login OpenBMC GUI
359   Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
360   Click Element  ${xpath_select_server_health}
361   Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
362   Wait Until Page Contains  Event Log
363
364Test Setup Execution
365   [Documentation]  Do test case setup tasks.
366
367   ${status}=  Run Keyword And Return Status  Logging Test Binary Exist
368   IF  ${status} == ${False}  Install Tarball
369   Delete Error Logs And Verify
370
371   Navigate To Event Log Page
372
373Test Teardown Execution
374   [Documentation]  Do the post test teardown.
375
376   FFDC On Test Case Fail
377   Delete All Error Logs
378   Close All Connections
379   Close Browser
380
381Delete Remote Logging Server
382   [Documentation]  Delete remote logging server entry.
383
384   Click Button  ${xpath_delete_remote_server}
385   Click Button  ${xpath_remove_button}
386
387Setup For Remote Logging Server
388   [Documentation]  Test setup for remote logging server page.
389
390   Navigate To Event Log Page
391
392   # An entry for remote server may not exist so ignoring if there is a fail
393   # when deleting the entry.
394   Run Keyword And Ignore Error  Delete Remote Logging Server
395   Click Button  ${xpath_add_server}
396   Page Should Contain  Add remote logging server
397
398Teardown For Remote Logging Server
399   [Documentation]  Test teardown for remote logging server page.
400
401   Click Button  ${xpath_cancel_button}
402   FFDC On Test Case Fail
403   Close Browser
404