diff --git a/.buildkite/disabled_jest_configs.json b/.buildkite/disabled_jest_configs.json
index 0d7741e60b38..fe51488c7066 100644
--- a/.buildkite/disabled_jest_configs.json
+++ b/.buildkite/disabled_jest_configs.json
@@ -1,3 +1 @@
-[
- "x-pack/plugins/index_management/jest.config.js"
-]
\ No newline at end of file
+[]
diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.test.tsx b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.test.tsx
index fd373efb6d17..367437e5c534 100644
--- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.test.tsx
+++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_create.test.tsx
@@ -100,14 +100,10 @@ describe('', () => {
httpRequestsMockHelpers.setLoadComponentTemplatesResponse(componentTemplates);
httpRequestsMockHelpers.setLoadNodesPluginsResponse([]);
-
- // disable all react-beautiful-dnd development warnings
- (window as any)['__@hello-pangea/dnd-disable-dev-warnings'] = true;
});
afterAll(() => {
jest.useRealTimers();
- (window as any)['__@hello-pangea/dnd-disable-dev-warnings'] = false;
});
describe('composable index template', () => {
@@ -533,11 +529,6 @@ describe('', () => {
name: TEMPLATE_NAME,
indexPatterns: DEFAULT_INDEX_PATTERNS,
dataStream: {},
- lifecycle: {
- enabled: true,
- value: 1,
- unit: 'd',
- },
allowAutoCreate: true,
});
// Component templates
@@ -551,13 +542,14 @@ describe('', () => {
});
it('should send the correct payload', async () => {
- const { actions, find } = testBed;
+ const { component, actions, find } = testBed;
expect(find('stepTitle').text()).toEqual(`Review details for '${TEMPLATE_NAME}'`);
await act(async () => {
actions.clickNextButton();
});
+ component.update();
expect(httpSetup.post).toHaveBeenLastCalledWith(
`${API_BASE_PATH}/index_templates`,
@@ -589,10 +581,6 @@ describe('', () => {
},
},
aliases: ALIASES,
- lifecycle: {
- enabled: true,
- data_retention: '1d',
- },
},
}),
})
@@ -620,44 +608,59 @@ describe('', () => {
});
});
- test('preview data stream', async () => {
- await act(async () => {
- testBed = await setup(httpSetup);
- });
- testBed.component.update();
+ describe('DSL', () => {
+ beforeEach(async () => {
+ await act(async () => {
+ testBed = await setup(httpSetup);
+ });
+ testBed.component.update();
- const { actions } = testBed;
- // Logistics
- await actions.completeStepOne({
- name: TEMPLATE_NAME,
- indexPatterns: DEFAULT_INDEX_PATTERNS,
- dataStream: {},
- lifecycle: {
- enabled: true,
- value: 1,
- unit: 'd',
- },
+ await testBed.actions.completeStepOne({
+ name: TEMPLATE_NAME,
+ indexPatterns: DEFAULT_INDEX_PATTERNS,
+ dataStream: {},
+ lifecycle: {
+ enabled: true,
+ value: 1,
+ unit: 'd',
+ },
+ });
});
- await act(async () => {
- await actions.previewTemplate();
+ test('should include DSL in summary when set in step 1', async () => {
+ const { find, component } = testBed;
+
+ await act(async () => {
+ testBed.find('formWizardStep-5').simulate('click');
+ });
+ component.update();
+
+ expect(find('lifecycleValue').text()).toContain('1 day');
});
- expect(httpSetup.post).toHaveBeenLastCalledWith(
- `${API_BASE_PATH}/index_templates/simulate`,
- expect.objectContaining({
- body: JSON.stringify({
- template: {
- lifecycle: {
- enabled: true,
- data_retention: '1d',
+ test('preview data stream', async () => {
+ const { actions } = testBed;
+
+ await act(async () => {
+ await actions.previewTemplate();
+ });
+
+ expect(httpSetup.post).toHaveBeenLastCalledWith(
+ `${API_BASE_PATH}/index_templates/simulate`,
+ expect.objectContaining({
+ body: JSON.stringify({
+ template: {
+ lifecycle: {
+ enabled: true,
+ data_retention: '1d',
+ },
},
- },
- index_patterns: DEFAULT_INDEX_PATTERNS,
- data_stream: {},
- allow_auto_create: false,
- }),
- })
- );
+ index_patterns: DEFAULT_INDEX_PATTERNS,
+ data_stream: {},
+ allow_auto_create: false,
+ }),
+ })
+ );
+ });
});
});
diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts
index 8b98fb769959..88cee63b0e69 100644
--- a/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts
+++ b/x-pack/plugins/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts
@@ -185,27 +185,24 @@ export const formSetup = async (initTestBed: SetupFunc) => {
if (version) {
form.setInputValue('versionField.input', JSON.stringify(version));
}
+
+ if (allowAutoCreate) {
+ form.toggleEuiSwitch('allowAutoCreateField.input');
+ }
});
component.update();
if (lifecycle && lifecycle.enabled) {
- act(() => {
+ await act(async () => {
form.toggleEuiSwitch('dataRetentionToggle.input');
});
component.update();
- act(() => {
- form.setInputValue('valueDataRetentionField', String(lifecycle.value));
- });
+ form.setInputValue('valueDataRetentionField', String(lifecycle.value));
}
await act(async () => {
- if (allowAutoCreate) {
- form.toggleEuiSwitch('allowAutoCreateField.input');
- }
-
clickNextButton();
- jest.advanceTimersByTime(0);
});
component.update();
@@ -378,6 +375,8 @@ export type TestSubjects =
| 'settingsEditor'
| 'versionField.input'
| 'valueDataRetentionField'
+ | 'formWizardStep-5'
+ | 'lifecycleValue'
| 'mappingsEditor.formTab'
| 'mappingsEditor.advancedConfiguration.sizeEnabledToggle'
| 'previewIndexTemplate';