Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 3 | Documentation Test OpenBMC GUI "Power" sub-menu of "Resource Management". |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 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 | |
Rahul Maheshwari | b87a5a7 | 2021-09-02 06:49:29 -0500 | [diff] [blame] | 7 | Suite Setup Suite Setup Execution |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 8 | Suite Teardown Close Browser |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 9 | |
| 10 | |
| 11 | *** Variables *** |
| 12 | |
rramyasr-in | c279ff1 | 2022-08-05 04:10:59 -0500 | [diff] [blame] | 13 | ${xpath_power_heading} //h1[text()="Power"] |
| 14 | ${xpath_power_ops_checkbox} //*[@data-test-id='power-checkbox-togglePowerCapField'] |
| 15 | ${xpath_cap_input_button} //*[@data-test-id='power-input-powerCap'] |
| 16 | ${xpath_submit_button} //*[@data-test-id='power-button-savePowerCapValue'] |
rramyasr-in | d1597f0 | 2022-08-08 02:34:49 -0500 | [diff] [blame] | 17 | ${xpath_select_static} //input[@value='Static'] |
| 18 | ${xpath_select_powersaving} //input[@value='PowerSaving'] |
| 19 | ${xpath_select_maximum_performance} //input[@value='MaximumPerformance'] |
| 20 | ${xpath_update_power_save_mode} //button[contains(text(),'Update power saver mode')] |
| 21 | ${xpath_page_loading_progress_bar} //*[@aria-label='Page loading progress bar'] |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 22 | |
| 23 | *** Test Cases *** |
| 24 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 25 | Verify Navigation To Power Page |
| 26 | [Documentation] Verify navigation to power page. |
| 27 | [Tags] Verify_Navigation_To_Power_Page |
Rahul Maheshwari | 317c710 | 2020-08-30 21:10:22 -0500 | [diff] [blame] | 28 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 29 | Page Should Contain Element ${xpath_power_heading} |
Rahul Maheshwari | 317c710 | 2020-08-30 21:10:22 -0500 | [diff] [blame] | 30 | |
| 31 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 32 | Verify Existence Of All Sections In Power Page |
| 33 | [Documentation] Verify existence of all sections in power page. |
| 34 | [Tags] Verify_Existence_Of_All_Sections_In_Power_Page |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 35 | |
| 36 | Page Should Contain Current power consumption |
| 37 | Page Should Contain Power cap setting |
| 38 | Page Should Contain Power cap value |
rramyasr-in | c279ff1 | 2022-08-05 04:10:59 -0500 | [diff] [blame] | 39 | Page Should Contain Power and performance mode |
| 40 | Page Should Contain Idle power saver |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 41 | |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 42 | Verify Existence Of All Buttons In Power Page |
| 43 | [Documentation] Verify existence of all buttons in power page. |
| 44 | [Tags] Verify_Existence_Of_All_Buttons_In_Power_Page |
manashsarma | a7aed48 | 2021-07-20 07:14:33 -0500 | [diff] [blame] | 45 | |
| 46 | Page Should Contain Element ${xpath_power_ops_checkbox} |
| 47 | Page Should Contain Element ${xpath_cap_input_button} |
| 48 | Page Should Contain Element ${xpath_submit_button} |
rramyasr-in | e0a4568 | 2022-09-19 11:38:49 -0500 | [diff] [blame] | 49 | Page Should Contain Element ${xpath_select_static} |
| 50 | Page Should Contain Element ${xpath_select_powersaving} |
| 51 | Page Should Contain Element ${xpath_select_maximum_performance} |
| 52 | Page Should Contain Element ${xpath_update_power_save_mode} |
manashsarma | a7aed48 | 2021-07-20 07:14:33 -0500 | [diff] [blame] | 53 | |
| 54 | |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 55 | Verify Server Power Cap Setting Is On |
| 56 | [Documentation] Verify server power cap setting is on. |
| 57 | [Tags] Verify_Server_Power_Cap_Setting_Is_On |
| 58 | [Setup] Save Initial Power Cap State |
| 59 | [Teardown] Restore Initial Power Cap State |
| 60 | |
| 61 | Run Keyword If '${checkbox_initial_state}' == 'False' |
| 62 | ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0 |
| 63 | |
| 64 | # Now input a cap value and submit. |
| 65 | Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10 |
rramyasr-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 66 | |
| 67 | # Get maximum and minimum values of power cap. |
| 68 | ${resp}= Redfish.Get Properties /redfish/v1/Chassis/${CHASSIS_ID}/EnvironmentMetrics |
| 69 | |
| 70 | ${power_cap_value}= Evaluate |
| 71 | ... random.randint(${resp['PowerLimitWatts']['AllowableMin']},${resp['PowerLimitWatts']['AllowableMax']}) |
| 72 | ... modules=random |
| 73 | |
| 74 | Input Text ${xpath_cap_input_button} ${power_cap_value} |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 75 | Click Element ${xpath_submit_button} |
rramyasr-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 76 | Wait Until Keyword Succeeds 1 min 15 sec Is Power Cap Value Set ${power_cap_value} |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 77 | |
| 78 | |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 79 | Verify Server Power Cap Setting Is Off |
| 80 | [Documentation] Verify power cap cannot be set or modified when power cap check box is off. |
| 81 | [Tags] Verify_Server_Power_Cap_Setting_Is_Off |
| 82 | |
| 83 | Page Should Contain Element ${xpath_power_ops_checkbox} |
| 84 | |
| 85 | # Set a value in check box. |
George Keishing | b78bca2 | 2021-06-29 11:11:19 -0500 | [diff] [blame] | 86 | ${checkbox_Selected}= Run Keyword And Return Status |
| 87 | ... Checkbox Should Be Selected ${xpath_power_ops_checkbox} |
manashsarma | 44ca576 | 2020-11-10 05:48:14 -0600 | [diff] [blame] | 88 | Run Keyword If False == ${checkbox_Selected} Click Element ${xpath_power_ops_checkbox} |
| 89 | Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10 |
| 90 | Input Text ${xpath_cap_input_button} ${499} |
| 91 | |
| 92 | # Now disable input box by deselecting the check box |
| 93 | Click Element ${xpath_power_ops_checkbox} |
| 94 | Checkbox Should Not Be Selected ${xpath_power_ops_checkbox} |
| 95 | Element Should Be Disabled ${xpath_cap_input_button} |
| 96 | |
| 97 | # Click submit. |
| 98 | Click Element ${xpath_submit_button} |
| 99 | ${power_cap}= Get Power Cap Value |
| 100 | Should Not Be True ${power_cap} == 499 |
| 101 | |
| 102 | |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 103 | *** Keywords *** |
| 104 | |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 105 | Is Power Cap Value Set |
| 106 | [Documentation] Check if power cap value is set to the given value. |
| 107 | [Arguments] ${expected_value} |
| 108 | |
| 109 | ${cap}= Get Power Cap Value |
rramyasr-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 110 | Should Be Equal ${cap} ${expected_value} |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 111 | |
| 112 | |
| 113 | Save Initial Power Cap State |
| 114 | [Documentation] Save the initial power cap state. |
| 115 | |
| 116 | Wait Until Page Contains Element ${xpath_power_ops_checkbox} |
| 117 | ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox} |
| 118 | Set Suite Variable ${checkbox_initial_state} ${status} |
| 119 | |
| 120 | |
| 121 | Restore Initial Power Cap State |
| 122 | [Documentation] Restore the initial power cap state. |
| 123 | |
| 124 | ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox} |
| 125 | Run Keyword If ${status} != ${checkbox_initial_state} |
| 126 | ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0 |
| 127 | |
| 128 | |
| 129 | Get Power Cap Value |
| 130 | [Documentation] Return the power cap value. |
| 131 | |
rramyasr-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 132 | ${redfish_power}= Redfish.Get Properties /redfish/v1/Chassis/chassis/EnvironmentMetrics |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 133 | |
| 134 | # In Redfish version, LimitInWatts is for power cap. However, its stored NOT exactly in json |
| 135 | # format so with additional steps in consequent steps string is converted to json formatted |
| 136 | # so that a json object can be formed. |
| 137 | # |
rramyasr-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 138 | # "Id": "EnvironmentMetrics", |
| 139 | # "Name": "Chassis Environment Metrics", |
| 140 | # "PowerLimitWatts": { |
| 141 | # "AllowableMax": 2488, |
| 142 | # "AllowableMin": 1778, |
| 143 | # "ControlMode": "Disabled", |
| 144 | # "SetPoint": 2400, |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 145 | |
rramyasr-in | 5b8a4e9 | 2022-10-31 06:07:18 -0500 | [diff] [blame] | 146 | |
| 147 | [return] ${redfish_power['PowerLimitWatts']['SetPoint']} |
manashsarma | 6ffdbf4 | 2020-11-10 03:32:19 -0600 | [diff] [blame] | 148 | |
| 149 | |
Rahul Maheshwari | b87a5a7 | 2021-09-02 06:49:29 -0500 | [diff] [blame] | 150 | Suite Setup Execution |
| 151 | [Documentation] Do suite setup tasks. |
Rahul Maheshwari | 1e18bb6 | 2020-07-07 00:45:50 -0500 | [diff] [blame] | 152 | |
Rahul Maheshwari | b87a5a7 | 2021-09-02 06:49:29 -0500 | [diff] [blame] | 153 | Launch Browser And Login GUI |
Rahul Maheshwari | 142642d | 2021-08-24 00:00:15 -0500 | [diff] [blame] | 154 | Click Element ${xpath_resource_management_menu} |
| 155 | Click Element ${xpath_power_sub_menu} |
| 156 | Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain power |
rramyasr-in | d1597f0 | 2022-08-08 02:34:49 -0500 | [diff] [blame] | 157 | Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30 |