Keeping only openbmc gui related files under gui folder
Change-Id: I16be748571e9842fe8293ad8137a51730eb21613
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/gui/test/gui_header/test_obmc_gui_ip_refresh_check.robot b/gui/test/gui_header/test_obmc_gui_ip_refresh_check.robot
new file mode 100644
index 0000000..76d1bf6
--- /dev/null
+++ b/gui/test/gui_header/test_obmc_gui_ip_refresh_check.robot
@@ -0,0 +1,89 @@
+*** Settings ***
+
+Documentation Test Open BMC GUI BMC host information under GUI Header.
+
+Library DateTime
+
+Resource ../../lib/resource.robot
+
+Suite Setup Launch Browser And Login OpenBMC GUI
+Suite Teardown Close Browser
+
+
+*** Variables ***
+${xpath_select_server_control} //*[@id="header__wrapper"]/div/div[2]/p[2]
+${xpath_select_refresh_button} //*[@id="header__wrapper"]/div/div[3]/button
+${xpath_select_date_text} //*[@id="header__wrapper"]/div/div[3]/p/span
+${xpath_header_scroll_front} //*[@id="header__wrapper"]/div/div[3]/a[1]/span
+${xpath_header_scroll_back} //*[@id="header__wrapper"]/div/div[3]/a[1]/i
+
+*** Test Cases ***
+
+Verify IP address
+ [Documentation] Verify BMC IP address displayed in GUI header.
+ [Tags] Verify_IP_address
+
+ # NOTE: gui_displayed_ip can be either a host name or an IP address.
+ # (e.g. "machinex" or "xx.xx.xx.xx").
+ ${gui_displayed_ip}= Get Text ${xpath_select_server_control}
+ Should Contain ${gui_displayed_ip} ${OPENBMC_HOST}
+
+
+Verify Refresh Button
+ [Documentation] Verify Refresh Button in GUI header.
+ [Tags] Verify_Refresh_Button
+
+ # Verify power is on after refresh button.
+
+ Expected Initial Test State Off
+ Click Element ${xpath_select_refresh_button}
+ GUI Power On
+ Click Element ${xpath_select_refresh_button}
+ Wait Until Page Contains Running
+
+Verify Date Last Refreshed
+ [Documentation] Verify Date Last Refreshed text in GUI header.
+ [Tags] Verify_Date_Last_Refreshed
+
+ ${date_info_1st_read}= Get Text ${xpath_select_date_text}
+ ${current_date}= Get Time
+ ${date_conversion}= Convert Date ${current_date} result_format=%b %d %Y
+
+ ${mmmdd} ${yyyy}= Split String From Right ${date_conversion} ${SPACE} 1
+ Should Contain ${date_info_1st_read} ${mmmdd} msg=Month and day mismatch.
+ Should Contain ${date_info_1st_read} ${yyyy} msg=Year mismatch.
+
+ # Refresh button pressed.
+ Click Element ${xpath_select_refresh_button}
+ Sleep 2s
+
+ ${date_info_2nd_read}= Get Text ${xpath_select_date_text}
+ ${current_date}= Get Time
+ ${date_conversion}= Convert Date ${current_date} result_format=%b %d %Y
+
+ ${mmmdd} ${yyyy}= Split String From Right ${date_conversion} ${SPACE} 1
+ Should Contain ${date_info_1st_read} ${mmmdd} msg=Month and day mismatch.
+ Should Contain ${date_info_1st_read} ${yyyy} msg=Year mismatch.
+
+ # Comparison between 1st and 2nd read.
+ Should Not Be Equal As Strings ${date_info_1st_read}
+ ... ${date_info_2nd_read}
+
+Verify GUI Header Scrolls
+ [Documentation] Verify GUI header scrolls on click "Server Info" element.
+ [Tags] Verify_GUI_Header_Scrolls
+
+ ${current_browser_width} ${current_browser_height}= Get Window Size
+ Maximize Browser Window
+ ${max_browser_width} ${max_browser_height}= Get Window Size
+ # Shrink the browser to half from max size.
+ ${shrink_browser_width}= Evaluate ${max_browser_width} / 2
+ ${shrink_browser_height}= Evaluate ${max_browser_height} / 2
+ # Reduce the browser size which enables scroll element.
+ Set Window Size ${shrink_browser_width} ${shrink_browser_height}
+ Click Element ${xpath_header_scroll_front}
+ # Below element is to scroll back.
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Click Element ${xpath_header_scroll_back}
+ # Restore to original browser size.
+ Set Window Size ${current_browser_width} ${current_browser_height}
diff --git a/gui/test/gui_header/test_obmc_gui_power_operations.robot b/gui/test/gui_header/test_obmc_gui_power_operations.robot
new file mode 100644
index 0000000..56bd9c6
--- /dev/null
+++ b/gui/test/gui_header/test_obmc_gui_power_operations.robot
@@ -0,0 +1,145 @@
+*** Settings ***
+
+Documentation Test Open BMC GUI Power Operations under GUI Header.
+
+Resource ../../../lib/state_manager.robot
+Resource ../../lib/resource.robot
+
+Test Setup Test Setup Execution
+Test Teardown Close Browser
+
+*** Test Cases ***
+
+Power On The Host
+ [Documentation] Power on the host.
+ [Tags] Power_On_the_Host
+
+ Expected Initial Test State Off
+ GUI Power On
+ Wait Until Keyword Succeeds 10 min 10 sec Is Host Running
+ Wait Until Page Contains Running
+
+Click Immediate Shutdown Then No
+ [Documentation] Click the "Immediate shutdown" button and then click the
+ ... "No" button.
+ [Tags] Click_Immediate_Shutdown_Then_No
+
+ Expected Initial Test State Running
+ Controller Server Power Click Button power__hard-shutdown
+ Controller Power Operations Confirmation Click Button ${power_operations}
+ ... ${power_off} ${confirm_msg} ${no}
+
+ Is Host Running
+ Wait Until Page Contains Running
+
+Click Cold Reboot Then No
+ [Documentation] Click the "Cold reboot" button and then click the "No"
+ ... button.
+ [Tags] Click_Cold_Reboot_Then_No
+
+ Expected Initial Test State Running
+ Controller Server Power Click Button power__cold-boot
+ Controller Power Operations Confirmation Click Button ${power_operations}
+ ... ${cold_boot} ${confirm_msg} ${no}
+
+ Is Host Running
+ Page Should Contain Running
+
+Click Warm Reboot Then No
+ [Documentation] Click the "Warm reboot" button and then click the "No"
+ ... button.
+ [Tags] Click_Warm_Reboot_Then_No
+
+ Expected Initial Test State Running
+ Controller Server Power Click Button power__warm-boot
+ Controller Power Operations Confirmation Click Button ${power_operations}
+ ... ${warm_boot} ${confirm_msg} ${no}
+ Is Host Running
+ Page Should Contain Running
+
+Click Orderly Shutdown Then No
+ [Documentation] Click the "Orderly shutdown" button and then click the
+ ... "No" button.
+ [Tags] Click_Orderly_Shutdown_Then_No
+
+ Expected Initial Test State Running
+ Controller Server Power Click Button power__soft-shutdown
+ Controller Power Operations Confirmation Click Button ${power_operations}
+ ... ${shut_down} ${confirm_msg} ${no}
+ Wait Until Keyword Succeeds 10 min 10 sec Is Host Running
+ Page Should Contain Running
+
+Click Warm Reboot Then Yes
+ [Documentation] Click the "Warm reboot" button and then click the "Yes"
+ ... button.
+ [Tags] Click_Warm_Reboot_Then_Yes
+
+ Expected Initial Test State Running
+ Controller Server Power Click Button power__warm-boot
+ Controller Power Operations Confirmation Click Button ${power_operations}
+ ... ${warm_boot} ${confirm_msg} ${yes}
+ Wait Until Keyword Succeeds 10 min 10 sec Is Host Running
+ Page Should Contain Running
+
+Click Cold Reboot Then Yes
+ [Documentation] Click the "Cold reboot" button and then click the "Yes"
+ ... button.
+ [Tags] Click_Cold_Reboot_Then_Yes
+
+ Expected Initial Test State Running
+ Controller Server Power Click Button power__cold-boot
+ Controller Power Operations Confirmation Click Button ${power_operations}
+ ... ${cold_boot} ${confirm_msg} ${yes}
+ Page Should Contain Standby
+ Wait Until Keyword Succeeds 10 min 10 sec Is Host Running
+ Page Should Contain Running
+
+Click Orderly Shutdown Then Yes
+ [Documentation] Click the "Orderly shutdown" button and then click the
+ ... "Yes" button.
+ [Tags] Click_Orderly_Shutdown_Then_Yes
+
+ Expected Initial Test State Running
+ Controller Server Power Click Button power__soft-shutdown
+ Controller Power Operations Confirmation Click Button ${power_operations}
+ ... ${shut_down} ${confirm_msg} ${yes}
+ Page Should Contain Off
+ Wait Until Keyword Succeeds 6 min 10 sec Is Host Off
+
+Click Immediate Shutdown Then Yes
+ [Documentation] Click "Immediate shutdown" button and then click the "Yes"
+ ... button.
+ [Tags] Click_Immediate_Shutdown_Then_Yes
+
+ Expected Initial Test State Running
+
+ # By this time GUI logs out. So relaunching it.
+ Close Browser
+ Launch Browser And Login OpenBMC GUI
+
+ Controller Server Power Click Button power__hard-shutdown
+ Controller Power Operations Confirmation Click Button ${power_operations}
+ ... ${power_off} ${confirm_msg} ${yes}
+
+ Wait Until Page Contains Off
+ Wait Until Keyword Succeeds 6 min 10 sec Is Host Off
+
+OpenBMC GUI Logoff
+ [Documentation] Log out from openBMC GUI.
+ [Tags] OpenBMC_GUI_Logoff
+
+ Log ${xpath_openbmc_url}
+ Log To Console ${xpath_openbmc_url}
+ Click Element header
+
+
+*** Keywords ***
+
+Test Setup Execution
+ [Documentation] Do testcase setup tasks.
+
+ # Launch the GUI and navigate to server power page.
+ Launch Browser And Login OpenBMC GUI
+ Click Element ${xpath_select_server_power}
+ Wait Until Page Contains Server power operations
+
diff --git a/gui/test/gui_header/test_obmc_gui_server_health.robot b/gui/test/gui_header/test_obmc_gui_server_health.robot
new file mode 100644
index 0000000..88fdd69
--- /dev/null
+++ b/gui/test/gui_header/test_obmc_gui_server_health.robot
@@ -0,0 +1,330 @@
+*** Settings ***
+
+Documentation Test Open BMC GUI server health under GUI Header.
+
+Resource ../../lib/resource.robot
+Resource ../../../lib/boot_utils.robot
+Resource ../../../lib/utils.robot
+Resource ../../../lib/openbmc_ffdc.robot
+Resource ../../../lib/state_manager.robot
+Resource ../../../lib/openbmc_ffdc_methods.robot
+Resource ../../../lib/dump_utils.robot
+Resource ../../../lib/logging_utils.robot
+Library ../../../lib/gen_robot_keyword.py
+
+Test Setup Test Setup Execution
+Test Teardown Test Teardown Execution
+
+
+*** Test Cases ***
+
+Verify Event Log Text Appears By Clicking Server Health
+ [Documentation] Check that "Event Log" text appears by clicking server
+ ... health in GUI header.
+ [Tags] Verify_Event_Log_Text_Appears_By_Clicking_Server_Health
+
+ Wait Until Page Contains Element event-log
+ Page should contain Event log
+
+
+Verify Filters By Severity Elements Appears
+ [Documentation] Check that the "event log" filters appears by clicking
+ ... server health in GUI header.
+ [Tags] Verify_Filters_By_Severity_Elements_Appears
+
+ # Types of event severity: All, High, Medium, Low.
+ Page Should Contain Element ${xpath_event_severity_all} limit=1
+ Page Should Contain Element ${xpath_event_severity_high} limit=1
+ Page Should Contain Element ${xpath_event_severity_medium} limit=1
+ Page Should Contain Element ${xpath_event_severity_low} limit=1
+
+
+Verify Drop Down Button User Timezone Appears
+ [Documentation] Check that the "drop down" button of user timezone appears
+ ... by clicking server health in GUI header.
+ [Tags] Verify_Drop_Down_Button_User_Timezone_Appears
+
+ Page Should Contain Button ${xpath_drop_down_timezone_edt}
+ # Ensure that page is not in refreshing state.
+ # It helps to click the drop down element.
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Click Element //*[@class='dropdown__button']
+ Page Should Contain Button ${xpath_drop_down_timezone_utc}
+
+
+Verify Content Search Element Appears
+ [Documentation] Check that the "event search element is available with
+ ... filter" button appears.
+ [Tags] Verify_Content_Search_Element_Appears
+
+ Page Should Contain Element content__search-input limit=1
+ # Ensure that page is not in refreshing state.
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Page Should Contain Button content__search-submit
+
+
+Verify Filter By Date Element Appears
+ [Documentation] Check that the "filter by date" elements are available and
+ ... visible.
+ [Tags] Verify_Filter_By_Date_Element_Appears
+
+ Wait Until Element Is Visible event-filter-start-date
+ Page Should Contain Element event-filter-start-date limit=1
+ Page Should Contain Element event-filter-end-date limit=1
+
+
+Verify Filter By Event Status Element Appears
+ [Documentation] Check that the "filter by event status" element appears.
+ [Tags] Verify_Filter_By_Event_Status_Element_Appears
+
+ # Ensure that page is not in refreshing state.
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Wait Until Element is Visible //*[@class='dropdown__wrapper']
+ Click Element //*[@class='dropdown__wrapper']
+ Page Should Contain Element ${xpath_event_filter_all} limit=1
+ Page Should Contain Element ${xpath_event_filter_resolved} limit=1
+ Page Should Contain Element ${xpath_event_filter_unresolved} limit=1
+
+
+Verify Event Action Bar Element Appears
+ [Documentation] Check that "event action bar" element appears.
+ [Tags] Verify_Event_Action_Bar_Element_Appears
+
+ # Ensure that page is not in refreshing state.
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Page Should Contain Element ${xpath_event_action_bars} limit=1
+ Page Should Contain Element //*[@class='control__indicator']
+
+
+Verify Click Events Check Box
+ [Documentation] Check that "event check box" element appears and on click
+ ... should be able to see elements like "Delete" button and "Export"
+ ... element.
+ [Tags] Verify_Click_Events_Check_Box
+
+ # Ensure that page is not in refreshing state.
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Click Element //*[@class='control__indicator']
+ Page Should Contain Button ${xpath_event_action_delete} limit=1
+ Page Should Contain Element ${xpath_event_action_export} limit=1
+
+
+Verify Number of Events Appears
+ [Documentation] Check that "number of events" element appears and value is
+ ... visible.
+ [Tags] Verify_Number_of_Events_Appears
+
+ # Ensure that page is not in refreshing state.
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Page Should Contain Element ${xpath_number_of_events}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Log To Console \n Number of Events:${number_of_events}
+
+
+Select All Error Logs And Mark As Resolved
+ [Documentation] Select all error logs and mark them as resolved.
+ [Tags] Select_All_Error_Logs_And_Mark_As_Resolved
+
+ Create Test Error Log
+ Create Test Error Log
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Page Should Contain Element ${xpath_number_of_events}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Click Element //*[@class='control__indicator']
+ Run Keyword If ${number_of_events} > 0
+ ... Click Element ${xpath_mark_as_resolved}
+ Element Should Be Disabled ${xpath_mark_as_resolved}
+
+
+Select All Error Logs And Click Export
+ [Documentation] Select all error logs and click export element.
+ [Tags] Select_All_Error_Logs_And_Click_Export
+
+ Create Test Error Log
+ Create Test Error Log
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Page Should Contain Element ${xpath_number_of_events}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Click Element //*[@class='control__indicator']
+ Page Should Contain Element ${xpath_events_export}
+ Run Keyword If ${number_of_events} > 0
+ ... Click Element ${xpath_events_export}
+
+
+Select All Error Logs And Delete
+ [Documentation] Select all error logs and delete them.
+ [Tags] Select_All_Error_Logs_And_Delete
+
+ Create Test Error Log
+ Create Test Error Log
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Page Should Contain Element ${xpath_number_of_events}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Click Element //*[@class='control__indicator']
+ Page Should Contain Button ${xpath_event_action_delete}
+ Run Keyword If ${number_of_events} > 0
+ ... Click Element ${xpath_event_action_delete}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Should Be Equal ${number_of_events} 0
+
+
+Select Single Error Log And Delete
+ [Documentation] Select single error log and delete it.
+ [Tags] Select_Single_Error_Log_And_Delete
+
+ Create Test Error Log
+ # Refresh the GUI to get the latest update.
+ Click Element ${xpath_select_refresh_button}
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Page Should Contain Element ${xpath_number_of_events}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Run Keyword If ${number_of_events} > 0
+ ... Common Event Log Click Element ${xpath_individual_event_delete}
+ ... ${xpath_yes_button}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Should Be Equal ${number_of_events} 0
+ ... msg=Failed to delete single error log entry.
+
+
+Select Multiple Error Logs And Delete
+ [Documentation] Select multiple error logs and delete them.
+ [Tags] Select_Multiple_Error_Logs_And_Delete
+
+ Create Test Error Log
+ Create Test Error Log
+ # Refresh the GUI to get the latest update.
+ Click Element ${xpath_select_refresh_button}
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Page Should Contain Element ${xpath_number_of_events}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Run Keyword If ${number_of_events} > 0
+ ... Double Event Log Click Element ${xpath_individual_event_delete}
+ ... ${xpath_yes_button}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Should Be Equal ${number_of_events} 0
+ ... msg=Failed to delete multiple error log entries.
+
+
+Select Single Error Log And Mark As Resolved
+ [Documentation] Select single error log and mark as resolved.
+ [Tags] Select_Single_Error_Log_And_Mark_As_Resolved
+
+ Create Test Error Log
+ # Refresh the GUI to get the latest update.
+ Click Element ${xpath_select_refresh_button}
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Page Should Contain Element ${xpath_number_of_events}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Run Keyword If ${number_of_events} > 0
+ ... Common Event Log Click Element ${xpath_individual_event_resolved}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Should Be Equal ${number_of_events} 1
+ ... msg=Failed to mark single error log entry as resolved.
+
+
+Select Multiple Error Logs And Mark As Resolved
+ [Documentation] Select multiple error logs and mark as resolved.
+ [Tags] Select_Multiple_Error_Logs_And_Mark_As_Resolved
+
+ Create Test Error Log
+ Create Test Error Log
+ # Refresh the GUI to get the latest update.
+ Click Element ${xpath_select_refresh_button}
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Page Should Contain Element ${xpath_number_of_events}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Run Keyword If ${number_of_events} > 0
+ ... Double Event Log Click Element ${xpath_individual_event_resolved}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Should Be Equal ${number_of_events} 2
+ ... msg=Failed to mark multiple error log entries as resolved.
+
+
+Select Single Error Log And Export
+ [Documentation] Select single error log and export.
+ [Tags] Select_Single_Error_Log_And_Export
+
+ Create Test Error Log
+ # Refresh the GUI to get the latest update.
+ Click Element ${xpath_select_refresh_button}
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Page Should Contain Element ${xpath_number_of_events}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Run Keyword If ${number_of_events} > 0
+ ... Common Event Log Click Element ${xpath_individual_event_export}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Should Be Equal ${number_of_events} 1
+ ... msg=Failed to export single error log entry.
+
+
+Select Multiple Error Log And Export
+ [Documentation] Select multiple error log and export.
+ [Tags] Select_Multiple_Error_Log_And_Export
+
+ Create Test Error Log
+ Create Test Error Log
+ # Refresh the GUI to get the latest update.
+ Click Element ${xpath_select_refresh_button}
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Page Should Contain Element ${xpath_number_of_events}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Run Keyword If ${number_of_events} > 0
+ ... Double Event Log Click Element ${xpath_individual_event_export}
+ ${number_of_events}= Get Text ${xpath_number_of_events}
+ Should Be Equal ${number_of_events} 2
+ ... msg=Failed to export multiple error log entries.
+
+*** Keywords ***
+
+Common Event Log Click Element
+ [Documentation] Keep common click elements associated with event log.
+ [Arguments] ${action_element} ${action_click_confirmation}=${None}
+
+ # Description of argument(s):
+ # action_element xpath value of the element to be actioned
+ # (e.g. "Delete" or "Resolved" or "Export").
+ # action_click_confirmation Confirmation of action by pressing yes
+ # (e.g. "Yes" or "No").
+
+ Click Element ${xpath_individual_event_select}
+ Page Should Contain Element ${action_element}
+ Click Element ${action_element}
+ Wait Until Page Does Not Contain Element ${xpath_refresh_circle}
+ Run Keyword If "${action_click_confirmation}" != "${None}"
+ ... Click Element ${action_click_confirmation}
+ Click Element ${xpath_select_refresh_button}
+ Run Key Sleep \ 50s
+
+Double Event Log Click Element
+ [Documentation] Keep double click elements associated with event logs.
+ [Arguments] ${action_element} ${action_click_confirmation}=${None}
+
+ # Description of argument(s):
+ # action_element xpath value of the element to be actioned
+ # (e.g. "Delete" or "Resolved" or "Export").
+ # action_click_confirmation Confirmation of action by pressing yes
+ # (e.g. "Yes" or "No").
+
+ Click Element ${xpath_second_event_select}
+ Common Event Log Click Element ${action_element}
+ ... ${action_click_confirmation}
+
+Test Setup Execution
+ [Documentation] Do test case setup tasks.
+
+ ${status}= Run Keyword And Return Status Logging Test Binary Exist
+ Run Keyword If ${status} == ${False} Install Tarball
+ Delete Error Logs And Verify
+
+ # Launch the GUI and navigate to server health page.
+ Launch Browser And Login OpenBMC GUI
+ Click Element ${xpath_select_server_health}
+ Wait Until Page Contains Event log
+
+Test Teardown Execution
+ [Documentation] Do the post test teardown.
+
+ FFDC On Test Case Fail
+ Delete All Error Logs
+ Close All Connections
+ Close Browser