blob: 4de7f08b7301be0f0f2237b26c6f9e7fa7f192b0 [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
Rahul Maheshwari142642d2021-08-24 00:00:15 -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-powerCapValue']
16${xpath_submit_button} //*[@data-test-id='power-button-savePowerCapValue']
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -050017
18*** Test Cases ***
19
Rahul Maheshwari142642d2021-08-24 00:00:15 -050020Verify Navigation To Power Page
21 [Documentation] Verify navigation to power page.
22 [Tags] Verify_Navigation_To_Power_Page
Rahul Maheshwari317c7102020-08-30 21:10:22 -050023
Rahul Maheshwari142642d2021-08-24 00:00:15 -050024 Page Should Contain Element ${xpath_power_heading}
Rahul Maheshwari317c7102020-08-30 21:10:22 -050025
26
Rahul Maheshwari142642d2021-08-24 00:00:15 -050027Verify Existence Of All Sections In Power Page
28 [Documentation] Verify existence of all sections in power page.
29 [Tags] Verify_Existence_Of_All_Sections_In_Power_Page
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -050030
31 Page Should Contain Current power consumption
32 Page Should Contain Power cap setting
33 Page Should Contain Power cap value
34
35
Rahul Maheshwari142642d2021-08-24 00:00:15 -050036Verify Existence Of All Buttons In Power Page
37 [Documentation] Verify existence of all buttons in power page.
38 [Tags] Verify_Existence_Of_All_Buttons_In_Power_Page
manashsarmaa7aed482021-07-20 07:14:33 -050039
40 Page Should Contain Element ${xpath_power_ops_checkbox}
41 Page Should Contain Element ${xpath_cap_input_button}
42 Page Should Contain Element ${xpath_submit_button}
43
44
manashsarma6ffdbf42020-11-10 03:32:19 -060045Verify Server Power Cap Setting Is On
46 [Documentation] Verify server power cap setting is on.
47 [Tags] Verify_Server_Power_Cap_Setting_Is_On
48 [Setup] Save Initial Power Cap State
49 [Teardown] Restore Initial Power Cap State
50
51 Run Keyword If '${checkbox_initial_state}' == 'False'
52 ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0
53
54 # Now input a cap value and submit.
55 Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10
56 Input Text ${xpath_cap_input_button} ${600}
57 Click Element ${xpath_submit_button}
58 Wait Until Keyword Succeeds 1 min 15 sec Is Power Cap Value Set 600
59
60
manashsarma44ca5762020-11-10 05:48:14 -060061Verify Server Power Cap Setting Is Off
62 [Documentation] Verify power cap cannot be set or modified when power cap check box is off.
63 [Tags] Verify_Server_Power_Cap_Setting_Is_Off
64
65 Page Should Contain Element ${xpath_power_ops_checkbox}
66
67 # Set a value in check box.
George Keishingb78bca22021-06-29 11:11:19 -050068 ${checkbox_Selected}= Run Keyword And Return Status
69 ... Checkbox Should Be Selected ${xpath_power_ops_checkbox}
manashsarma44ca5762020-11-10 05:48:14 -060070 Run Keyword If False == ${checkbox_Selected} Click Element ${xpath_power_ops_checkbox}
71 Wait Until Element Is Enabled ${xpath_cap_input_button} timeout=10
72 Input Text ${xpath_cap_input_button} ${499}
73
74 # Now disable input box by deselecting the check box
75 Click Element ${xpath_power_ops_checkbox}
76 Checkbox Should Not Be Selected ${xpath_power_ops_checkbox}
77 Element Should Be Disabled ${xpath_cap_input_button}
78
79 # Click submit.
80 Click Element ${xpath_submit_button}
81 ${power_cap}= Get Power Cap Value
82 Should Not Be True ${power_cap} == 499
83
84
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -050085*** Keywords ***
86
manashsarma6ffdbf42020-11-10 03:32:19 -060087Is Power Cap Value Set
88 [Documentation] Check if power cap value is set to the given value.
89 [Arguments] ${expected_value}
90
91 ${cap}= Get Power Cap Value
92 Should Be Equal ${current_cap} ${expected_value}
93
94
95Save Initial Power Cap State
96 [Documentation] Save the initial power cap state.
97
98 Wait Until Page Contains Element ${xpath_power_ops_checkbox}
99 ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox}
100 Set Suite Variable ${checkbox_initial_state} ${status}
101
102
103Restore Initial Power Cap State
104 [Documentation] Restore the initial power cap state.
105
106 ${status}= Run Keyword And Return Status Checkbox Should Be Selected ${xpath_power_ops_checkbox}
107 Run Keyword If ${status} != ${checkbox_initial_state}
108 ... Click Element At Coordinates ${xpath_power_ops_checkbox} 0 0
109
110
111Get Power Cap Value
112 [Documentation] Return the power cap value.
113
114 ${redfish_power}= Redfish.Get Properties /redfish/v1/Chassis/chassis/Power
115
116 # In Redfish version, LimitInWatts is for power cap. However, its stored NOT exactly in json
117 # format so with additional steps in consequent steps string is converted to json formatted
118 # so that a json object can be formed.
119 #
120 # "PowerControl": [
121 # {
122 # "@odata.id": "/redfish/v1/Chassis/chassis/Power#/PowerControl/0",
123 # "@odata.type": "#Power.v1_0_0.PowerControl",
124 # "MemberId": "0",
125 # "Name": "Chassis Power Control",
126 # "PowerLimit": {
127 # "LimitInWatts": 3000.0
128 # },
129 # "PowerMetrics": {
130 # "AverageConsumedWatts": 16,
131 # "IntervalInMin": 10,
132 # "MaxConsumedWatts": 22
133 # }
134 # }
135 # ],
136
137 [return] ${redfish_power['PowerControl'][0]['PowerLimit']['LimitInWatts']}
138
139
Rahul Maheshwarib87a5a72021-09-02 06:49:29 -0500140Suite Setup Execution
141 [Documentation] Do suite setup tasks.
Rahul Maheshwari1e18bb62020-07-07 00:45:50 -0500142
Rahul Maheshwarib87a5a72021-09-02 06:49:29 -0500143 Launch Browser And Login GUI
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