diff --git a/x-pack/plugins/cases/public/components/all_cases/columns_popover.test.tsx b/x-pack/plugins/cases/public/components/all_cases/columns_popover.test.tsx index c6278187d960c..27f94319ecbcf 100644 --- a/x-pack/plugins/cases/public/components/all_cases/columns_popover.test.tsx +++ b/x-pack/plugins/cases/public/components/all_cases/columns_popover.test.tsx @@ -8,6 +8,7 @@ import React from 'react'; import { screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { waitForEuiPopoverOpen } from '@elastic/eui/lib/test/rtl'; import type { AppMockRenderer } from '../../common/mock'; import { createAppMockRenderer } from '../../common/mock'; @@ -34,6 +35,8 @@ describe('ColumnsPopover', () => { userEvent.click(await screen.findByTestId('column-selection-popover-button')); + await waitForEuiPopoverOpen(); + expect(await screen.findByTestId('column-selection-popover')).toBeInTheDocument(); selectedColumns.forEach(({ field, name, isChecked }) => { @@ -132,6 +135,7 @@ describe('ColumnsPopover', () => { ); userEvent.click(await screen.findByTestId('column-selection-popover-button')); + await waitForEuiPopoverOpen(); userEvent.paste(await screen.findByTestId('column-selection-popover-search'), 'Title'); expect(await screen.findByTestId('column-selection-switch-title')).toBeInTheDocument(); @@ -150,9 +154,12 @@ describe('ColumnsPopover', () => { ); userEvent.click(await screen.findByTestId('column-selection-popover-button')); + await waitForEuiPopoverOpen(); userEvent.paste(await screen.findByTestId('column-selection-popover-search'), 'Category'); - expect(onSelectedColumnsChange).not.toHaveBeenCalled(); + await waitFor(() => { + expect(onSelectedColumnsChange).not.toHaveBeenCalled(); + }); }); it('searching for text hides the drag and drop icons', async () => { @@ -177,6 +184,9 @@ describe('ColumnsPopover', () => { ); userEvent.click(await screen.findByTestId('column-selection-popover-button')); + + await waitForEuiPopoverOpen(); + userEvent.paste(await screen.findByTestId('column-selection-popover-search'), 'Foobar'); expect(await screen.findByTestId('column-selection-popover-show-all-button')).toBeDisabled();