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 ***
14f7a407c4SAnusha Dathatri${xpath_bmc_ip}                 //*[contains(@class, "header__server-ip")]
157ea44c1bSAnusha Dathatri${xpath_select_refresh_button}  //*[text()[contains(.,"Refresh")]]
167ea44c1bSAnusha Dathatri${xpath_select_date_text}       //*[@class="header__refresh"]
177ea44c1bSAnusha Dathatri${xpath_header_scroll}          //*[contains(@class,"header__action")]
18b89977a4SRahul Maheshwari
19b89977a4SRahul Maheshwari*** Test Cases ***
20b89977a4SRahul Maheshwari
21272c5b7aSArpana DurgaprasadVerify Server Power Button
22272c5b7aSArpana Durgaprasad    [Documentation]  Verify server power page on clicking server power button.
23272c5b7aSArpana Durgaprasad    [Tags]  Verify_Server_Power_Button
24272c5b7aSArpana Durgaprasad
25f7a407c4SAnusha Dathatri    Wait Until Element Is Visible   ${xpath_select_server_power}
26f7a407c4SAnusha Dathatri    Click Element  ${xpath_select_server_power}
277ea44c1bSAnusha Dathatri    Wait Until Page Contains  Server power operations
28272c5b7aSArpana Durgaprasad
29272c5b7aSArpana DurgaprasadVerify Server Health Button
30272c5b7aSArpana Durgaprasad    [Documentation]  Verify server health page on clicking server health button.
31272c5b7aSArpana Durgaprasad    [Tags]  Verify_Server_Health_Button
32272c5b7aSArpana Durgaprasad
33f7a407c4SAnusha Dathatri    Wait Until Element Is Visible   ${xpath_select_server_health}
34f7a407c4SAnusha Dathatri    Click Element  ${xpath_select_server_health}
35272c5b7aSArpana Durgaprasad    Wait Until Page Contains  All events from the BMC
36272c5b7aSArpana Durgaprasad
37b89977a4SRahul MaheshwariVerify IP address
38b89977a4SRahul Maheshwari    [Documentation]  Verify BMC IP address displayed in GUI header.
39b89977a4SRahul Maheshwari    [Tags]  Verify_IP_address
40b89977a4SRahul Maheshwari
41b89977a4SRahul Maheshwari    # NOTE: gui_displayed_ip can be either a host name or an IP address.
42b89977a4SRahul Maheshwari    #       (e.g. "machinex" or "xx.xx.xx.xx").
43f7a407c4SAnusha Dathatri    ${gui_displayed_ip}=  Get Text  ${xpath_bmc_ip}
44b89977a4SRahul Maheshwari    Should Contain  ${gui_displayed_ip}  ${OPENBMC_HOST}
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
530a9ec76fSAnusha Dathatri    Wait Until Element Is Visible  ${xpath_select_refresh_button}
54b89977a4SRahul Maheshwari    Click Element  ${xpath_select_refresh_button}
55b89977a4SRahul Maheshwari    GUI Power On
560a9ec76fSAnusha Dathatri    Wait Until Element Is Visible  ${xpath_select_refresh_button}
57b89977a4SRahul Maheshwari    Click Element  ${xpath_select_refresh_button}
58b89977a4SRahul Maheshwari    Wait Until Page Contains  Running
59b89977a4SRahul Maheshwari
60b89977a4SRahul MaheshwariVerify Date Last Refreshed
61b89977a4SRahul Maheshwari    [Documentation]  Verify Date Last Refreshed text in GUI header.
62b89977a4SRahul Maheshwari    [Tags]  Verify_Date_Last_Refreshed
63b89977a4SRahul Maheshwari
640a9ec76fSAnusha Dathatri    Wait Until Element Is Visible  ${xpath_select_date_text}
65b89977a4SRahul Maheshwari    ${date_info_1st_read}=  Get Text  ${xpath_select_date_text}
660a9ec76fSAnusha Dathatri    Should Not Be Empty  ${date_info_1st_read}
67b89977a4SRahul Maheshwari    ${current_date}=  Get Time
687ea44c1bSAnusha Dathatri    ${date_conversion}=  Convert Date  ${current_date}  result_format=%b %-d %Y
69b89977a4SRahul Maheshwari
70b89977a4SRahul Maheshwari    ${mmmdd}  ${yyyy}=  Split String From Right  ${date_conversion}  ${SPACE}  1
71b89977a4SRahul Maheshwari    Should Contain  ${date_info_1st_read}  ${mmmdd}  msg=Month and day mismatch.
72b89977a4SRahul Maheshwari    Should Contain  ${date_info_1st_read}  ${yyyy}  msg=Year mismatch.
73b89977a4SRahul Maheshwari
74b89977a4SRahul Maheshwari    # Refresh button pressed.
75b89977a4SRahul Maheshwari    Click Element  ${xpath_select_refresh_button}
76b89977a4SRahul Maheshwari    Sleep  2s
77b89977a4SRahul Maheshwari
78b89977a4SRahul Maheshwari    ${date_info_2nd_read}=  Get Text  ${xpath_select_date_text}
79b89977a4SRahul Maheshwari    ${current_date}=  Get Time
807ea44c1bSAnusha Dathatri    ${date_conversion}=  Convert Date  ${current_date}  result_format=%b %-d %Y
81b89977a4SRahul Maheshwari
82b89977a4SRahul Maheshwari    ${mmmdd}  ${yyyy}=  Split String From Right  ${date_conversion}  ${SPACE}  1
83b89977a4SRahul Maheshwari    Should Contain  ${date_info_1st_read}  ${mmmdd}  msg=Month and day mismatch.
84b89977a4SRahul Maheshwari    Should Contain  ${date_info_1st_read}  ${yyyy}  msg=Year mismatch.
85b89977a4SRahul Maheshwari
86b89977a4SRahul Maheshwari    # Comparison between 1st and 2nd read.
87b89977a4SRahul Maheshwari    Should Not Be Equal As Strings  ${date_info_1st_read}
88b89977a4SRahul Maheshwari    ...  ${date_info_2nd_read}
89b89977a4SRahul Maheshwari
90b89977a4SRahul MaheshwariVerify GUI Header Scrolls
91b89977a4SRahul Maheshwari    [Documentation]  Verify GUI header scrolls on click "Server Info" element.
92b89977a4SRahul Maheshwari    [Tags]  Verify_GUI_Header_Scrolls
93b89977a4SRahul Maheshwari
94b89977a4SRahul Maheshwari    ${current_browser_width}  ${current_browser_height}=  Get Window Size
95b89977a4SRahul Maheshwari    Maximize Browser Window
96b89977a4SRahul Maheshwari    ${max_browser_width}  ${max_browser_height}=  Get Window Size
97b89977a4SRahul Maheshwari    # Shrink the browser to half from max size.
98b89977a4SRahul Maheshwari    ${shrink_browser_width}=  Evaluate  ${max_browser_width} / 2
99b89977a4SRahul Maheshwari    ${shrink_browser_height}=  Evaluate  ${max_browser_height} / 2
100b89977a4SRahul Maheshwari    # Reduce the browser size which enables scroll element.
101b89977a4SRahul Maheshwari    Set Window Size  ${shrink_browser_width}  ${shrink_browser_height}
102f7a407c4SAnusha Dathatri    Click Element  ${xpath_header_scroll}
103b89977a4SRahul Maheshwari    # Below element is to scroll back.
104b89977a4SRahul Maheshwari    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
105f7a407c4SAnusha Dathatri    Click Element  ${xpath_header_scroll}
106b89977a4SRahul Maheshwari    # Restore to original browser size.
107b89977a4SRahul Maheshwari    Set Window Size  ${current_browser_width}  ${current_browser_height}
1083daa28e8SRahul Maheshwari
1093daa28e8SRahul Maheshwari
1103daa28e8SRahul MaheshwariOpenBMC GUI Logoff
1113daa28e8SRahul Maheshwari    [Documentation]  Log out from openBMC GUI.
1123daa28e8SRahul Maheshwari    [Tags]  OpenBMC_GUI_Logoff
1133daa28e8SRahul Maheshwari
114*31b3c434SRahul Maheshwari
115*31b3c434SRahul Maheshwari    Click Button  ${xpath_button_user_action}
116*31b3c434SRahul Maheshwari    Click Button  ${xpath_button_logout}
1173daa28e8SRahul Maheshwari    Wait Until Page Contains Element  ${xpath_button_login}
118