Skip to content

Commit

Permalink
Fix custom fields flaky test.
Browse files Browse the repository at this point in the history
  • Loading branch information
adcoelho committed Jul 30, 2024
1 parent f391ed6 commit e2016b3
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ import { createAppMockRenderer } from '../../common/mock';
import { FormTestComponent } from '../../common/test_utils';
import { customFieldsConfigurationMock } from '../../containers/mock';
import { CustomFields } from './custom_fields';
import * as i18n from './translations';

// FLAKY: https://github.com/elastic/kibana/issues/188133
describe.skip('CustomFields', () => {
describe('CustomFields', () => {
let appMockRender: AppMockRenderer;
const onSubmit = jest.fn();

Expand All @@ -40,14 +38,17 @@ describe.skip('CustomFields', () => {
</FormTestComponent>
);

expect(await screen.findByText(i18n.ADDITIONAL_FIELDS)).toBeInTheDocument();
expect(await screen.findByTestId('caseCustomFields')).toBeInTheDocument();

for (const item of customFieldsConfigurationMock) {
expect(
await screen.findByTestId(`${item.key}-${item.type}-create-custom-field`)
).toBeInTheDocument();
}
const cf0 = customFieldsConfigurationMock[0];
const cf1 = customFieldsConfigurationMock[1];

expect(
await screen.findByTestId(`${cf0.key}-${cf0.type}-create-custom-field`)
).toBeInTheDocument();
expect(
await screen.findByTestId(`${cf1.key}-${cf1.type}-create-custom-field`)
).toBeInTheDocument();
});

it('should not show the custom fields if the configuration is empty', async () => {
Expand All @@ -61,7 +62,7 @@ describe.skip('CustomFields', () => {
</FormTestComponent>
);

expect(screen.queryByText(i18n.ADDITIONAL_FIELDS)).not.toBeInTheDocument();
expect(screen.queryByTestId('caseCustomFields')).not.toBeInTheDocument();
expect(screen.queryAllByTestId('create-custom-field', { exact: false }).length).toEqual(0);
});

Expand All @@ -76,7 +77,7 @@ describe.skip('CustomFields', () => {
</FormTestComponent>
);

expect(screen.getAllByTestId('form-optional-field-label')).toHaveLength(2);
expect(await screen.findAllByTestId('form-optional-field-label')).toHaveLength(2);
});

it('should not set default value when in edit mode', async () => {
Expand Down

0 comments on commit e2016b3

Please sign in to comment.