1b89977a4SRahul Maheshwari*** Settings ***
2b89977a4SRahul Maheshwari
3b89977a4SRahul MaheshwariDocumentation  Test Open BMC GUI BMC host information under GUI Header.
4b89977a4SRahul Maheshwari
5b89977a4SRahul MaheshwariLibrary        DateTime
6b89977a4SRahul Maheshwari
7b89977a4SRahul MaheshwariResource        ../../lib/resource.robot
8b89977a4SRahul Maheshwari
9b89977a4SRahul MaheshwariSuite Setup     Launch Browser And Login OpenBMC GUI
10b89977a4SRahul MaheshwariSuite Teardown  Close Browser
11b89977a4SRahul Maheshwari
12b89977a4SRahul Maheshwari
13b89977a4SRahul Maheshwari*** Variables ***
14b89977a4SRahul Maheshwari${xpath_select_server_control}  //*[@id="header__wrapper"]/div/div[2]/p[2]
15b89977a4SRahul Maheshwari${xpath_select_refresh_button}  //*[@id="header__wrapper"]/div/div[3]/button
16b89977a4SRahul Maheshwari${xpath_select_date_text}       //*[@id="header__wrapper"]/div/div[3]/p/span
17b89977a4SRahul Maheshwari${xpath_header_scroll_front}    //*[@id="header__wrapper"]/div/div[3]/a[1]/span
18b89977a4SRahul Maheshwari${xpath_header_scroll_back}     //*[@id="header__wrapper"]/div/div[3]/a[1]/i
19b89977a4SRahul Maheshwari
20b89977a4SRahul Maheshwari*** Test Cases ***
21b89977a4SRahul Maheshwari
22*272c5b7aSArpana DurgaprasadVerify Server Power Button
23*272c5b7aSArpana Durgaprasad    [Documentation]  Verify server power page on clicking server power button.
24*272c5b7aSArpana Durgaprasad    [Tags]  Verify_Server_Power_Button
25*272c5b7aSArpana Durgaprasad
26*272c5b7aSArpana Durgaprasad    Click Button  ${xpath_select_server_power}
27*272c5b7aSArpana Durgaprasad    Wait Until Page Contains  Select a power operation
28*272c5b7aSArpana Durgaprasad
29*272c5b7aSArpana DurgaprasadVerify Server Health Button
30*272c5b7aSArpana Durgaprasad    [Documentation]  Verify server health page on clicking server health button.
31*272c5b7aSArpana Durgaprasad    [Tags]  Verify_Server_Health_Button
32*272c5b7aSArpana Durgaprasad
33*272c5b7aSArpana Durgaprasad    Click Button  ${xpath_select_server_health}
34*272c5b7aSArpana Durgaprasad    Wait Until Page Contains  All events from the BMC
35*272c5b7aSArpana Durgaprasad
36b89977a4SRahul MaheshwariVerify IP address
37b89977a4SRahul Maheshwari    [Documentation]  Verify BMC IP address displayed in GUI header.
38b89977a4SRahul Maheshwari    [Tags]  Verify_IP_address
39b89977a4SRahul Maheshwari
40b89977a4SRahul Maheshwari    # NOTE: gui_displayed_ip can be either a host name or an IP address.
41b89977a4SRahul Maheshwari    #       (e.g. "machinex" or "xx.xx.xx.xx").
42b89977a4SRahul Maheshwari    ${gui_displayed_ip}=  Get Text  ${xpath_select_server_control}
43b89977a4SRahul Maheshwari    Should Contain  ${gui_displayed_ip}  ${OPENBMC_HOST}
44b89977a4SRahul Maheshwari
45b89977a4SRahul Maheshwari
46b89977a4SRahul MaheshwariVerify Refresh Button
47b89977a4SRahul Maheshwari    [Documentation]  Verify Refresh Button in GUI header.
48b89977a4SRahul Maheshwari    [Tags]  Verify_Refresh_Button
49b89977a4SRahul Maheshwari
50b89977a4SRahul Maheshwari    # Verify power is on after refresh button.
51b89977a4SRahul Maheshwari
52b89977a4SRahul Maheshwari    Expected Initial Test State  Off
53b89977a4SRahul Maheshwari    Click Element  ${xpath_select_refresh_button}
54b89977a4SRahul Maheshwari    GUI Power On
55b89977a4SRahul Maheshwari    Click Element  ${xpath_select_refresh_button}
56b89977a4SRahul Maheshwari    Wait Until Page Contains  Running
57b89977a4SRahul Maheshwari
58b89977a4SRahul MaheshwariVerify Date Last Refreshed
59b89977a4SRahul Maheshwari    [Documentation]  Verify Date Last Refreshed text in GUI header.
60b89977a4SRahul Maheshwari    [Tags]  Verify_Date_Last_Refreshed
61b89977a4SRahul Maheshwari
62b89977a4SRahul Maheshwari    ${date_info_1st_read}=  Get Text  ${xpath_select_date_text}
63b89977a4SRahul Maheshwari    ${current_date}=  Get Time
64b89977a4SRahul Maheshwari    ${date_conversion}=  Convert Date  ${current_date}  result_format=%b %d %Y
65b89977a4SRahul Maheshwari
66b89977a4SRahul Maheshwari    ${mmmdd}  ${yyyy}=  Split String From Right  ${date_conversion}  ${SPACE}  1
67b89977a4SRahul Maheshwari    Should Contain  ${date_info_1st_read}  ${mmmdd}  msg=Month and day mismatch.
68b89977a4SRahul Maheshwari    Should Contain  ${date_info_1st_read}  ${yyyy}  msg=Year mismatch.
69b89977a4SRahul Maheshwari
70b89977a4SRahul Maheshwari    # Refresh button pressed.
71b89977a4SRahul Maheshwari    Click Element  ${xpath_select_refresh_button}
72b89977a4SRahul Maheshwari    Sleep  2s
73b89977a4SRahul Maheshwari
74b89977a4SRahul Maheshwari    ${date_info_2nd_read}=  Get Text  ${xpath_select_date_text}
75b89977a4SRahul Maheshwari    ${current_date}=  Get Time
76b89977a4SRahul Maheshwari    ${date_conversion}=  Convert Date  ${current_date}  result_format=%b %d %Y
77b89977a4SRahul Maheshwari
78b89977a4SRahul Maheshwari    ${mmmdd}  ${yyyy}=  Split String From Right  ${date_conversion}  ${SPACE}  1
79b89977a4SRahul Maheshwari    Should Contain  ${date_info_1st_read}  ${mmmdd}  msg=Month and day mismatch.
80b89977a4SRahul Maheshwari    Should Contain  ${date_info_1st_read}  ${yyyy}  msg=Year mismatch.
81b89977a4SRahul Maheshwari
82b89977a4SRahul Maheshwari    # Comparison between 1st and 2nd read.
83b89977a4SRahul Maheshwari    Should Not Be Equal As Strings  ${date_info_1st_read}
84b89977a4SRahul Maheshwari    ...  ${date_info_2nd_read}
85b89977a4SRahul Maheshwari
86b89977a4SRahul MaheshwariVerify GUI Header Scrolls
87b89977a4SRahul Maheshwari    [Documentation]  Verify GUI header scrolls on click "Server Info" element.
88b89977a4SRahul Maheshwari    [Tags]  Verify_GUI_Header_Scrolls
89b89977a4SRahul Maheshwari
90b89977a4SRahul Maheshwari    ${current_browser_width}  ${current_browser_height}=  Get Window Size
91b89977a4SRahul Maheshwari    Maximize Browser Window
92b89977a4SRahul Maheshwari    ${max_browser_width}  ${max_browser_height}=  Get Window Size
93b89977a4SRahul Maheshwari    # Shrink the browser to half from max size.
94b89977a4SRahul Maheshwari    ${shrink_browser_width}=  Evaluate  ${max_browser_width} / 2
95b89977a4SRahul Maheshwari    ${shrink_browser_height}=  Evaluate  ${max_browser_height} / 2
96b89977a4SRahul Maheshwari    # Reduce the browser size which enables scroll element.
97b89977a4SRahul Maheshwari    Set Window Size  ${shrink_browser_width}  ${shrink_browser_height}
98b89977a4SRahul Maheshwari    Click Element  ${xpath_header_scroll_front}
99b89977a4SRahul Maheshwari    # Below element is to scroll back.
100b89977a4SRahul Maheshwari    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
101b89977a4SRahul Maheshwari    Click Element  ${xpath_header_scroll_back}
102b89977a4SRahul Maheshwari    # Restore to original browser size.
103b89977a4SRahul Maheshwari    Set Window Size  ${current_browser_width}  ${current_browser_height}
104