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