1*** Settings ***
2
3Documentation   Test OpenBMC GUI "Sensors" sub-menu.
4Resource        ../../lib/gui_resource.robot
5
6Suite Setup     Suite Setup Execution
7Suite Teardown  Close Browser
8
9
10*** Variables ***
11
12${xpath_sensor_heading}      //h1[text()="Sensors"]
13${xpath_sensors_filter}      //button[contains(text(),'Filter')]
14${xpath_sensors_search}      //input[contains(@class,"search-input")]
15${xpath_filter_ok}           //*[@data-test-id='tableFilter-checkbox-OK']
16${xpath_filter_warning}      //*[@data-test-id='tableFilter-checkbox-Warning']
17${xpath_filter_critical}     //*[@data-test-id='tableFilter-checkbox-Critical']
18${xpath_filter_clear_all}    //*[@data-test-id='tableFilter-button-clearAll']
19${xpath_selected_severity}   //*[@class="d-inline-block mb-0"]
20${xpath_clear_search_input}  //*[@title="Clear search input"]
21
22*** Test Cases ***
23
24Verify Navigation To Sensors Page
25    [Documentation]  Verify navigation to Sensors page.
26    [Tags]  Verify_Navigation_To_Sensors_Page
27
28    Page Should Contain Element  ${xpath_sensor_heading}
29
30
31Verify Existence Of All Sections In Sensor Page
32    [Documentation]  Verify existence of all sections in sensor page.
33    [Tags]  Verify_Existence_Of_All_Sections_In_Sensor_Page
34
35    Page Should Contain  Sensors
36
37
38Verify Existence Of All Buttons And Input Boxes In Sensor Page
39    [Documentation]  Verify existence of all buttons and input boxes in sensor page.
40    [Tags]  Verify_Existence_Of_All_Buttons_And_Input_Boxes_In_Sensor_Page
41
42    Page Should Contain Element  ${xpath_sensors_filter}
43    Click Element  ${xpath_sensors_filter}
44
45    #Search field
46    Page Should Contain Element  ${xpath_sensors_search}
47
48
49Verify Search Text Entered
50    [Documentation]  Verify search text input allowed from "Sensors" page.
51    [Tags]  Verify_Search_Text_Entered
52    [Teardown]  Click Element  ${xpath_clear_search_input}
53
54    Wait Until Page Contains Element  ${xpath_sensors_search}
55    Input Text  ${xpath_sensors_search}  ambi
56    Wait Until Page Contains  Ambient  timeout=120s
57
58
59Verify Sensors Filter From Server Health Clickable
60    [Documentation]  Verify sensors filter from server health clickable
61    [Tags]  Verify_Sensors_Filter_From_Server_Health_Clickable
62
63    Wait Until Page Contains Element  ${xpath_sensors_filter}  timeout=15s
64    Click Element  ${xpath_sensors_filter}
65
66    Page Should Contain Element  ${xpath_filter_ok}
67    Page Should Contain Element  ${xpath_filter_warning}
68    Page Should Contain Element  ${xpath_filter_critical}
69    Page Should Contain Element  ${xpath_filter_clear_all}
70
71
72Verify Invalid Text In Filter Sensors Search
73    [Documentation]  Input invalid text in sensor search and verify error message.
74    [Tags]  Verify_Invalid_Text_In_Filter_Sensors_Search
75    [Teardown]  Click Element  ${xpath_clear_search_input}
76
77    Wait Until Page Contains Element  ${xpath_sensors_search}
78    Input Text  ${xpath_sensors_search}  abcd123
79
80    Page Should Contain  No items match the search query
81
82
83Verify Clear All Button In Sensor Page
84    [Documentation]  Select all severity and verify clear all button de-selects all severity.
85    [Tags]  Verify_Clear_All_Button_In_Sensor_Page
86    [Teardown]  Click Element  ${xpath_sensors_filter}
87
88    Wait Until Page Contains Element  ${xpath_sensors_filter}  timeout=15s
89    Click Element  ${xpath_sensors_filter}
90
91    # Select all severity from filter.
92    Click Element At Coordinates  ${xpath_filter_ok}  0  0
93    Click Element At Coordinates  ${xpath_filter_warning}  0  0
94    Click Element At Coordinates  ${xpath_filter_critical}  0  0
95    Element Should Be Visible  ${xpath_selected_severity}
96
97    # De-select all severity using clear all button in filter.
98    Click Element At Coordinates  ${xpath_filter_clear_all}  0  0
99    Click Element  ${xpath_sensors_filter}
100
101    Element Should Not Be Visible  ${xpath_selected_severity}
102
103
104Verify Filter By Severity Button OK
105    [Documentation]  Select severity button OK from filter and verify.
106    [Tags]  Verify_Filter_By_Severity_Button_OK
107    [Teardown]  Clean Up Filter Values
108
109    Wait Until Page Contains Element  ${xpath_sensors_filter}  timeout=15s
110    Click Element  ${xpath_sensors_filter}
111
112    # Select OK severity from filter.
113    Wait Until Page Contains Element  ${xpath_filter_ok}  timeout=5s
114
115    Click Element At Coordinates  ${xpath_filter_ok}  0  0
116    Click Element  ${xpath_sensors_filter}
117
118    Element Should Contain  ${xpath_selected_severity}  OK
119    Element Should Not Contain  ${xpath_selected_severity}  Warning
120    Element Should Not Contain  ${xpath_selected_severity}  Critical
121
122
123*** Keywords ***
124
125Suite Setup Execution
126    [Documentation]  Do suite setup tasks.
127
128    Launch Browser And Login GUI
129    Click Element  ${xpath_hardware_status_menu}
130    Click Element  ${xpath_sensor_sub_menu}
131    Wait Until Keyword Succeeds  30 sec  5 sec  Location Should Contain  sensors
132
133    # Added delay for sensor page to load completely by waiting for disapperance of progress bar.
134    Wait Until Element Is Not Visible   ${xpath_page_loading_progress_bar}  timeout=15min
135
136
137Clean Up Filter Values
138    [Documentation]  Do clean up filter values after test execution
139    Click Element  ${xpath_sensors_filter}
140    Click Element  ${xpath_filter_clear_all}
141