blob: 1e6c382ae79bc50692a6523cda14ff99eaaf5a2b [file] [log] [blame]
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -05001*** Settings ***
2
Rahul Maheshwari142642d2021-08-24 00:00:15 -05003Documentation Test OpenBMC GUI "Power" sub-menu of "Resource Management".
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -05004
Rahul Maheshwari41747da2020-11-17 09:09:52 -06005Resource ../../lib/gui_resource.robot
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -05006
Rahul Maheshwarib87a5a72021-09-02 06:49:29 -05007Suite Setup Suite Setup Execution
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -05008Suite Teardown Close Browser
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -05009
10
11*** Variables ***
12
rramyasr-inc279ff12022-08-05 04:10:59 -050013${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-ind1597f02022-08-08 02:34:49 -050017${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 Maheshwari1e18bb62020-07-07 00:45:50 -050022
23*** Test Cases ***
24
Rahul Maheshwari142642d2021-08-24 00:00:15 -050025Verify Navigation To Power Page
26 [Documentation] Verify navigation to power page.
27 [Tags] Verify_Navigation_To_Power_Page
Rahul Maheshwari317c7102020-08-30 21:10:22 -050028
Rahul Maheshwari142642d2021-08-24 00:00:15 -050029 Page Should Contain Element ${xpath_power_heading}
Rahul Maheshwari317c7102020-08-30 21:10:22 -050030
31
Rahul Maheshwari142642d2021-08-24 00:00:15 -050032Verify 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 Maheshwari1e18bb62020-07-07 00:45:50 -050035
36 Page Should Contain Current power consumption
37 Page Should Contain Power cap setting
38 Page Should Contain Power cap value
rramyasr-inc279ff12022-08-05 04:10:59 -050039 Page Should Contain Power and performance mode
40 Page Should Contain Idle power saver
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -050041
Rahul Maheshwari142642d2021-08-24 00:00:15 -050042Verify 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
manashsarmaa7aed482021-07-20 07:14:33 -050045
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-ine0a45682022-09-19 11:38:49 -050049 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}
manashsarmaa7aed482021-07-20 07:14:33 -050053
54
manashsarma6ffdbf42020-11-10 03:32:19 -060055Verify 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-in5b8a4e92022-10-31 06:07:18 -050066
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}
manashsarma6ffdbf42020-11-10 03:32:19 -060075 Click Element ${xpath_submit_button}
rramyasr-in5b8a4e92022-10-31 06:07:18 -050076 Wait Until Keyword Succeeds 1 min 15 sec Is Power Cap Value Set ${power_cap_value}
manashsarma6ffdbf42020-11-10 03:32:19 -060077
78
rramyasr-ina05d4162023-02-21 01:18:23 -060079Verify Server Power Cap Setting With Power Cap Disabled
80 [Documentation] Verify that valid server power cap value can be set
81 ... in GUI with power cap is in disabled state.
manashsarma44ca5762020-11-10 05:48:14 -060082 [Tags] Verify_Server_Power_Cap_Setting_Is_Off
rramyasr-ina05d4162023-02-21 01:18:23 -060083 [Setup] Save Initial Power Cap State
84 [Teardown] Restore Initial Power Cap State
manashsarma44ca5762020-11-10 05:48:14 -060085
rramyasr-ina05d4162023-02-21 01:18:23 -060086 Run Keyword If '${checkbox_initial_state}' == 'True'
87 ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0
manashsarma44ca5762020-11-10 05:48:14 -060088
rramyasr-ina05d4162023-02-21 01:18:23 -060089 # Now input a cap value and submit.
manashsarma44ca5762020-11-10 05:48:14 -060090 Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10
manashsarma44ca5762020-11-10 05:48:14 -060091
rramyasr-ina05d4162023-02-21 01:18:23 -060092 # Get maximum and minimum values of power cap.
93 ${resp}= Redfish.Get Properties /redfish/v1/Chassis/${CHASSIS_ID}/EnvironmentMetrics
manashsarma44ca5762020-11-10 05:48:14 -060094
rramyasr-ina05d4162023-02-21 01:18:23 -060095 ${power_cap_value}= Evaluate
96 ... random.randint(${resp['PowerLimitWatts']['AllowableMin']},${resp['PowerLimitWatts']['AllowableMax']})
97 ... modules=random
98
99 Input Text ${xpath_cap_input_button} ${power_cap_value}
manashsarma44ca5762020-11-10 05:48:14 -0600100 Click Element ${xpath_submit_button}
rramyasr-ina05d4162023-02-21 01:18:23 -0600101 Wait Until Keyword Succeeds 1 min 15 sec Is Power Cap Value Set ${power_cap_value}
manashsarma44ca5762020-11-10 05:48:14 -0600102
103
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -0500104*** Keywords ***
105
manashsarma6ffdbf42020-11-10 03:32:19 -0600106Is Power Cap Value Set
107 [Documentation] Check if power cap value is set to the given value.
108 [Arguments] ${expected_value}
109
110 ${cap}= Get Power Cap Value
rramyasr-in5b8a4e92022-10-31 06:07:18 -0500111 Should Be Equal ${cap} ${expected_value}
manashsarma6ffdbf42020-11-10 03:32:19 -0600112
113
114Save Initial Power Cap State
115 [Documentation] Save the initial power cap state.
116
117 Wait Until Page Contains Element ${xpath_power_ops_checkbox}
118 ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox}
119 Set Suite Variable ${checkbox_initial_state} ${status}
120
121
122Restore Initial Power Cap State
123 [Documentation] Restore the initial power cap state.
124
125 ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox}
126 Run Keyword If ${status} != ${checkbox_initial_state}
127 ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0
128
129
130Get Power Cap Value
131 [Documentation] Return the power cap value.
132
rramyasr-in5b8a4e92022-10-31 06:07:18 -0500133 ${redfish_power}= Redfish.Get Properties /redfish/v1/Chassis/chassis/EnvironmentMetrics
manashsarma6ffdbf42020-11-10 03:32:19 -0600134
135 # In Redfish version, LimitInWatts is for power cap. However, its stored NOT exactly in json
136 # format so with additional steps in consequent steps string is converted to json formatted
137 # so that a json object can be formed.
138 #
rramyasr-in5b8a4e92022-10-31 06:07:18 -0500139 # "Id": "EnvironmentMetrics",
140 # "Name": "Chassis Environment Metrics",
141 # "PowerLimitWatts": {
142 # "AllowableMax": 2488,
143 # "AllowableMin": 1778,
144 # "ControlMode": "Disabled",
145 # "SetPoint": 2400,
manashsarma6ffdbf42020-11-10 03:32:19 -0600146
rramyasr-in5b8a4e92022-10-31 06:07:18 -0500147
148 [return] ${redfish_power['PowerLimitWatts']['SetPoint']}
manashsarma6ffdbf42020-11-10 03:32:19 -0600149
150
Rahul Maheshwarib87a5a72021-09-02 06:49:29 -0500151Suite Setup Execution
152 [Documentation] Do suite setup tasks.
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -0500153
Rahul Maheshwarib87a5a72021-09-02 06:49:29 -0500154 Launch Browser And Login GUI
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500155 Click Element ${xpath_resource_management_menu}
156 Click Element ${xpath_power_sub_menu}
157 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain power
rramyasr-ind1597f02022-08-08 02:34:49 -0500158 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30