@@ -5,148 +5,77 @@ test.describe('Search Filters', { tag: ['@search'] }, () => {
5
5
await page . goto ( '/search' ) ;
6
6
} ) ;
7
7
8
- const FILTER_GROUP_SEVERITY_TEXT =
9
- '[data-testid="filter-group-SeverityText"]' ;
10
- const FILTER_GROUP_CONTROL = '[data-testid="filter-group-control"]' ;
11
- const FILTER_CHECKBOX_INPUT_INFO =
12
- '[data-testid="filter-checkbox-input-info"]' ;
13
- const FILTER_CHECKBOX_INFO = '[data-testid="filter-checkbox-info"]' ;
14
- const FILTER_SEARCH_SEVERITY_TEXT =
15
- '[data-testid="filter-search-SeverityText"]' ;
16
- const FILTER_PIN_INFO = '[data-testid="filter-pin-info"]' ;
17
- const FILTER_GROUP = '[data-testid^="filter-group-"]' ;
18
- const FILTER_SEVERITY_INFO_EXCLUDE = '[data-testid="filter-exclude-info"]' ;
19
-
20
- test ( 'Comprehensive search filters workflow - apply, exclude, clear, and pin filters' , async ( {
21
- page,
22
- } ) => {
23
- await test . step ( 'Apply error filter from Severity group' , async ( ) => {
24
- const severityFilterGroup = page . locator ( FILTER_GROUP_SEVERITY_TEXT ) ;
25
- await expect ( severityFilterGroup ) . toBeVisible ( ) ;
26
-
27
- const severityControl = severityFilterGroup . locator ( FILTER_GROUP_CONTROL ) ;
28
- await severityControl . click ( ) ;
29
- await page . waitForTimeout ( 500 ) ;
30
-
31
- const infoFilterCheckbox = page . locator ( FILTER_CHECKBOX_INPUT_INFO ) ;
32
- await expect ( infoFilterCheckbox ) . toBeVisible ( ) ;
33
- await infoFilterCheckbox . click ( ) ;
34
- await expect ( infoFilterCheckbox ) . toBeChecked ( ) ;
35
- const searchResults = page . locator (
36
- '[data-testid="search-results-table"]' ,
37
- ) ;
38
- await expect ( searchResults ) . toBeVisible ( ) ;
39
- //todo: Check counts and accuracy of results
8
+ test ( 'should filter logs by severity level and persist pinned filters' , async ( { page } ) => {
9
+ await test . step ( 'Apply Info severity filter' , async ( ) => {
10
+ // Open the Severity filter group
11
+ await page . locator ( '[data-testid="filter-group-SeverityText"]' ) . click ( ) ;
12
+
13
+ // Select the Info severity level
14
+ const infoCheckbox = page . locator ( '[data-testid="filter-checkbox-input-info"]' ) ;
15
+ await expect ( infoCheckbox ) . toBeVisible ( ) ;
16
+ await infoCheckbox . click ( ) ;
17
+ await expect ( infoCheckbox ) . toBeChecked ( ) ;
18
+
19
+ // Verify search results are filtered
20
+ await expect ( page . locator ( '[data-testid="search-results-table"]' ) ) . toBeVisible ( ) ;
40
21
} ) ;
41
22
42
- await test . step ( 'Exclude Severity - Info filter' , async ( ) => {
43
- const infoFilterCheckbox = page . locator ( FILTER_CHECKBOX_INFO ) ;
44
- await infoFilterCheckbox . hover ( ) ;
45
-
46
- const excludeButton = page
47
- . locator ( FILTER_SEVERITY_INFO_EXCLUDE )
48
- . first ( ) ;
49
- await expect ( excludeButton ) . toBeVisible ( ) ;
50
- await excludeButton . click ( ) ;
23
+ await test . step ( 'Exclude Info severity level' , async ( ) => {
24
+ // Hover over the Info filter to show exclude button
25
+ const infoFilter = page . locator ( '[data-testid="filter-checkbox-info"]' ) ;
26
+ await infoFilter . hover ( ) ;
27
+
28
+ // Click exclude button to invert the filter
29
+ await page . locator ( '[data-testid="filter-exclude-info"]' ) . first ( ) . click ( ) ;
51
30
await page . waitForTimeout ( 500 ) ;
52
- const infoCheckboxInput = page . locator ( FILTER_CHECKBOX_INPUT_INFO ) ;
53
- await expect ( infoCheckboxInput ) . toHaveAttribute (
54
- 'data-indeterminate' ,
55
- 'true' ,
56
- ) ;
31
+
32
+ // Verify filter shows as excluded (indeterminate state)
33
+ const infoInput = page . locator ( '[data-testid="filter-checkbox-input-info"]' ) ;
34
+ await expect ( infoInput ) . toHaveAttribute ( 'data-indeterminate' , 'true' ) ;
57
35
await page . waitForLoadState ( 'networkidle' ) ;
58
- await page . waitForTimeout ( 2000 ) ;
59
- } ) ;
60
-
61
- await test . step ( 'Clear error filter' , async ( ) => {
62
- const infoFilterCheckbox = page . locator ( FILTER_CHECKBOX_INFO ) ;
63
- await infoFilterCheckbox . click ( ) ;
64
- await page . waitForTimeout ( 1000 ) ;
65
36
} ) ;
66
37
67
- await test . step ( 'Use search input to filter by error' , async ( ) => {
68
- const severitySearchInput = page . locator ( FILTER_SEARCH_SEVERITY_TEXT ) ;
69
- await expect ( severitySearchInput ) . toBeVisible ( ) ;
70
- await severitySearchInput . fill ( 'info' ) ;
71
- await page . waitForTimeout ( 1000 ) ;
72
-
73
- const infoOption = page . locator ( FILTER_CHECKBOX_INFO ) ;
74
- await expect ( infoOption ) . toBeVisible ( ) ;
75
- await infoOption . click ( ) ;
76
- await page . waitForTimeout ( 1000 ) ;
77
-
78
- await severitySearchInput . fill ( '' ) ;
38
+ await test . step ( 'Clear the filter' , async ( ) => {
39
+ // Click the filter again to clear it
40
+ await page . locator ( '[data-testid="filter-checkbox-info"]' ) . click ( ) ;
79
41
await page . waitForTimeout ( 500 ) ;
80
42
} ) ;
81
43
82
- await test . step ( 'Pin error filter and verify persistence' , async ( ) => {
83
- const infoFilterCheckbox = page . locator ( FILTER_CHECKBOX_INFO ) ;
84
- const excludeButton = page . locator ( FILTER_SEVERITY_INFO_EXCLUDE ) ;
85
-
86
- await infoFilterCheckbox . hover ( ) ;
87
- await excludeButton . click ( ) ;
88
- await infoFilterCheckbox . hover ( ) ;
44
+ await test . step ( 'Test using search to find and apply the filter' , async ( ) => {
45
+ // Search for "info" in the severity filter
46
+ const searchInput = page . locator ( '[data-testid="filter-search-SeverityText"]' ) ;
47
+ await searchInput . fill ( 'info' ) ;
89
48
await page . waitForTimeout ( 500 ) ;
90
-
91
- const pinButton = page . locator ( FILTER_PIN_INFO ) ;
92
- await expect ( pinButton ) . toBeVisible ( ) ;
93
- await pinButton . click ( ) ;
94
- await page . waitForTimeout ( 1000 ) ;
95
-
96
- await page . reload ( ) ;
97
- await page . waitForLoadState ( 'networkidle' ) ;
98
- await page . waitForTimeout ( 2000 ) ;
99
-
100
- const pinnedErrorFilter = page . locator ( FILTER_CHECKBOX_INFO ) . first ( ) ;
101
- await expect ( pinnedErrorFilter ) . toBeVisible ( ) ;
102
- } ) ;
103
- } ) ;
104
-
105
- test ( 'Basic filter interaction' , async ( { page } ) => {
106
- await test . step ( 'Open first filter group' , async ( ) => {
107
- const filterGroups = page . locator ( FILTER_GROUP ) ;
108
- await expect ( filterGroups . first ( ) ) . toBeVisible ( ) ;
109
-
110
- const firstGroup = filterGroups . first ( ) ;
111
- const groupControl = firstGroup . locator (
112
- '[data-testid="filter-group-control"]' ,
113
- ) ;
114
- await expect ( groupControl ) . toBeVisible ( ) ;
115
- await groupControl . click ( ) ;
49
+
50
+ // Apply the Info filter from search results
51
+ await page . locator ( '[data-testid="filter-checkbox-info"]' ) . click ( ) ;
116
52
await page . waitForTimeout ( 500 ) ;
117
- } ) ;
118
-
119
- await test . step ( 'Interact with filter checkbox and verify actions' , async ( ) => {
120
- const filterGroups = page . locator ( FILTER_GROUP ) ;
121
- const firstGroup = filterGroups . first ( ) ;
122
- const filterCheckboxes = firstGroup . locator (
123
- '[data-testid^="filter-checkbox-"]' ,
124
- ) ;
125
- await expect ( filterCheckboxes . first ( ) ) . toBeVisible ( ) ;
126
-
127
- const firstCheckbox = filterCheckboxes . first ( ) ;
128
- await firstCheckbox . click ( ) ;
129
- await page . waitForTimeout ( 1000 ) ;
130
-
131
- await firstCheckbox . hover ( ) ;
53
+
54
+ // Clear the search
55
+ await searchInput . clear ( ) ;
132
56
await page . waitForTimeout ( 500 ) ;
133
-
134
- const actionButtons = firstCheckbox . locator ( '[data-testid^="filter-"]' ) ;
135
- await expect ( actionButtons . first ( ) ) . toBeVisible ( ) ;
136
57
} ) ;
137
- } ) ;
138
58
139
- test ( 'Filter search functionality ', async ( { page } ) => {
140
- await test . step ( 'Test filter search input functionality' , async ( ) => {
141
- const searchInputs = page . locator ( '[data-testid^="filter-search-"]' ) ;
142
- await expect ( searchInputs . first ( ) ) . toBeVisible ( ) ;
143
-
144
- const firstSearchInput = searchInputs . first ( ) ;
145
- await firstSearchInput . fill ( 'test' ) ;
146
- await page . waitForTimeout ( 500 ) ;
147
-
148
- await firstSearchInput . fill ( '' ) ;
59
+ await test . step ( 'Pin filter and verify it persists after reload ', async ( ) => {
60
+ const infoFilter = page . locator ( '[data-testid="filter-checkbox-info"]' ) ;
61
+
62
+ // First exclude the filter, then pin it
63
+ await infoFilter . hover ( ) ;
64
+ await page . locator ( '[data-testid="filter-exclude-info"]' ) . click ( ) ;
65
+ await infoFilter . hover ( ) ;
66
+
67
+ // Pin the filter
68
+ await page . locator ( '[data-testid="filter-pin-info"]' ) . click ( ) ;
149
69
await page . waitForTimeout ( 500 ) ;
70
+
71
+ // Reload page and verify filter persists
72
+ await page . reload ( ) ;
73
+ await page . waitForLoadState ( 'networkidle' ) ;
74
+
75
+ await expect ( page . locator ( '[data-testid="filter-checkbox-info"]' ) . first ( ) ) . toBeVisible ( ) ;
150
76
} ) ;
151
77
} ) ;
78
+ //todo: test filter value pinning
79
+ //todo: text filter expand/collapse
80
+ //todo: test show more/show less
152
81
} ) ;
0 commit comments