blob: e9cffa1c8208a5a2a9af91bf3c9e7d56b14574d8 [file] [log] [blame]
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -05001*** Settings ***
2
3Documentation Test OpenBMC GUI "Manage power usage" sub-menu of "Server control".
4
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 Maheshwari317c7102020-08-30 21:10:22 -050014${xpath_manage_power_heading} //h1[text()="Manage power usage"]
manashsarma6ffdbf42020-11-10 03:32:19 -060015${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 Maheshwari1e18bb62020-07-07 00:45:50 -050018
19*** Test Cases ***
20
Rahul Maheshwari317c7102020-08-30 21:10:22 -050021Verify 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 Maheshwari1e18bb62020-07-07 00:45:50 -050028Verify 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
manashsarma6ffdbf42020-11-10 03:32:19 -060037Verify 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
manashsarma44ca5762020-11-10 05:48:14 -060053Verify 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.
60 ${checkbox_Selected}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox}
61 Run Keyword If False == ${checkbox_Selected} Click Element ${xpath_power_ops_checkbox}
62 Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10
63 Input Text ${xpath_cap_input_button} ${499}
64
65 # Now disable input box by deselecting the check box
66 Click Element ${xpath_power_ops_checkbox}
67 Checkbox Should Not Be Selected ${xpath_power_ops_checkbox}
68 Element Should Be Disabled ${xpath_cap_input_button}
69
70 # Click submit.
71 Click Element ${xpath_submit_button}
72 ${power_cap}= Get Power Cap Value
73 Should Not Be True ${power_cap} == 499
74
75
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -050076*** Keywords ***
77
manashsarma6ffdbf42020-11-10 03:32:19 -060078Is Power Cap Value Set
79 [Documentation] Check if power cap value is set to the given value.
80 [Arguments] ${expected_value}
81
82 ${cap}= Get Power Cap Value
83 Should Be Equal ${current_cap} ${expected_value}
84
85
86Save Initial Power Cap State
87 [Documentation] Save the initial power cap state.
88
89 Wait Until Page Contains Element ${xpath_power_ops_checkbox}
90 ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox}
91 Set Suite Variable ${checkbox_initial_state} ${status}
92
93
94Restore Initial Power Cap State
95 [Documentation] Restore the initial power cap state.
96
97 ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox}
98 Run Keyword If ${status} != ${checkbox_initial_state}
99 ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0
100
101
102Get Power Cap Value
103 [Documentation] Return the power cap value.
104
105 ${redfish_power}= Redfish.Get Properties /redfish/v1/Chassis/chassis/Power
106
107 # In Redfish version, LimitInWatts is for power cap. However, its stored NOT exactly in json
108 # format so with additional steps in consequent steps string is converted to json formatted
109 # so that a json object can be formed.
110 #
111 # "PowerControl": [
112 # {
113 # "@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0",
114 # "@odata.type": "#Power.v1_0_0.PowerControl",
115 # "MemberId": "0",
116 # "Name": "Chassis Power Control",
117 # "PowerLimit": {
118 # "LimitInWatts": 3000.0
119 # },
120 # "PowerMetrics": {
121 # "AverageConsumedWatts": 16,
122 # "IntervalInMin": 10,
123 # "MaxConsumedWatts": 22
124 # }
125 # }
126 # ],
127
128 [return] ${redfish_power['PowerControl'][0]['PowerLimit']['LimitInWatts']}
129
130
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -0500131Test Setup Execution
132 [Documentation] Do test case setup tasks.
133
134 Click Element ${xpath_control_menu}
135 Click Element ${xpath_manage_power_usage_sub_menu}
136 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain manage-power-usage