@@ -483,81 +483,84 @@ describe('DetectorsList', () => {
483483 expect ( screen . getByRole ( 'button' , { name : 'Delete' } ) ) . toBeDisabled ( ) ;
484484 } ) ;
485485
486- it ( 'shows option to select all query results when page is selected' , async ( ) => {
487- const deleteRequest = MockApiClient . addMockResponse ( {
488- url : '/organizations/org-slug/detectors/' ,
489- method : 'DELETE' ,
490- body : { } ,
491- } ) ;
492-
493- render ( < AllMonitors /> , { organization} ) ;
494- renderGlobalModal ( ) ;
495-
496- const testUser = UserFixture ( { id : '2' , email : 'test@example.com' } ) ;
497- // Mock the filtered search results - this will be used when search is applied
498- const filteredDetectors = Array . from ( { length : 20 } , ( _ , i ) =>
499- MetricDetectorFixture ( {
500- id : `filtered-${ i } ` ,
501- name : `Assigned Detector ${ i + 1 } ` ,
502- owner : ActorFixture ( { id : testUser . id , name : testUser . email , type : 'user' } ) ,
503- } )
504- ) ;
505-
506- MockApiClient . addMockResponse ( {
507- url : '/organizations/org-slug/detectors/' ,
508- body : filteredDetectors ,
509- headers : {
510- 'X-Hits' : '50' ,
511- } ,
512- match : [
513- MockApiClient . matchQuery ( {
514- query : '!type:issue_stream assignee:test@example.com' ,
515- } ) ,
516- ] ,
517- } ) ;
518-
519- // Click through menus to select assignee
520- const searchInput = await screen . findByRole ( 'combobox' , {
521- name : 'Add a search term' ,
522- } ) ;
523- await userEvent . type ( searchInput , 'assignee:test@example.com{enter}' ) ;
524-
525- // Wait for filtered results to load
526- await screen . findByText ( 'Assigned Detector 1' ) ;
527-
528- const rows = screen . getAllByTestId ( 'detector-list-row' ) ;
529-
530- // Focus on first row to make checkbox visible
531- await userEvent . click ( rows [ 0 ] ! ) ;
532- const firstRowCheckbox = within ( rows [ 0 ] ! ) . getByRole ( 'checkbox' ) ;
533- await userEvent . click ( firstRowCheckbox ) ;
534- expect ( firstRowCheckbox ) . toBeChecked ( ) ;
535-
536- // Select all on page - master checkbox should now be visible since we have a selection
537- const masterCheckbox = screen . getAllByRole ( 'checkbox' ) [ 0 ] ! ;
538- await userEvent . click ( masterCheckbox ) ;
539-
540- // Should show alert with option to select all query results
541- expect ( screen . getByText ( / 2 0 m o n i t o r s o n t h i s p a g e s e l e c t e d / ) ) . toBeInTheDocument ( ) ;
542- const selectAllForQuery = screen . getByRole ( 'button' , {
543- name : / S e l e c t a l l 5 0 m o n i t o r s t h a t m a t c h t h i s s e a r c h q u e r y / ,
544- } ) ;
545- await userEvent . click ( selectAllForQuery ) ;
546-
547- // Perform an action to verify query-based selection
548- await userEvent . click ( screen . getByRole ( 'button' , { name : 'Delete' } ) ) ;
549- const confirmModal = await screen . findByRole ( 'dialog' ) ;
550- await userEvent . click ( within ( confirmModal ) . getByRole ( 'button' , { name : 'Delete' } ) ) ; // Confirm
551-
552- await waitFor ( ( ) => {
553- expect ( deleteRequest ) . toHaveBeenCalledWith (
554- '/organizations/org-slug/detectors/' ,
555- expect . objectContaining ( {
556- query : { id : undefined , query : 'assignee:test@example.com' , project : [ 1 ] } ,
486+ it . knownFlake (
487+ 'shows option to select all query results when page is selected' ,
488+ async ( ) => {
489+ const deleteRequest = MockApiClient . addMockResponse ( {
490+ url : '/organizations/org-slug/detectors/' ,
491+ method : 'DELETE' ,
492+ body : { } ,
493+ } ) ;
494+
495+ render ( < AllMonitors /> , { organization} ) ;
496+ renderGlobalModal ( ) ;
497+
498+ const testUser = UserFixture ( { id : '2' , email : 'test@example.com' } ) ;
499+ // Mock the filtered search results - this will be used when search is applied
500+ const filteredDetectors = Array . from ( { length : 20 } , ( _ , i ) =>
501+ MetricDetectorFixture ( {
502+ id : `filtered-${ i } ` ,
503+ name : `Assigned Detector ${ i + 1 } ` ,
504+ owner : ActorFixture ( { id : testUser . id , name : testUser . email , type : 'user' } ) ,
557505 } )
558506 ) ;
559- } ) ;
560- } ) ;
507+
508+ MockApiClient . addMockResponse ( {
509+ url : '/organizations/org-slug/detectors/' ,
510+ body : filteredDetectors ,
511+ headers : {
512+ 'X-Hits' : '50' ,
513+ } ,
514+ match : [
515+ MockApiClient . matchQuery ( {
516+ query : '!type:issue_stream assignee:test@example.com' ,
517+ } ) ,
518+ ] ,
519+ } ) ;
520+
521+ // Click through menus to select assignee
522+ const searchInput = await screen . findByRole ( 'combobox' , {
523+ name : 'Add a search term' ,
524+ } ) ;
525+ await userEvent . type ( searchInput , 'assignee:test@example.com{enter}' ) ;
526+
527+ // Wait for filtered results to load
528+ await screen . findByText ( 'Assigned Detector 1' ) ;
529+
530+ const rows = screen . getAllByTestId ( 'detector-list-row' ) ;
531+
532+ // Focus on first row to make checkbox visible
533+ await userEvent . click ( rows [ 0 ] ! ) ;
534+ const firstRowCheckbox = within ( rows [ 0 ] ! ) . getByRole ( 'checkbox' ) ;
535+ await userEvent . click ( firstRowCheckbox ) ;
536+ expect ( firstRowCheckbox ) . toBeChecked ( ) ;
537+
538+ // Select all on page - master checkbox should now be visible since we have a selection
539+ const masterCheckbox = screen . getAllByRole ( 'checkbox' ) [ 0 ] ! ;
540+ await userEvent . click ( masterCheckbox ) ;
541+
542+ // Should show alert with option to select all query results
543+ expect ( screen . getByText ( / 2 0 m o n i t o r s o n t h i s p a g e s e l e c t e d / ) ) . toBeInTheDocument ( ) ;
544+ const selectAllForQuery = screen . getByRole ( 'button' , {
545+ name : / S e l e c t a l l 5 0 m o n i t o r s t h a t m a t c h t h i s s e a r c h q u e r y / ,
546+ } ) ;
547+ await userEvent . click ( selectAllForQuery ) ;
548+
549+ // Perform an action to verify query-based selection
550+ await userEvent . click ( screen . getByRole ( 'button' , { name : 'Delete' } ) ) ;
551+ const confirmModal = await screen . findByRole ( 'dialog' ) ;
552+ await userEvent . click ( within ( confirmModal ) . getByRole ( 'button' , { name : 'Delete' } ) ) ; // Confirm
553+
554+ await waitFor ( ( ) => {
555+ expect ( deleteRequest ) . toHaveBeenCalledWith (
556+ '/organizations/org-slug/detectors/' ,
557+ expect . objectContaining ( {
558+ query : { id : undefined , query : 'assignee:test@example.com' , project : [ 1 ] } ,
559+ } )
560+ ) ;
561+ } ) ;
562+ }
563+ ) ;
561564
562565 it ( 'disables action buttons when user does not have permissions' , async ( ) => {
563566 const noPermsOrganization = OrganizationFixture ( {
0 commit comments