blob: c0bc5d8816c0c51839401154906c03d65b15af61 [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
7Suite Setup Launch Browser And Login GUI
8Suite Teardown Close Browser
9Test Setup Test Setup Execution
10
11
12*** Variables ***
13
Rahul Maheshwari142642d2021-08-24 00:00:15 -050014${xpath_power_heading} //h1[text()="Power"]
15${xpath_power_ops_checkbox} //*[@data-test-id='power-checkbox-togglePowerCapField']
16${xpath_cap_input_button} //*[@data-test-id='power-input-powerCapValue']
17${xpath_submit_button} //*[@data-test-id='power-button-savePowerCapValue']
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -050018
19*** Test Cases ***
20
Rahul Maheshwari142642d2021-08-24 00:00:15 -050021Verify Navigation To Power Page
22 [Documentation] Verify navigation to power page.
23 [Tags] Verify_Navigation_To_Power_Page
Rahul Maheshwari317c7102020-08-30 21:10:22 -050024
Rahul Maheshwari142642d2021-08-24 00:00:15 -050025 Page Should Contain Element ${xpath_power_heading}
Rahul Maheshwari317c7102020-08-30 21:10:22 -050026
27
Rahul Maheshwari142642d2021-08-24 00:00:15 -050028Verify Existence Of All Sections In Power Page
29 [Documentation] Verify existence of all sections in power page.
30 [Tags] Verify_Existence_Of_All_Sections_In_Power_Page
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -050031
32 Page Should Contain Current power consumption
33 Page Should Contain Power cap setting
34 Page Should Contain Power cap value
35
36
Rahul Maheshwari142642d2021-08-24 00:00:15 -050037Verify Existence Of All Buttons In Power Page
38 [Documentation] Verify existence of all buttons in power page.
39 [Tags] Verify_Existence_Of_All_Buttons_In_Power_Page
manashsarmaa7aed482021-07-20 07:14:33 -050040
41 Page Should Contain Element ${xpath_power_ops_checkbox}
42 Page Should Contain Element ${xpath_cap_input_button}
43 Page Should Contain Element ${xpath_submit_button}
44
45
manashsarma6ffdbf42020-11-10 03:32:19 -060046Verify Server Power Cap Setting Is On
47 [Documentation] Verify server power cap setting is on.
48 [Tags] Verify_Server_Power_Cap_Setting_Is_On
49 [Setup] Save Initial Power Cap State
50 [Teardown] Restore Initial Power Cap State
51
52 Run Keyword If '${checkbox_initial_state}' == 'False'
53 ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0
54
55 # Now input a cap value and submit.
56 Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10
57 Input Text ${xpath_cap_input_button} ${600}
58 Click Element ${xpath_submit_button}
59 Wait Until Keyword Succeeds 1 min 15 sec Is Power Cap Value Set 600
60
61
manashsarma44ca5762020-11-10 05:48:14 -060062Verify Server Power Cap Setting Is Off
63 [Documentation] Verify power cap cannot be set or modified when power cap check box is off.
64 [Tags] Verify_Server_Power_Cap_Setting_Is_Off
65
66 Page Should Contain Element ${xpath_power_ops_checkbox}
67
68 # Set a value in check box.
George Keishingb78bca22021-06-29 11:11:19 -050069 ${checkbox_Selected}= Run Keyword And Return Status
70 ... Checkbox Should Be Selected ${xpath_power_ops_checkbox}
manashsarma44ca5762020-11-10 05:48:14 -060071 Run Keyword If False == ${checkbox_Selected} Click Element ${xpath_power_ops_checkbox}
72 Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10
73 Input Text ${xpath_cap_input_button} ${499}
74
75 # Now disable input box by deselecting the check box
76 Click Element ${xpath_power_ops_checkbox}
77 Checkbox Should Not Be Selected ${xpath_power_ops_checkbox}
78 Element Should Be Disabled ${xpath_cap_input_button}
79
80 # Click submit.
81 Click Element ${xpath_submit_button}
82 ${power_cap}= Get Power Cap Value
83 Should Not Be True ${power_cap} == 499
84
85
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -050086*** Keywords ***
87
manashsarma6ffdbf42020-11-10 03:32:19 -060088Is Power Cap Value Set
89 [Documentation] Check if power cap value is set to the given value.
90 [Arguments] ${expected_value}
91
92 ${cap}= Get Power Cap Value
93 Should Be Equal ${current_cap} ${expected_value}
94
95
96Save Initial Power Cap State
97 [Documentation] Save the initial power cap state.
98
99 Wait Until Page Contains Element ${xpath_power_ops_checkbox}
100 ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox}
101 Set Suite Variable ${checkbox_initial_state} ${status}
102
103
104Restore Initial Power Cap State
105 [Documentation] Restore the initial power cap state.
106
107 ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox}
108 Run Keyword If ${status} != ${checkbox_initial_state}
109 ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0
110
111
112Get Power Cap Value
113 [Documentation] Return the power cap value.
114
115 ${redfish_power}= Redfish.Get Properties /redfish/v1/Chassis/chassis/Power
116
117 # In Redfish version, LimitInWatts is for power cap. However, its stored NOT exactly in json
118 # format so with additional steps in consequent steps string is converted to json formatted
119 # so that a json object can be formed.
120 #
121 # "PowerControl": [
122 # {
123 # "@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0",
124 # "@odata.type": "#Power.v1_0_0.PowerControl",
125 # "MemberId": "0",
126 # "Name": "Chassis Power Control",
127 # "PowerLimit": {
128 # "LimitInWatts": 3000.0
129 # },
130 # "PowerMetrics": {
131 # "AverageConsumedWatts": 16,
132 # "IntervalInMin": 10,
133 # "MaxConsumedWatts": 22
134 # }
135 # }
136 # ],
137
138 [return] ${redfish_power['PowerControl'][0]['PowerLimit']['LimitInWatts']}
139
140
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -0500141Test Setup Execution
142 [Documentation] Do test case setup tasks.
143
Rahul Maheshwari142642d2021-08-24 00:00:15 -0500144 Click Element ${xpath_resource_management_menu}
145 Click Element ${xpath_power_sub_menu}
146 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain power