diff --git a/x-pack/plugins/cases/public/components/user_actions/property_actions/alert_property_actions.test.tsx b/x-pack/plugins/cases/public/components/user_actions/property_actions/alert_property_actions.test.tsx
index 982484f11ed47..ae0d7e39d5e1b 100644
--- a/x-pack/plugins/cases/public/components/user_actions/property_actions/alert_property_actions.test.tsx
+++ b/x-pack/plugins/cases/public/components/user_actions/property_actions/alert_property_actions.test.tsx
@@ -7,7 +7,7 @@
import React from 'react';
import { waitForEuiPopoverOpen } from '@elastic/eui/lib/test/rtl';
-import { waitFor } from '@testing-library/react';
+import { waitFor, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import type { AppMockRenderer } from '../../../common/mock';
import {
@@ -17,12 +17,7 @@ import {
} from '../../../common/mock';
import { AlertPropertyActions } from './alert_property_actions';
-// FLAKY: https://github.com/elastic/kibana/issues/174667
-// FLAKY: https://github.com/elastic/kibana/issues/174668
-// FLAKY: https://github.com/elastic/kibana/issues/174669
-// FLAKY: https://github.com/elastic/kibana/issues/174670
-// FLAKY: https://github.com/elastic/kibana/issues/174671
-describe.skip('AlertPropertyActions', () => {
+describe('AlertPropertyActions', () => {
let appMock: AppMockRenderer;
const props = {
@@ -32,93 +27,89 @@ describe.skip('AlertPropertyActions', () => {
};
beforeEach(() => {
- appMock = createAppMockRenderer();
jest.clearAllMocks();
+ appMock = createAppMockRenderer();
});
it('renders the correct number of actions', async () => {
- const result = appMock.render();
+ appMock.render();
- expect(result.getByTestId('property-actions-user-action')).toBeInTheDocument();
+ expect(await screen.findByTestId('property-actions-user-action')).toBeInTheDocument();
- userEvent.click(result.getByTestId('property-actions-user-action-ellipses'));
+ userEvent.click(await screen.findByTestId('property-actions-user-action-ellipses'));
await waitForEuiPopoverOpen();
- expect(result.getByTestId('property-actions-user-action-group').children.length).toBe(1);
- expect(result.queryByTestId('property-actions-user-action-minusInCircle')).toBeInTheDocument();
+ expect((await screen.findByTestId('property-actions-user-action-group')).children.length).toBe(
+ 1
+ );
+
+ expect(
+ await screen.findByTestId('property-actions-user-action-minusInCircle')
+ ).toBeInTheDocument();
});
it('renders the modal info correctly for one alert', async () => {
- const result = appMock.render();
+ appMock.render();
- expect(result.getByTestId('property-actions-user-action')).toBeInTheDocument();
+ expect(await screen.findByTestId('property-actions-user-action')).toBeInTheDocument();
- userEvent.click(result.getByTestId('property-actions-user-action-ellipses'));
+ userEvent.click(await screen.findByTestId('property-actions-user-action-ellipses'));
await waitForEuiPopoverOpen();
- expect(result.queryByTestId('property-actions-user-action-minusInCircle')).toBeInTheDocument();
+ userEvent.click(await screen.findByTestId('property-actions-user-action-minusInCircle'));
- userEvent.click(result.getByTestId('property-actions-user-action-minusInCircle'));
-
- await waitFor(() => {
- expect(result.queryByTestId('property-actions-confirm-modal')).toBeInTheDocument();
- });
+ expect(await screen.findByTestId('property-actions-confirm-modal')).toBeInTheDocument();
- expect(result.getByTestId('confirmModalTitleText')).toHaveTextContent('Remove alert');
- expect(result.getByText('Remove')).toBeInTheDocument();
+ expect(await screen.findByTestId('confirmModalTitleText')).toHaveTextContent('Remove alert');
+ expect(await screen.findByText('Remove')).toBeInTheDocument();
});
it('renders the modal info correctly for multiple alert', async () => {
- const result = appMock.render();
+ appMock.render();
- expect(result.getByTestId('property-actions-user-action')).toBeInTheDocument();
+ expect(await screen.findByTestId('property-actions-user-action')).toBeInTheDocument();
- userEvent.click(result.getByTestId('property-actions-user-action-ellipses'));
+ userEvent.click(await screen.findByTestId('property-actions-user-action-ellipses'));
await waitForEuiPopoverOpen();
- expect(result.queryByTestId('property-actions-user-action-minusInCircle')).toBeInTheDocument();
+ userEvent.click(await screen.findByTestId('property-actions-user-action-minusInCircle'));
- userEvent.click(result.getByTestId('property-actions-user-action-minusInCircle'));
+ expect(await screen.findByTestId('property-actions-confirm-modal')).toBeInTheDocument();
- await waitFor(() => {
- expect(result.queryByTestId('property-actions-confirm-modal')).toBeInTheDocument();
- });
-
- expect(result.getByTestId('confirmModalTitleText')).toHaveTextContent('Remove alerts');
- expect(result.getByText('Remove')).toBeInTheDocument();
+ expect(await screen.findByTestId('confirmModalTitleText')).toHaveTextContent('Remove alerts');
+ expect(await screen.findByText('Remove')).toBeInTheDocument();
});
it('remove alerts correctly', async () => {
- const result = appMock.render();
+ appMock.render();
- expect(result.getByTestId('property-actions-user-action')).toBeInTheDocument();
+ expect(await screen.findByTestId('property-actions-user-action')).toBeInTheDocument();
- userEvent.click(result.getByTestId('property-actions-user-action-ellipses'));
+ userEvent.click(await screen.findByTestId('property-actions-user-action-ellipses'));
await waitForEuiPopoverOpen();
- expect(result.queryByTestId('property-actions-user-action-minusInCircle')).toBeInTheDocument();
+ userEvent.click(await screen.findByTestId('property-actions-user-action-minusInCircle'));
- userEvent.click(result.getByTestId('property-actions-user-action-minusInCircle'));
+ expect(await screen.findByTestId('property-actions-confirm-modal')).toBeInTheDocument();
+
+ userEvent.click(screen.getByText('Remove'));
await waitFor(() => {
- expect(result.queryByTestId('property-actions-confirm-modal')).toBeInTheDocument();
+ expect(props.onDelete).toHaveBeenCalled();
});
-
- userEvent.click(result.getByText('Remove'));
- expect(props.onDelete).toHaveBeenCalled();
});
it('does not show the property actions without delete permissions', async () => {
appMock = createAppMockRenderer({ permissions: noCasesPermissions() });
- const result = appMock.render();
+ appMock.render();
- expect(result.queryByTestId('property-actions-user-action')).not.toBeInTheDocument();
+ expect(screen.queryByTestId('property-actions-user-action')).not.toBeInTheDocument();
});
it('does show the property actions with only delete permissions', async () => {
appMock = createAppMockRenderer({ permissions: onlyDeleteCasesPermission() });
- const result = appMock.render();
+ appMock.render();
- expect(result.getByTestId('property-actions-user-action')).toBeInTheDocument();
+ expect(await screen.findByTestId('property-actions-user-action')).toBeInTheDocument();
});
});