blob: 99b5992f1b4137e9568d7326512050a7f6167b41 [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}
49
50
manashsarma6ffdbf42020-11-10 03:32:19 -060051Verify Server Power Cap Setting Is On
52 [Documentation] Verify server power cap setting is on.
53 [Tags] Verify_Server_Power_Cap_Setting_Is_On
54 [Setup] Save Initial Power Cap State
55 [Teardown] Restore Initial Power Cap State
56
57 Run Keyword If '${checkbox_initial_state}' == 'False'
58 ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0
59
60 # Now input a cap value and submit.
61 Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10
62 Input Text ${xpath_cap_input_button} ${600}
63 Click Element ${xpath_submit_button}
64 Wait Until Keyword Succeeds 1 min 15 sec Is Power Cap Value Set 600
65
66
manashsarma44ca5762020-11-10 05:48:14 -060067Verify Server Power Cap Setting Is Off
68 [Documentation] Verify power cap cannot be set or modified when power cap check box is off.
69 [Tags] Verify_Server_Power_Cap_Setting_Is_Off
70
71 Page Should Contain Element ${xpath_power_ops_checkbox}
72
73 # Set a value in check box.
George Keishingb78bca22021-06-29 11:11:19 -050074 ${checkbox_Selected}= Run Keyword And Return Status
75 ... Checkbox Should Be Selected ${xpath_power_ops_checkbox}
manashsarma44ca5762020-11-10 05:48:14 -060076 Run Keyword If False == ${checkbox_Selected} Click Element ${xpath_power_ops_checkbox}
77 Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10
78 Input Text ${xpath_cap_input_button} ${499}
79
80 # Now disable input box by deselecting the check box
81 Click Element ${xpath_power_ops_checkbox}
82 Checkbox Should Not Be Selected ${xpath_power_ops_checkbox}
83 Element Should Be Disabled ${xpath_cap_input_button}
84
85 # Click submit.
86 Click Element ${xpath_submit_button}
87 ${power_cap}= Get Power Cap Value
88 Should Not Be True ${power_cap} == 499
89
90
rramyasr-ind1597f02022-08-08 02:34:49 -050091Verify Existence Of All Buttons In Power Page
92 [Documentation] Login to GUI and check if all visible
93 ... buttons are available on Power page.
94 [Tags] Verify_Existence_Of_All_Buttons_In_Power_Page
95
96 Page Should Contain Element ${xpath_select_static}
97 Page Should Contain Element ${xpath_select_powersaving}
98 Page Should Contain Element ${xpath_select_maximum_performance}
99 Page Should Contain Element ${xpath_update_power_save_mode}
100
101
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -0500102*** Keywords ***
103
manashsarma6ffdbf42020-11-10 03:32:19 -0600104Is Power Cap Value Set
105 [Documentation] Check if power cap value is set to the given value.
106 [Arguments] ${expected_value}
107
108 ${cap}= Get Power Cap Value
109 Should Be Equal ${current_cap} ${expected_value}
110
111
112Save Initial Power Cap State
113 [Documentation] Save the initial power cap state.
114
115 Wait Until Page Contains Element ${xpath_power_ops_checkbox}
116 ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox}
117 Set Suite Variable ${checkbox_initial_state} ${status}
118
119
120Restore Initial Power Cap State
121 [Documentation] Restore the initial power cap state.
122
123 ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox}
124 Run Keyword If ${status} != ${checkbox_initial_state}
125 ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0
126
127
128Get Power Cap Value
129 [Documentation] Return the power cap value.
130
131 ${redfish_power}= Redfish.Get Properties /redfish/v1/Chassis/chassis/Power
132
133 # In Redfish version, LimitInWatts is for power cap. However, its stored NOT exactly in json
134 # format so with additional steps in consequent steps string is converted to json formatted
135 # so that a json object can be formed.
136 #
137 # "PowerControl": [
138 # {
139 # "@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0",
140 # "@odata.type": "#Power.v1_0_0.PowerControl",
141 # "MemberId": "0",
142 # "Name": "Chassis Power Control",
143 # "PowerLimit": {
144 # "LimitInWatts": 3000.0
145 # },
146 # "PowerMetrics": {
147 # "AverageConsumedWatts": 16,
148 # "IntervalInMin": 10,
149 # "MaxConsumedWatts": 22
150 # }
151 # }
152 # ],
153
154 [return] ${redfish_power['PowerControl'][0]['PowerLimit']['LimitInWatts']}
155
156
Rahul Maheshwarib87a5a72021-09-02 06:49:29 -0500157Suite Setup Execution
158 [Documentation] Do suite setup tasks.
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -0500159
Rahul Maheshwarib87a5a72021-09-02 06:49:29 -0500160 Launch Browser And Login GUI
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500161 Click Element ${xpath_resource_management_menu}
162 Click Element ${xpath_power_sub_menu}
163 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain power
rramyasr-ind1597f02022-08-08 02:34:49 -0500164 Wait Until Element Is Not Visible ${xpath_page_loading_progress_bar} timeout=30