@@ -13,6 +13,7 @@ import {
1313 INTERESTING_FILTER_KEYS_SOURCE_NAME ,
1414} from '../utils/constants' ;
1515import {
16+ adhocConditionsParam ,
1617 expectFiltersParam ,
1718 type FilterEntry ,
1819 filtersParam ,
@@ -256,22 +257,60 @@ test.describe(
256257 { name : 'Conditions' , sources : [ DEFAULT_LOGS_SOURCE_NAME ] } ,
257258 ] ) ;
258259
259- await new TableComponent ( page ) . clickFirstRow ( ) ;
260- await new SidePanelComponent (
261- page ,
262- 'row-side-panel' ,
263- ) . addParsedFieldToFilter ( 'ServiceName' ) ;
264- await expect
265- . poll ( ( ) => filtersParam ( page ) )
266- . toEqual ( [
267- {
268- type : 'adhoc' ,
269- name : 'Conditions' ,
270- conditions : [
271- { key : 'ServiceName' , operator : '=' , value : expect . any ( String ) } ,
272- ] ,
273- } ,
274- ] ) ;
260+ const sidePanel = new SidePanelComponent ( page , 'row-side-panel' ) ;
261+ const serviceCondition = {
262+ key : 'ServiceName' ,
263+ operator : '=' ,
264+ value : expect . any ( String ) ,
265+ } ;
266+ const expectServiceCondition = ( ) =>
267+ expect
268+ . poll ( ( ) => filtersParam ( page ) )
269+ . toEqual ( [
270+ {
271+ type : 'adhoc' ,
272+ name : 'Conditions' ,
273+ conditions : [ serviceCondition ] ,
274+ } ,
275+ ] ) ;
276+
277+ await test . step ( 'Add to filters adds a condition' , async ( ) => {
278+ await new TableComponent ( page ) . clickFirstRow ( ) ;
279+ await sidePanel . addParsedFieldToFilter ( 'ServiceName' ) ;
280+ await expectServiceCondition ( ) ;
281+ } ) ;
282+
283+ await test . step ( 'Adding it again keeps the condition' , async ( ) => {
284+ await sidePanel . addParsedFieldToFilter ( 'ServiceName' ) ;
285+ await expectServiceCondition ( ) ;
286+ } ) ;
287+
288+ await test . step ( 'Surrounding context cells are shaped like tile cells' , async ( ) => {
289+ const [ { value : serviceName } ] = adhocConditionsParam (
290+ page ,
291+ 'Conditions' ,
292+ ) ;
293+ await sidePanel . clickTab ( 'context' ) ;
294+ const contextTable = sidePanel . contextTab . getByTestId (
295+ 'search-results-table' ,
296+ ) ;
297+ const includeAction = contextTable . getByRole ( 'button' , {
298+ name : 'Toggle filter for this value' ,
299+ } ) ;
300+ await contextTable
301+ . getByText ( serviceName , { exact : true } )
302+ . first ( )
303+ . hover ( ) ;
304+ await expect ( includeAction . last ( ) ) . toBeVisible ( ) ;
305+ await contextTable
306+ . getByText ( / \d : \d { 2 } : \d { 2 } \. \d { 3 } / )
307+ . first ( )
308+ . hover ( ) ;
309+ await expect (
310+ contextTable . getByRole ( 'button' , { name : 'Copy field value' } ) . last ( ) ,
311+ ) . toBeVisible ( ) ;
312+ await expect ( includeAction ) . toHaveCount ( 0 ) ;
313+ } ) ;
275314 } ) ;
276315
277316 test ( 'offers filter actions only where an ad hoc filter applies' , async ( ) => {
0 commit comments