1*** Settings ***
2
3Documentation  Test Open BMC GUI server configuration firmware update.
4
5Resource        ../../lib/resource.robot
6Resource        ../../../lib/logging_utils.robot
7
8Suite Setup     Launch Browser And Login OpenBMC GUI
9Suite Teardown  Close Browser
10Test Setup      Test Setup Execution
11Test Teardown   Run Keyword If Test Failed  Re-Launch GUI on Failure
12
13*** Variables ***
14${xpath_select_server_config}   //*[@id="nav__top-level"]/li[4]/button
15${xpath_select_firmware}        //a[@href='#/configuration/firmware']
16${xpath_choose_file_button}     //*[@id="firmware__upload-form"]/div[1]/label/span[1]
17${xpath_scroll_down}            //a[contains(text(), "Scroll down")]
18${xpath_tftp_server_ip}         //*[@id="tftp-ip"]
19${xpath_tftp_filename}          //*[@id="tftp-file-name"]
20${xpath_download_firmware}      //*[@id="firmware__upload-form"]/div[2]/fieldset/div[1]/div[3]/input
21${xpath_download_progress}      //*[@id="firmware__upload-form"]/div[2]/fieldset/div[2]
22
23*** Test Cases ***
24
25Verify Select Firmware From Server Configuration
26    [Documentation]  Verify ability to select firmware option from server
27    ...  configuration sub-menu.
28    [Tags]  Verify_Select_Firmware_From_Server_Configuration
29
30    Wait Until Page Contains  Firmware
31    Page Should contain  Manage BMC and server firmware
32
33
34Verify Scroll Down Link
35    [Documentation]  Verify scroll down link works.
36    [Tags]  Verify_Scroll_Down_Link
37
38    Page Should Contain Element  ${xpath_scroll_down}
39    Click Element  ${xpath_scroll_down}
40    Page Should Contain Element  ${xpath_choose_file_button}
41
42
43Verify Choose File Button Click
44    [Documentation]  Verify choose file button is clickable.
45    [Tags]  Verify_Choose_File_Button_Click
46
47    Page Should Contain  No file chosen
48    Page Should Contain Element  ${xpath_choose_file_button}
49    Click Element  ${xpath_choose_file_button}
50
51Verify BMC Firmware Download
52    # BMC Firmware File Path located at TFTP server.
53    ${BMC_IMAGE_FILE_PATH}
54    [Template]  Upload Firmware using TFTP Server
55    [Documentation]  Verify BMC image is download from TFTP server.
56    [Tags]  Verify_BMC_Firmware_Download
57
58
59Verify Host Firmware Download
60    # Host Firmware File Path located at TFTP server.
61    ${PNOR_IMAGE_FILE_PATH}
62    [Template]  Upload Firmware using TFTP Server
63    [Documentation]  Verify Host image is download from TFTP server.
64    [Tags]  Verify_HOST_Firmware_Download
65
66
67*** Keywords ***
68
69Test Setup Execution
70   [Documentation]  Do test case setup tasks.
71
72    Delete All Error Logs
73    Click Element  ${xpath_select_server_config}
74    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
75    Click Element  ${xpath_select_firmware}
76
77Upload Firmware using TFTP Server
78    [Documentation]  Upload firmware using TFTP server.
79    [Arguments]  ${firmware_file_name}
80
81    Page Should Contain Button  ${xpath_download_firmware}
82    Page Should Contain Element  ${xpath_tftp_server_ip}
83    Page Should Contain Element  ${xpath_tftp_filename}
84
85    Input Text  ${xpath_tftp_server_ip}  ${TFTP_SERVER}
86    Input Text  ${xpath_tftp_filename}  ${firmware_file_name}
87    Click Button  ${xpath_download_firmware}
88    Wait Until Element Is Visible  ${xpath_download_progress}  timeout=180
89    Wait Until Element Is Not Visible  ${xpath_download_progress}  timeout=180
90
91    # ${message}=  Handle Alert  timeout=300s
92    # Didn't work so commenting out currently.
93    # Alert not getting captured.
94    # TODO: Issue https://github.com/openbmc/openbmc-test-automation/issues/1412
95
96    Check No Error Log Exist
97
98Check No Error Log Exist
99    [Documentation]  No error log should be logged.
100
101    ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}list  quiet=${1}
102    Should Be Equal As Strings  ${resp.status_code}  ${HTTP_NOT_FOUND}
103    ...  msg=Codeupdate Failed with error.
104
105Re-Launch GUI on Failure
106    [Documentation]  On failure of test case, close and re-launch GUI.
107
108    Logout And Close Browser
109    Launch Browser And Login OpenBMC GUI
110