blob: e6b352a90fbcc102c1fd2b4d2888d0f62a22de53 [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
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -050053*** Keywords ***
54
manashsarma6ffdbf42020-11-10 03:32:19 -060055Is Power Cap Value Set
56 [Documentation] Check if power cap value is set to the given value.
57 [Arguments] ${expected_value}
58
59 ${cap}= Get Power Cap Value
60 Should Be Equal ${current_cap} ${expected_value}
61
62
63Save Initial Power Cap State
64 [Documentation] Save the initial power cap state.
65
66 Wait Until Page Contains Element ${xpath_power_ops_checkbox}
67 ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox}
68 Set Suite Variable ${checkbox_initial_state} ${status}
69
70
71Restore Initial Power Cap State
72 [Documentation] Restore the initial power cap state.
73
74 ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox}
75 Run Keyword If ${status} != ${checkbox_initial_state}
76 ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0
77
78
79Get Power Cap Value
80 [Documentation] Return the power cap value.
81
82 ${redfish_power}= Redfish.Get Properties /redfish/v1/Chassis/chassis/Power
83
84 # In Redfish version, LimitInWatts is for power cap. However, its stored NOT exactly in json
85 # format so with additional steps in consequent steps string is converted to json formatted
86 # so that a json object can be formed.
87 #
88 # "PowerControl": [
89 # {
90 # "@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0",
91 # "@odata.type": "#Power.v1_0_0.PowerControl",
92 # "MemberId": "0",
93 # "Name": "Chassis Power Control",
94 # "PowerLimit": {
95 # "LimitInWatts": 3000.0
96 # },
97 # "PowerMetrics": {
98 # "AverageConsumedWatts": 16,
99 # "IntervalInMin": 10,
100 # "MaxConsumedWatts": 22
101 # }
102 # }
103 # ],
104
105 [return] ${redfish_power['PowerControl'][0]['PowerLimit']['LimitInWatts']}
106
107
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -0500108Test Setup Execution
109 [Documentation] Do test case setup tasks.
110
111 Click Element ${xpath_control_menu}
112 Click Element ${xpath_manage_power_usage_sub_menu}
113 Wait Until Keyword Succeeds 30 sec 10 sec Location Should Contain manage-power-usage