@@ -17,6 +17,7 @@ import {Icon} from '@iconify/react';
1717import cx from 'classnames' ;
1818
1919import { Button , Input , Select , type SelectItem } from '@parca/components' ;
20+ import { testId } from '@parca/test-utils' ;
2021
2122import { useProfileViewContext } from '../../context/ProfileViewContext' ;
2223import { getPresetByKey , getPresetsForProfileType , isPresetKey } from './filterPresets' ;
@@ -204,7 +205,7 @@ const ProfileFilters = ({readOnly = false}: ProfileFiltersProps = {}): JSX.Eleme
204205 const filtersToRender = localFilters . length > 0 ? localFilters : appliedFilters ?? [ ] ;
205206
206207 return (
207- < div className = "flex gap-2 w-full items-start" >
208+ < div className = "flex gap-2 w-full items-start" { ... testId ( 'PROFILE_FILTERS_CONTAINER' ) } >
208209 < div className = "flex-1 flex flex-wrap gap-2" >
209210 { filtersToRender . map ( filter => {
210211 const isNumberField = filter . field === 'address' || filter . field === 'line_number' ;
@@ -218,6 +219,8 @@ const ProfileFilters = ({readOnly = false}: ProfileFiltersProps = {}): JSX.Eleme
218219 selectedKey = { filter . type }
219220 placeholder = "Select Filter"
220221 disabled = { readOnly }
222+ { ...testId ( 'FILTER_TYPE_SELECT' ) }
223+ flyoutTestId = "filter-type-select-flyout"
221224 onSelection = { key => {
222225 // Check if this is a preset selection
223226 if ( isPresetKey ( key ) ) {
@@ -266,6 +269,8 @@ const ProfileFilters = ({readOnly = false}: ProfileFiltersProps = {}): JSX.Eleme
266269 items = { fieldItems }
267270 selectedKey = { filter . field ?? '' }
268271 disabled = { readOnly }
272+ { ...testId ( 'FILTER_FIELD_SELECT' ) }
273+ flyoutTestId = "filter-field-select-flyout"
269274 onSelection = { key => {
270275 const newField = key as ProfileFilter [ 'field' ] ;
271276 const isNewFieldNumber = newField === 'address' || newField === 'line_number' ;
@@ -292,6 +297,8 @@ const ProfileFilters = ({readOnly = false}: ProfileFiltersProps = {}): JSX.Eleme
292297 items = { matchTypeItems }
293298 selectedKey = { filter . matchType ?? '' }
294299 disabled = { readOnly }
300+ { ...testId ( 'FILTER_MATCH_TYPE_SELECT' ) }
301+ flyoutTestId = "filter-match-type-select-flyout"
295302 onSelection = { key =>
296303 updateFilter ( filter . id , { matchType : key as ProfileFilter [ 'matchType' ] } )
297304 }
@@ -309,13 +316,15 @@ const ProfileFilters = ({readOnly = false}: ProfileFiltersProps = {}): JSX.Eleme
309316 onChange = { e => updateFilter ( filter . id , { value : e . target . value } ) }
310317 onKeyDown = { handleKeyDown }
311318 className = "rounded-none w-36 text-sm focus:outline-1"
319+ { ...testId ( 'FILTER_VALUE_INPUT' ) }
312320 />
313321 </ >
314322 ) }
315323
316324 { ! readOnly && (
317325 < Button
318326 variant = "neutral"
327+ { ...testId ( 'FILTER_REMOVE_BUTTON' ) }
319328 onClick = { ( ) => {
320329 // If we're displaying local filters and this is the last one, reset everything
321330 if ( localFilters . length > 0 && localFilters . length === 1 ) {
@@ -345,13 +354,23 @@ const ProfileFilters = ({readOnly = false}: ProfileFiltersProps = {}): JSX.Eleme
345354 } ) }
346355
347356 { ! readOnly && localFilters . length > 0 && (
348- < Button variant = "neutral" onClick = { addFilter } className = "p-3 h-[38px]" >
357+ < Button
358+ variant = "neutral"
359+ onClick = { addFilter }
360+ className = "p-3 h-[38px]"
361+ { ...testId ( 'ADD_FILTER_BUTTON' ) }
362+ >
349363 < Icon icon = "mdi:filter-plus-outline" className = "h-4 w-4" />
350364 </ Button >
351365 ) }
352366
353367 { ! readOnly && localFilters . length === 0 && ( appliedFilters ?. length ?? 0 ) === 0 && (
354- < Button variant = "neutral" onClick = { addFilter } className = "flex items-center gap-2" >
368+ < Button
369+ variant = "neutral"
370+ onClick = { addFilter }
371+ className = "flex items-center gap-2"
372+ { ...testId ( 'ADD_FILTER_BUTTON' ) }
373+ >
355374 < Icon icon = "mdi:filter-outline" className = "h-4 w-4" />
356375 < span > Filter</ span >
357376 </ Button >
@@ -364,6 +383,7 @@ const ProfileFilters = ({readOnly = false}: ProfileFiltersProps = {}): JSX.Eleme
364383 onClick = { onApplyFilters }
365384 disabled = { ! hasUnsavedChanges || ! localFilters . some ( isFilterComplete ) }
366385 className = { cx ( 'flex items-center gap-2 sticky top-0' ) }
386+ { ...testId ( 'APPLY_FILTERS_BUTTON' ) }
367387 >
368388 < span > Apply</ span >
369389 </ Button >
0 commit comments