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    Check No Error Log Exist
92
93Check No Error Log Exist
94    [Documentation]  No error log should be logged.
95
96    ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}list  quiet=${1}
97    Should Be Equal As Strings  ${resp.status_code}  ${HTTP_NOT_FOUND}
98    ...  msg=Codeupdate Failed with error.
99
100Re-Launch GUI on Failure
101    [Documentation]  On failure of test case, close and re-launch GUI.
102
103    Logout And Close Browser
104    Launch Browser And Login OpenBMC GUI
105