Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Test OpenBMC GUI "Manage power usage" sub-menu of "Server control". |
| 4 | |
Rahul Maheshwari | 41747da | 2020-11-17 09:09:52 -0600 | [diff] [blame] | 5 | Resource ../../lib/gui_resource.robot |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 6 | |
| 7 | Suite Setup Launch Browser And Login GUI |
| 8 | Suite Teardown Close Browser |
| 9 | Test Setup Test Setup Execution |
| 10 | |
| 11 | |
| 12 | *** Variables *** |
| 13 | |
Rahul Maheshwari | 317c710 | 2020-08-30 21:10:22 -0500 | [diff] [blame] | 14 | ${xpath_manage_power_heading} //h1[text()="Manage power usage"] |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 15 | ${xpath_power_ops_checkbox} //*[@data-test-id='managePowerUsage-checkbox-togglePowerCapField'] |
| 16 | ${xpath_cap_input_button} //*[@data-test-id='managePowerUsage-input-powerCapValue'] |
| 17 | ${xpath_submit_button} //*[@data-test-id='managePowerUsage-button-savePowerCapValue'] |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 18 | |
| 19 | *** Test Cases *** |
| 20 | |
Rahul Maheshwari | 317c710 | 2020-08-30 21:10:22 -0500 | [diff] [blame] | 21 | Verify Navigation To Manage Power Usage Page |
| 22 | [Documentation] Verify navigation to manage power usage page. |
| 23 | [Tags] Verify_Navigation_To_Manage_Power_Usage_Page |
| 24 | |
| 25 | Page Should Contain Element ${xpath_manage_power_heading} |
| 26 | |
| 27 | |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 28 | Verify Existence Of All Sections In Manage Power Usage Page |
| 29 | [Documentation] Verify existence of all sections in Manage Power Usage page. |
| 30 | [Tags] Verify_Existence_Of_All_Sections_In_Manage_Power_Usage_Page |
| 31 | |
| 32 | Page Should Contain Current power consumption |
| 33 | Page Should Contain Power cap setting |
| 34 | Page Should Contain Power cap value |
| 35 | |
| 36 | |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 37 | Verify Server Power Cap Setting Is On |
| 38 | [Documentation] Verify server power cap setting is on. |
| 39 | [Tags] Verify_Server_Power_Cap_Setting_Is_On |
| 40 | [Setup] Save Initial Power Cap State |
| 41 | [Teardown] Restore Initial Power Cap State |
| 42 | |
| 43 | Run Keyword If '${checkbox_initial_state}' == 'False' |
| 44 | ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0 |
| 45 | |
| 46 | # Now input a cap value and submit. |
| 47 | Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10 |
| 48 | Input Text ${xpath_cap_input_button} ${600} |
| 49 | Click Element ${xpath_submit_button} |
| 50 | Wait Until Keyword Succeeds 1 min 15 sec Is Power Cap Value Set 600 |
| 51 | |
| 52 | |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 53 | Verify Server Power Cap Setting Is Off |
| 54 | [Documentation] Verify power cap cannot be set or modified when power cap check box is off. |
| 55 | [Tags] Verify_Server_Power_Cap_Setting_Is_Off |
| 56 | |
| 57 | Page Should Contain Element ${xpath_power_ops_checkbox} |
| 58 | |
| 59 | # Set a value in check box. |
George Keishing | b78bca2 | 2021-06-29 11:11:19 -0500 | [diff] [blame] | 60 | ${checkbox_Selected}= Run Keyword And Return Status |
| 61 | ... Checkbox Should Be Selected ${xpath_power_ops_checkbox} |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 62 | Run Keyword If False == ${checkbox_Selected} Click Element ${xpath_power_ops_checkbox} |
| 63 | Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10 |
| 64 | Input Text ${xpath_cap_input_button} ${499} |
| 65 | |
| 66 | # Now disable input box by deselecting the check box |
| 67 | Click Element ${xpath_power_ops_checkbox} |
| 68 | Checkbox Should Not Be Selected ${xpath_power_ops_checkbox} |
| 69 | Element Should Be Disabled ${xpath_cap_input_button} |
| 70 | |
| 71 | # Click submit. |
| 72 | Click Element ${xpath_submit_button} |
| 73 | ${power_cap}= Get Power Cap Value |
| 74 | Should Not Be True ${power_cap} == 499 |
| 75 | |
| 76 | |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 77 | *** Keywords *** |
| 78 | |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 79 | Is Power Cap Value Set |
| 80 | [Documentation] Check if power cap value is set to the given value. |
| 81 | [Arguments] ${expected_value} |
| 82 | |
| 83 | ${cap}= Get Power Cap Value |
| 84 | Should Be Equal ${current_cap} ${expected_value} |
| 85 | |
| 86 | |
| 87 | Save Initial Power Cap State |
| 88 | [Documentation] Save the initial power cap state. |
| 89 | |
| 90 | Wait Until Page Contains Element ${xpath_power_ops_checkbox} |
| 91 | ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox} |
| 92 | Set Suite Variable ${checkbox_initial_state} ${status} |
| 93 | |
| 94 | |
| 95 | Restore Initial Power Cap State |
| 96 | [Documentation] Restore the initial power cap state. |
| 97 | |
| 98 | ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox} |
| 99 | Run Keyword If ${status} != ${checkbox_initial_state} |
| 100 | ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0 |
| 101 | |
| 102 | |
| 103 | Get Power Cap Value |
| 104 | [Documentation] Return the power cap value. |
| 105 | |
| 106 | ${redfish_power}= Redfish.Get Properties /redfish/v1/Chassis/chassis/Power |
| 107 | |
| 108 | # In Redfish version, LimitInWatts is for power cap. However, its stored NOT exactly in json |
| 109 | # format so with additional steps in consequent steps string is converted to json formatted |
| 110 | # so that a json object can be formed. |
| 111 | # |
| 112 | # "PowerControl": [ |
| 113 | # { |
| 114 | # "@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0", |
| 115 | # "@odata.type": "#Power.v1_0_0.PowerControl", |
| 116 | # "MemberId": "0", |
| 117 | # "Name": "Chassis Power Control", |
| 118 | # "PowerLimit": { |
| 119 | # "LimitInWatts": 3000.0 |
| 120 | # }, |
| 121 | # "PowerMetrics": { |
| 122 | # "AverageConsumedWatts": 16, |
| 123 | # "IntervalInMin": 10, |
| 124 | # "MaxConsumedWatts": 22 |
| 125 | # } |
| 126 | # } |
| 127 | # ], |
| 128 | |
| 129 | [return] ${redfish_power['PowerControl'][0]['PowerLimit']['LimitInWatts']} |
| 130 | |
| 131 | |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 132 | Test Setup Execution |
| 133 | [Documentation] Do test case setup tasks. |
| 134 | |
| 135 | Click Element ${xpath_control_menu} |
| 136 | Click Element ${xpath_manage_power_usage_sub_menu} |
| 137 | Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain manage-power-usage |