GUI header scroll element test & code cleanup.
Resolves openbmc/openbmc-test-automation#1290
Resolves openbmc/openbmc-test-automation#1291
Change-Id: I67eb7f5ce89168f64ce7394c2b1d03dc186f5f5f
Signed-off-by: Sivas SRR <sivas.srr@in.ibm.com>
diff --git a/gui/obmc_gui/test/gui_header/test_obmc_gui_ip_refresh_check.robot b/gui/obmc_gui/test/gui_header/test_obmc_gui_ip_refresh_check.robot
index 06c2f18..5d7b608 100644
--- a/gui/obmc_gui/test/gui_header/test_obmc_gui_ip_refresh_check.robot
+++ b/gui/obmc_gui/test/gui_header/test_obmc_gui_ip_refresh_check.robot
@@ -6,13 +6,15 @@
Resource ../../lib/resource.robot
-Suite Setup Suite Setup Execution
-Suite Teardown Close Browser
+Suite Setup Launch Browser And Login OpenBMC GUI
+Suite Teardown Logout And 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 ***
@@ -25,6 +27,7 @@
${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
@@ -37,6 +40,7 @@
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
@@ -48,7 +52,7 @@
# Refresh button pressed.
Click Element ${xpath_select_refresh_button}
- Sleep 2
+ Sleep 2s
${date_info_2nd_read}= Get Text ${xpath_select_date_text}
${current_date}= Get Time
@@ -59,13 +63,22 @@
Should Not Be Equal As Strings ${date_info_1st_read}
... ${date_info_2nd_read}
-*** Keywords ***
-Suite Setup Execution
+Verify GUI Header Scrolls
+ [Documentation] Verify GUI header scrolls on click "Server Info" element.
+ [Tags] Verify_GUI_Header_Scrolls
- Open Browser With URL ${obmc_gui_url}
- Login OpenBMC GUI ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD}
-
-
-
-
+ ${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}