diff --git a/x-pack/plugins/cases/public/components/case_form_fields/severity.test.tsx b/x-pack/plugins/cases/public/components/case_form_fields/severity.test.tsx
index b1c893d020e4e..2034d3c4099ac 100644
--- a/x-pack/plugins/cases/public/components/case_form_fields/severity.test.tsx
+++ b/x-pack/plugins/cases/public/components/case_form_fields/severity.test.tsx
@@ -6,9 +6,7 @@
*/
import React from 'react';
-import { screen, waitFor } from '@testing-library/react';
-import type { AppMockRenderer } from '../../common/mock';
-import { createAppMockRenderer } from '../../common/mock';
+import { render, screen, waitFor } from '@testing-library/react';
import { Severity } from './severity';
import userEvent from '@testing-library/user-event';
import { waitForEuiPopoverOpen } from '@elastic/eui/lib/test/rtl';
@@ -17,18 +15,8 @@ import { FormTestComponent } from '../../common/test_utils';
const onSubmit = jest.fn();
describe('Severity form field', () => {
- let appMockRender: AppMockRenderer;
-
- beforeEach(() => {
- appMockRender = createAppMockRenderer();
- });
-
- afterEach(async () => {
- await appMockRender.clearQueryCache();
- });
-
it('renders', async () => {
- appMockRender.render(
+ render(
@@ -40,7 +28,7 @@ describe('Severity form field', () => {
// default to LOW in this test configuration
it('defaults to the correct value', async () => {
- appMockRender.render(
+ render(
@@ -51,7 +39,7 @@ describe('Severity form field', () => {
});
it('selects the correct value when changed', async () => {
- appMockRender.render(
+ render(
@@ -73,7 +61,7 @@ describe('Severity form field', () => {
});
it('disables when loading data', async () => {
- appMockRender.render(
+ render(
diff --git a/x-pack/plugins/cases/public/components/case_form_fields/title.test.tsx b/x-pack/plugins/cases/public/components/case_form_fields/title.test.tsx
index e277a992c6bda..e861b4a3babe9 100644
--- a/x-pack/plugins/cases/public/components/case_form_fields/title.test.tsx
+++ b/x-pack/plugins/cases/public/components/case_form_fields/title.test.tsx
@@ -7,7 +7,7 @@
import type { FC, PropsWithChildren } from 'react';
import React from 'react';
-import { screen } from '@testing-library/react';
+import { render, screen } from '@testing-library/react';
import type { FormHook } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
import type { CaseFormFieldsSchemaProps } from './schema';
@@ -17,11 +17,9 @@ import userEvent from '@testing-library/user-event';
import { Title } from './title';
import { schema } from '../create/schema';
-import { createAppMockRenderer, type AppMockRenderer } from '../../common/mock';
describe('Title', () => {
let globalForm: FormHook;
- let appMockRender: AppMockRenderer;
const MockHookWrapperComponent: FC> = ({ children }) => {
const { form } = useForm({
@@ -38,11 +36,10 @@ describe('Title', () => {
beforeEach(() => {
jest.resetAllMocks();
- appMockRender = createAppMockRenderer();
});
it('it renders', async () => {
- appMockRender.render(
+ render(
@@ -52,7 +49,7 @@ describe('Title', () => {
});
it('it disables the input when loading', async () => {
- appMockRender.render(
+ render(
@@ -61,7 +58,7 @@ describe('Title', () => {
});
it('it changes the title', async () => {
- appMockRender.render(
+ render(
diff --git a/x-pack/plugins/cases/public/components/filter_popover/index.test.tsx b/x-pack/plugins/cases/public/components/filter_popover/index.test.tsx
index 77e5593671c7a..c45599860a560 100644
--- a/x-pack/plugins/cases/public/components/filter_popover/index.test.tsx
+++ b/x-pack/plugins/cases/public/components/filter_popover/index.test.tsx
@@ -6,31 +6,21 @@
*/
import React from 'react';
-import { waitForEuiPopoverOpen, screen } from '@elastic/eui/lib/test/rtl';
-import { waitFor } from '@testing-library/react';
+import { waitForEuiPopoverOpen } from '@elastic/eui/lib/test/rtl';
+import { render, waitFor, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
-
-import type { AppMockRenderer } from '../../common/mock';
-import { createAppMockRenderer } from '../../common/mock';
-
import { FilterPopover } from '.';
describe('FilterPopover ', () => {
- let appMockRender: AppMockRenderer;
const onSelectedOptionsChanged = jest.fn();
const tags: string[] = ['coke', 'pepsi'];
beforeEach(() => {
- appMockRender = createAppMockRenderer();
jest.clearAllMocks();
});
- afterEach(async () => {
- await appMockRender.clearQueryCache();
- });
-
it('renders button label correctly', async () => {
- appMockRender.render(
+ render(
{
});
it('renders empty label correctly', async () => {
- appMockRender.render(
+ render(
{
});
it('renders string type options correctly', async () => {
- appMockRender.render(
+ render(
{
});
it('should call onSelectionChange with selected option', async () => {
- appMockRender.render(
+ render(
{
});
it('should call onSelectionChange with empty array when option is deselected', async () => {
- appMockRender.render(
+ render(
{
const maxLengthLabel = `You have selected maximum number of ${maxLength} tags to filter`;
it('should show message when maximum options are selected', async () => {
- appMockRender.render(
+ render(
{
});
it('should not show message when maximum length label is missing', async () => {
- appMockRender.render(
+ render(
{
});
it('should not show message and disable options when maximum length property is missing', async () => {
- appMockRender.render(
+ render(
{
});
it('should allow to select more options when maximum length property is missing', async () => {
- appMockRender.render(
+ render(
React.lazy(() => {
@@ -32,8 +30,6 @@ const getLazyComponent = () =>
});
describe('createRegisteredAttachmentUserActionBuilder', () => {
- let appMockRender: AppMockRenderer;
-
const attachmentTypeId = 'test';
const builderArgs = getMockBuilderArgs();
const registry = new AttachmentTypeRegistry>(
@@ -77,7 +73,6 @@ describe('createRegisteredAttachmentUserActionBuilder', () => {
};
beforeEach(() => {
- appMockRender = createAppMockRenderer();
jest.clearAllMocks();
});
@@ -161,8 +156,7 @@ describe('createRegisteredAttachmentUserActionBuilder', () => {
const userAction =
createRegisteredAttachmentUserActionBuilder(userActionBuilderArgs).build()[0];
- // @ts-expect-error: children is a proper React element
- appMockRender.render(userAction.children);
+ render(userAction.children);
expect(await screen.findByText('My component')).toBeInTheDocument();
});
diff --git a/x-pack/plugins/cases/public/components/user_actions/show_more_button.test.tsx b/x-pack/plugins/cases/public/components/user_actions/show_more_button.test.tsx
index 34a0ad2713373..515cc5085f28c 100644
--- a/x-pack/plugins/cases/public/components/user_actions/show_more_button.test.tsx
+++ b/x-pack/plugins/cases/public/components/user_actions/show_more_button.test.tsx
@@ -6,31 +6,25 @@
*/
import React from 'react';
-import { screen } from '@testing-library/react';
+import { screen, render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { ShowMoreButton } from './show_more_button';
-import type { AppMockRenderer } from '../../common/mock';
-import { createAppMockRenderer } from '../../common/mock';
const showMoreClickMock = jest.fn();
-// FLAKY: https://github.com/elastic/kibana/issues/192672
-describe.skip('ShowMoreButton', () => {
- let appMockRender: AppMockRenderer;
-
+describe('ShowMoreButton', () => {
beforeEach(() => {
jest.clearAllMocks();
- appMockRender = createAppMockRenderer();
});
it('renders correctly', () => {
- appMockRender.render();
+ render();
expect(screen.getByTestId('cases-show-more-user-actions')).toBeInTheDocument();
});
it('shows loading state and is disabled when isLoading is true', () => {
- appMockRender.render();
+ render();
const btn = screen.getByTestId('cases-show-more-user-actions');
@@ -40,7 +34,7 @@ describe.skip('ShowMoreButton', () => {
});
it('calls onShowMoreClick on button click', async () => {
- appMockRender.render();
+ render();
await userEvent.click(screen.getByTestId('cases-show-more-user-actions'));
expect(showMoreClickMock).toHaveBeenCalled();