1*** Settings ***
2
3Documentation   Test OpenBMC GUI "Server power operation" sub-menu of
4...             "Server control".
5
6Resource        ../../lib/resource.robot
7
8Test Teardown   Close Browser
9
10
11*** Variables ***
12
13${xpath_power_indicator_bar}     //*[@id='power-indicator-bar']
14${xpath_shutdown_button}         //button[contains(text(), "Shut down")]
15${xpath_reboot_button}           //button[contains(text(), "Reboot")]
16${xpath_power_on_button}         //button[contains(text(), "Power on")]
17${xpath_tpm_toggle_switch}       //label[@for="toggle__switch-round"]
18${xpath_select_boot_override}    //select[@id="boot-selected"]
19${xpath_select_one_time_boot}    //label[@id="one-time-label"]
20
21*** Test Cases ***
22
23Verify System State At Power Off
24    [Documentation]  Verify system state at power off.
25    [Tags]  Verify_System_State_At_Power_Off
26    [Setup]  Setup For Test Execution  ${OBMC_PowerOff_state}
27
28    Element Should Contain  ${xpath_power_indicator_bar}  Off
29
30
31Verify BMC IP In Server Power Operation Page
32    [Documentation]  Verify BMC IP in server power operation page.
33    [Tags]  Verify_BMC_IP_In_Server_Power_Operation_Page
34    [Setup]  Setup For Test Execution  ${OBMC_PowerOff_state}
35
36    Element Should Contain  ${xpath_power_indicator_bar}  ${OPENBMC_HOST}
37
38
39Verify Shutdown Button At Power Off
40    [Documentation]  Verify that shutdown button is not present at power Off.
41    [Tags]  Verify_Shutdown_Button_At_Power_Off
42    [Setup]  Setup For Test Execution  ${OBMC_PowerOff_state}
43
44    Element Should Not Be Visible  ${xpath_shutdown_button}
45
46
47Verify Reboot Button At Power Off
48    [Documentation]  Verify that reboot button is not present at power Off.
49    [Tags]  Verify_Reboot_Button_At_Power_Off
50    [Setup]  Setup For Test Execution  ${OBMC_PowerOff_state}
51
52    Element Should Not Be Visible  ${xpath_reboot_button}
53
54
55Verify Power On Button At Power Off
56    [Documentation]  Verify presence of "Power On" button at power off.
57    [Tags]  Verify_Power_On_Button_At_Power_Off
58    [Setup]  Setup For Test Execution  ${OBMC_PowerOff_state}
59
60    Element Should Be Visible  ${xpath_power_on_button}
61
62
63Verify System State At Power On
64    [Documentation]  Verify system state at power on.
65    [Tags]  Verify_System_State_At_Power_On
66    [Setup]  Setup For Test Execution  ${obmc_PowerRunning_state}
67
68    Element Should Contain  ${xpath_power_indicator_bar}  Running
69
70
71Verify Shutdown Button At Power On
72    [Documentation]  Verify that shutdown button is present at power on.
73    [Tags]  Verify_Shutdown_Button_At_Power_On
74    [Setup]  Setup For Test Execution  ${obmc_PowerRunning_state}
75
76    Element Should Be Visible  ${xpath_shutdown_button}
77
78
79Verify Reboot Button At Power On
80    [Documentation]  Verify that reboot button is present at power on.
81    [Tags]  Verify_Reboot_Button_At_Power_On
82    [Setup]  Setup For Test Execution  ${obmc_PowerRunning_state}
83
84    Element Should Be Visible  ${xpath_reboot_button}
85
86
87Verify Existence Of All Sections In Host Os Boot Settings
88    [Documentation]  Verify existence of all sections in host os boot settings.
89    [Tags]  Verify_Existence_Of_All_Sections_In_Host_Os_Boot_Settings
90    [Setup]  Run Keywords  Launch Browser And Login OpenBMC GUI  AND
91    ...  Navigate To Server Power Operations
92
93    Page Should Contain  Boot setting override
94    Page Should Contain  TPM required policy
95
96
97Verify Existence Of All Buttons In Host Os Boot Settings
98    [Documentation]  Verify existence of all buttons in host os boot settings.
99    [Tags]  Verify_Existence_Of_All_Buttons_In_Host_Os_Boot_Settings
100    [Setup]  Run Keywords  Launch Browser And Login OpenBMC GUI  AND
101    ...  Navigate To Server Power Operations
102
103    Page Should Contain Element  ${xpath_tpm_toggle_switch}
104    Page Should Contain Element  ${xpath_save_button}
105    Page Should Contain Element  ${xpath_cancel_button}
106
107
108Verify Existence Of All Input Boxes In Host Os Boot Settings
109    [Documentation]  Verify existence of all input boxes in host os boot settings.
110    [Tags]  Verify_Existence_Of_All_Input_Boxes_In_Host_Os_Boot_Settings
111    [Setup]  Run Keywords  Launch Browser And Login OpenBMC GUI  AND
112    ...  Navigate To Server Power Operations
113
114    Page Should Contain Element  ${xpath_select_boot_override}
115    Page Should Contain Element  ${xpath_select_one_time_boot}
116
117
118*** Keywords ***
119
120Setup For Test Execution
121    [Documentation]  Do setup tasks for test case.
122    [Arguments]  ${obmc_required_state}
123
124    # Description of argument(s):
125    # obmc_required_state  The OpenBMC state which is required for the test.
126
127    Test Setup Execution  ${obmc_required_state}
128    Navigate To Server Power Operations
129
130Navigate To Server Power Operations
131    [Documentation]  Navigate to server power operations.
132
133    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
134    Click Element  ${xpath_select_server_control}
135    Wait Until Page Does Not Contain Element  ${xpath_refresh_circle}
136    Click Element  ${xpath_select_server_power_operations}
137    Wait Until Page Contains  Server power operations
138