mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[ResponseOps][Cases] Fix custom fields flaky test. (#189475)
fixes #188133 ## Summary I simplified the failing test a bit to make it less likely to timeout. 1. We checked for the test **and** the `id` to make sure the component was rendered, it was redundant. 2. We looked for all custom fields(4) and I reduced the check to just 2(which have different types). 3. Updated another test that looked for a label to look for an `id`(for consistency).
This commit is contained in:
parent
20912a70f9
commit
60e1257d31
1 changed files with 12 additions and 11 deletions
|
@ -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();
|
||||
|
||||
|
@ -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 () => {
|
||||
|
@ -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);
|
||||
});
|
||||
|
||||
|
@ -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 () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue