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