Skip to content

[Index Management] Migrate flaky integration tests to unit tests#258942

Merged
kapral18 merged 5 commits intoelastic:mainfrom
kapral18:chore/index_management/fix-mappings-editor-flaky-tests-253534
Mar 26, 2026
Merged

[Index Management] Migrate flaky integration tests to unit tests#258942
kapral18 merged 5 commits intoelastic:mainfrom
kapral18:chore/index_management/fix-mappings-editor-flaky-tests-253534

Conversation

@kapral18
Copy link
Copy Markdown
Contributor

@kapral18 kapral18 commented Mar 20, 2026

Summary

  • Migrates flaky Index Management client integration coverage to focused unit/section tests (mappings editor + template wizard).
  • Speeds up mappings_editor.test.tsx by mocking UI-heavy bits and adds compensation unit tests for TypeParameter and ReferenceFieldSelects.
  • Removes legacy __jest__/client_integration specs/helpers for these areas.

Closes

Coverage mapping

Test plan

  • node scripts/check_changes.ts
  • yarn test:jest x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.edit_field.test.tsx x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.text_datatype.test.tsx x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.test.tsx x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/reference_field_selects.test.tsx
  • yarn test:jest x-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx x-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx x-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx x-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx

@kapral18
Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 20, 2026

✅ Actions performed

Full review triggered.

@kapral18 kapral18 added Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// Feature:Index Management Index and index templates UI release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels v9.4.0 v9.3.1 labels Mar 20, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 20, 2026

✅ Actions performed

Full review triggered.

@kapral18 kapral18 force-pushed the chore/index_management/fix-mappings-editor-flaky-tests-253534 branch from bf0a668 to c38f45b Compare March 20, 2026 23:58
@kapral18 kapral18 marked this pull request as ready for review March 20, 2026 23:59
@kapral18 kapral18 requested a review from a team as a code owner March 20, 2026 23:59
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-management (Team:Kibana Management)

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: c5572871-81f6-44c2-a7ef-ea3c216400a3

📥 Commits

Reviewing files that changed from the base of the PR and between 30b9fdc and 6a77ace.

📒 Files selected for processing (10)
  • x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_template_wizard/template_clone.test.tsx
  • x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_template_wizard/template_edit.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/template_form.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx
💤 Files with no reviewable changes (2)
  • x-pack/platform/plugins/shared/index_management/jest/client_integration/index_template_wizard/template_edit.test.tsx
  • x-pack/platform/plugins/shared/index_management/jest/client_integration/index_template_wizard/template_clone.test.tsx
✅ Files skipped from review due to trivial changes (3)
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/template_form.test.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx

📝 Walkthrough

Walkthrough

This PR deletes several legacy test helpers and full client-integration test suites (SelectInferenceId helpers, multiple index_template_wizard suites, and text-datatype/mappings-editor helpers/tests). It adds numerous new Jest + React Testing Library tests and helpers covering ReferenceFieldSelects, TypeParameter, MappingsEditor flows (edit-field, text datatype, core behaviors), TemplateForm and its steps, TemplateCreate/Clone/Edit, and buildTemplateFromWizardData cases. Several existing tests were refactored to inline mocks, simplify DOM interactions, and replace EUI test harnesses with native or mocked controls.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Pull request addresses all 8 linked issues by eliminating flaky client_integration tests and replacing them with deterministic unit/section tests.
Out of Scope Changes check ✅ Passed All changes are scoped to test migration: removal of flaky client_integration tests and helpers, addition of focused unit tests, and refactoring template/mappings editor test coverage.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • 🛠️ Update Documentation: Commit on current branch
  • 🛠️ Update Documentation: Create PR

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


Comment @coderabbitai help to get the list of available commands and usage tips.

@kapral18
Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 21, 2026

✅ Actions performed

Full review triggered.

3 similar comments
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 21, 2026

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 21, 2026

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 21, 2026

✅ Actions performed

Full review triggered.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx`:
- Around line 182-191: TestFormWrapper currently collapses an explicit
empty-string initialValue into undefined via the ternary "initialValue ? ... :
undefined", so tests that pass '' aren't exercising the real inference_id=''
state; update TestFormWrapper so it preserves the empty string by changing the
defaultValue logic to only treat undefined as missing (e.g., use initialValue
=== undefined ? undefined : { inference_id: initialValue }) when calling
useForm, leaving the rest of the form and tests unchanged.

In
`@x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx`:
- Around line 113-120: The mock component MockSelectInferenceIdContent currently
backfills the wrong default endpoint (it always sets
defaultInferenceEndpoints.ELSER); change the effect in
MockSelectInferenceIdContent so that when value is empty it sets
defaultInferenceEndpoints.JINAv5 instead, keeping the same useEffect signature
and dependencies (value, setValue) so test behavior matches the real
SelectInferenceId component.

In
`@x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx`:
- Around line 16-22: The mock for SimulateTemplate uses (props: unknown) —
replace unknown with the real props type from the source so TypeScript typing is
preserved; import the exported props/interface for SimulateTemplate (e.g.,
SimulateTemplateProps or the named props type) from the module where
SimulateTemplate is defined and change the mock signature to (props:
SimulateTemplateProps) so mockSimulateTemplatePropsSpy receives the correctly
typed props.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 6dba69be-84fb-43db-8584-c3a6c6dc50c9

📥 Commits

Reviewing files that changed from the base of the PR and between 89040a3 and c38f45b.

📒 Files selected for processing (19)
  • x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_details_page/select_inference_id.helpers.tsx
  • x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_template_wizard/template_clone.test.tsx
  • x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_template_wizard/template_edit.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/__jest__/client_integration/datatypes/text_datatype.helpers.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/__jest__/client_integration/datatypes/text_datatype.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/__jest__/client_integration/edit_field.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/reference_field_selects.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.edit_field.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.text_datatype.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx
💤 Files with no reviewable changes (6)
  • x-pack/platform/plugins/shared/index_management/jest/client_integration/index_template_wizard/template_edit.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/jest/client_integration/datatypes/text_datatype.test.tsx
  • x-pack/platform/plugins/shared/index_management/jest/client_integration/index_template_wizard/template_clone.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/jest/client_integration/edit_field.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/jest/client_integration/datatypes/text_datatype.helpers.tsx
  • x-pack/platform/plugins/shared/index_management/jest/client_integration/index_details_page/select_inference_id.helpers.tsx

@kapral18 kapral18 force-pushed the chore/index_management/fix-mappings-editor-flaky-tests-253534 branch 2 times, most recently from 0f0285b to 30b9fdc Compare March 21, 2026 02:25
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (3)
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx (1)

16-22: ⚠️ Potential issue | 🟡 Minor

Replace unknown in the mock props signature (Line 18).

SimulateTemplate: (props: unknown) violates the TypeScript rule and weakens type safety in this test. Please type the mock props explicitly (prefer the real exported props type, or React.ComponentProps<typeof SimulateTemplate>).

#!/bin/bash
set -euo pipefail

# 1) Confirm the exact violation
rg -n -C2 '\(props:\s*unknown\)' x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx

# 2) Find the concrete props type or component definition to bind to
fd 'index_templates*.ts*' x-pack/platform/plugins/shared/index_management/public/application/components --exec rg -n -C3 'SimulateTemplate|interface .*Props|type .*Props|export .*SimulateTemplate'

# Expected result:
# - First command shows the `unknown` usage in this test.
# - Second command locates a concrete props type (or component declaration) to use in the mock signature.

As per coding guidelines: Use TypeScript for all new code; avoid any and unknown.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx`
around lines 16 - 22, The mock for SimulateTemplate currently types its props as
unknown which weakens type safety; update the mock signature to use the real
props type (for example React.ComponentProps<typeof SimulateTemplate> or the
exported Props type) so the mocked function and mockSimulateTemplatePropsSpy
receive the correct shape; locate the SimulateTemplate export and replace
"(props: unknown)" with the concrete props type and update any import/type
references accordingly.
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx (1)

118-120: ⚠️ Potential issue | 🟠 Major

Align the mock default with the selector behavior this PR now tests elsewhere.

This still backfills ELSER for an empty inference_id, but the new SelectInferenceId coverage in this PR asserts JINAv5 for the same state. The semantic-text payload checks below can now pass while disagreeing with the selector path you just moved out of integration coverage.

Suggested fix
   React.useEffect(() => {
-    if (!value) setValue(defaultInferenceEndpoints.ELSER);
+    if (!value) setValue(defaultInferenceEndpoints.JINAv5);
   }, [value, setValue]);

Update the semantic-text expectations in this file to the same default.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx`
around lines 118 - 120, The test currently backfills
defaultInferenceEndpoints.ELSER via the React.useEffect mock (checking
value/setValue), but the new SelectInferenceId behavior and other tests expect
JINAv5 as the default for an empty inference_id; update the semantic-text
expectation assertions in mappings_editor.test.tsx to use JINAv5 instead of
ELSER so the mocked default aligns with SelectInferenceId’s behavior (search for
references to defaultInferenceEndpoints.ELSER, inference_id, SelectInferenceId,
and the semantic-text assertions and replace the expected payload/default from
ELSER to JINAv5).
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx (1)

182-191: ⚠️ Potential issue | 🟠 Major

Keep '' distinct from undefined in the form wrapper.

initialValue ? ... : undefined erases the explicit empty-string case. Every renderSelectInferenceId({ initialValue: '' }) path in this suite is currently starting from an uninitialized field, so the default-selection assertions are not exercising the same state the editor passes through.

Suggested fix
 function TestFormWrapper({
   children,
   initialValue = defaultInferenceEndpoints.ELSER,
 }: {
   children: React.ReactElement;
   initialValue?: string;
 }) {
   const { form } = useForm({
-    defaultValue: initialValue ? { inference_id: initialValue } : undefined,
+    defaultValue:
+      initialValue === undefined ? undefined : { inference_id: initialValue },
   });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx`
around lines 182 - 191, The TestFormWrapper uses initialValue ? { inference_id:
initialValue } : undefined which treats an explicit empty string as undefined;
change the defaultValue assignment in useForm so it preserves the empty-string
case (i.e., set defaultValue to { inference_id: initialValue } when initialValue
is provided even if it is ''), updating TestFormWrapper and its use of
useForm/defaultValue/inference_id/initialValue to ensure
renderSelectInferenceId({ initialValue: '' }) initializes the form field to ''
rather than leaving it undefined.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In
`@x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx`:
- Around line 182-191: The TestFormWrapper uses initialValue ? { inference_id:
initialValue } : undefined which treats an explicit empty string as undefined;
change the defaultValue assignment in useForm so it preserves the empty-string
case (i.e., set defaultValue to { inference_id: initialValue } when initialValue
is provided even if it is ''), updating TestFormWrapper and its use of
useForm/defaultValue/inference_id/initialValue to ensure
renderSelectInferenceId({ initialValue: '' }) initializes the form field to ''
rather than leaving it undefined.

In
`@x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx`:
- Around line 118-120: The test currently backfills
defaultInferenceEndpoints.ELSER via the React.useEffect mock (checking
value/setValue), but the new SelectInferenceId behavior and other tests expect
JINAv5 as the default for an empty inference_id; update the semantic-text
expectation assertions in mappings_editor.test.tsx to use JINAv5 instead of
ELSER so the mocked default aligns with SelectInferenceId’s behavior (search for
references to defaultInferenceEndpoints.ELSER, inference_id, SelectInferenceId,
and the semantic-text assertions and replace the expected payload/default from
ELSER to JINAv5).

In
`@x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx`:
- Around line 16-22: The mock for SimulateTemplate currently types its props as
unknown which weakens type safety; update the mock signature to use the real
props type (for example React.ComponentProps<typeof SimulateTemplate> or the
exported Props type) so the mocked function and mockSimulateTemplatePropsSpy
receive the correct shape; locate the SimulateTemplate export and replace
"(props: unknown)" with the concrete props type and update any import/type
references accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 30242cb2-846f-47d4-b8f5-ed3aa4f25731

📥 Commits

Reviewing files that changed from the base of the PR and between ceb80cf and 0f0285b.

📒 Files selected for processing (20)
  • x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_details_page/select_inference_id.helpers.tsx
  • x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_template_wizard/template_clone.test.tsx
  • x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_template_wizard/template_edit.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/__jest__/client_integration/datatypes/text_datatype.helpers.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/__jest__/client_integration/datatypes/text_datatype.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/__jest__/client_integration/edit_field.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/reference_field_selects.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.edit_field.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.text_datatype.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/template_form.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx
💤 Files with no reviewable changes (6)
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/jest/client_integration/datatypes/text_datatype.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/jest/client_integration/edit_field.test.tsx
  • x-pack/platform/plugins/shared/index_management/jest/client_integration/index_template_wizard/template_edit.test.tsx
  • x-pack/platform/plugins/shared/index_management/jest/client_integration/index_template_wizard/template_clone.test.tsx
  • x-pack/platform/plugins/shared/index_management/jest/client_integration/index_details_page/select_inference_id.helpers.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/jest/client_integration/datatypes/text_datatype.helpers.tsx

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@x-pack/platform/plugins/shared/index_management/public/application/components/template_form/template_form.test.tsx`:
- Around line 390-397: The test currently uses a rest-destructure to build
mockLogisticsData (const { _kbnMeta: _, template: __, ...logistics } =
originalTemplate) which unintentionally pulls component-related keys like
composedOf and ignoreMissingComponentTemplates into the logistics mock; change
this to explicitly pick only the true logistics fields from originalTemplate
(e.g., name, indexPatterns/index_patterns, priority/order, version, lifecycle,
etc.) when assigning mockLogisticsData so composedOf and
ignoreMissingComponentTemplates remain in mockComponentsData and the clone test
accurately mirrors the real step; update the beforeEach to set mockLogisticsData
= { name: originalTemplate.name, indexPatterns: originalTemplate.indexPatterns,
priority: originalTemplate.priority, version: originalTemplate.version, /* etc.
*/ } and ensure mockComponentsData and other mocks continue to come from
originalTemplate.composedOf / originalTemplate.template.*

In
`@x-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx`:
- Around line 174-181: The test is racing on navigation: after firing the save
action, wrap the navigation assertion in an await waitFor to ensure history.push
was called asynchronously; specifically, after confirming saveTemplate was
called, replace the direct
expect(pushSpy).toHaveBeenCalledWith(getTemplateDetailsLink(template.name,
false)) with an awaited waitFor that asserts pushSpy was called with
getTemplateDetailsLink(template.name, false) so the test waits until the async
handler invokes history.push.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 89422fe6-e460-4837-97e4-20d86ca014e2

📥 Commits

Reviewing files that changed from the base of the PR and between 0f0285b and 30b9fdc.

📒 Files selected for processing (20)
  • x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_details_page/select_inference_id.helpers.tsx
  • x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_template_wizard/template_clone.test.tsx
  • x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_template_wizard/template_edit.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/__jest__/client_integration/datatypes/text_datatype.helpers.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/__jest__/client_integration/datatypes/text_datatype.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/__jest__/client_integration/edit_field.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/reference_field_selects.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.edit_field.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.text_datatype.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/template_form.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx
💤 Files with no reviewable changes (6)
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/jest/client_integration/edit_field.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/jest/client_integration/datatypes/text_datatype.test.tsx
  • x-pack/platform/plugins/shared/index_management/jest/client_integration/index_template_wizard/template_clone.test.tsx
  • x-pack/platform/plugins/shared/index_management/jest/client_integration/index_template_wizard/template_edit.test.tsx
  • x-pack/platform/plugins/shared/index_management/jest/client_integration/index_details_page/select_inference_id.helpers.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/jest/client_integration/datatypes/text_datatype.helpers.tsx
✅ Files skipped from review due to trivial changes (3)
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/reference_field_selects.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts
  • x-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.edit_field.test.tsx
  • x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.text_datatype.test.tsx

@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #80 / InfraOps App Metrics UI Hosts View #With data #Single Host Flyout Tabs Dashboards Tab should render dashboards tab splash screen with option to add dashboard
  • [job] [logs] FTR Configs #168 / Package policies Package Policy - update Input Packages should install index templates when upgrading from input package to integration package

Metrics [docs]

Unknown metric groups

ESLint disabled line counts

id before after diff
indexManagement 14 10 -4

Total ESLint disabled count

id before after diff
indexManagement 15 11 -4

History

@kapral18 kapral18 force-pushed the chore/index_management/fix-mappings-editor-flaky-tests-253534 branch from 30b9fdc to 6a77ace Compare March 21, 2026 16:12
@kapral18 kapral18 added v9.3.3 and removed v9.3.1 labels Mar 22, 2026
@kapral18 kapral18 force-pushed the chore/index_management/fix-mappings-editor-flaky-tests-253534 branch from 6a77ace to 9e4ce1a Compare March 23, 2026 16:44
kapral18 and others added 5 commits March 24, 2026 21:29
Adds an integration test for the TemplateForm wizard pipeline that
exercises the full flow: defaultValue decomposition → step navigation →
buildTemplateFromWizardData → stripEmptyFields → onSave. This closes
the coverage gap from replacing the old full-flow template_clone and
template_edit integration tests with section-level unit tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kapral18 kapral18 force-pushed the chore/index_management/fix-mappings-editor-flaky-tests-253534 branch from 9e4ce1a to 9833f05 Compare March 24, 2026 20:29
Copy link
Copy Markdown
Contributor

@damian-polewski damian-polewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migration looks good! Thanks for working on that!

@kapral18 kapral18 merged commit a31fae8 into elastic:main Mar 26, 2026
18 checks passed
@kapral18 kapral18 deleted the chore/index_management/fix-mappings-editor-flaky-tests-253534 branch March 26, 2026 20:42
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 9.3

https://github.com/elastic/kibana/actions/runs/23617042515

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
9.3 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 258942

Questions ?

Please refer to the Backport tool documentation

mbondyra added a commit to mbondyra/kibana that referenced this pull request Mar 26, 2026
…hanges

* commit '22bf09c82658b9511cbb2ad13f6dd29ad3526472': (21 commits)
  [Overlays System Flyout]: Support Child History (elastic#256339)
  KUA-Update event naming format and examples (elastic#259846)
  Fix pagerduty connector codeownership (elastic#259807)
  [Upgrade Assistant] Migrate Kibana deprecations flaky integration tests to unit tests (elastic#258981)
  [Upgrade Assistant] Migrate ES deprecations flaky integration tests to unit tests (elastic#258142)
  [Index Management] Migrate flaky integration tests to unit tests (elastic#258942)
  [Cases] Rename attachment id to saved object id (elastic#259158)
  [Entity Store] Change hash algo to sha256 (elastic#259453)
  [Security Solution] fixed enhanced security profile header showing for non-alert documents (elastic#259801)
  Update LaunchDarkly (main) (elastic#259008)
  [Discover] Add observability default ES|QL query (elastic#257268)
  Update dependency @redocly/cli to v2.21.1 (main) (elastic#259016)
  Gap reason detected (elastic#258231)
  [One Workflow] Historical executionContext and telemetry (elastic#258623)
  coderabbit: drop SigEvents (elastic#259863)
  [ci] Bump cypress disk (elastic#259861)
  Server timings (elastic#258915)
  Replace deprecated EUI icons in files owned by @elastic/kibana-cases (elastic#255633)
  [ci] Bump storybooks disk (elastic#259858)
  [drilldowns] require embeddables to opt into ON_OPEN_PANEL_MENU trigger (elastic#259637)
  ...
@kapral18
Copy link
Copy Markdown
Contributor Author

💚 All backports created successfully

Status Branch Result
9.3

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kapral18 added a commit to kapral18/kibana that referenced this pull request Mar 27, 2026
…stic#258942)

- Migrates flaky Index Management client integration coverage to focused
unit/section tests (mappings editor + template wizard).
- Speeds up `mappings_editor.test.tsx` by mocking UI-heavy bits and adds
compensation unit tests for `TypeParameter` and `ReferenceFieldSelects`.
- Removes legacy `__jest__/client_integration` specs/helpers for these
areas.

- Closes elastic#257682
- Closes elastic#256305
- Closes elastic#253534
- Closes elastic#239816
- Closes elastic#239817
- Closes elastic#239818
- Closes elastic#254922
- Closes elastic#254951

- [Integration → unit test mapping
(gist)](https://gist.github.com/kapral18/24d218baaddaa374822493dd812cfe7e)

- [x] `node scripts/check_changes.ts`
- [x] `yarn test:jest
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.edit_field.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.text_datatype.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/reference_field_selects.test.tsx`
- [x] `yarn test:jest
x-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx`

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
(cherry picked from commit a31fae8)
kapral18 added a commit to kapral18/kibana that referenced this pull request Mar 29, 2026
…stic#258942)

- Migrates flaky Index Management client integration coverage to focused
unit/section tests (mappings editor + template wizard).
- Speeds up `mappings_editor.test.tsx` by mocking UI-heavy bits and adds
compensation unit tests for `TypeParameter` and `ReferenceFieldSelects`.
- Removes legacy `__jest__/client_integration` specs/helpers for these
areas.

- Closes elastic#257682
- Closes elastic#256305
- Closes elastic#253534
- Closes elastic#239816
- Closes elastic#239817
- Closes elastic#239818
- Closes elastic#254922
- Closes elastic#254951

- [Integration → unit test mapping
(gist)](https://gist.github.com/kapral18/24d218baaddaa374822493dd812cfe7e)

- [x] `node scripts/check_changes.ts`
- [x] `yarn test:jest
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.edit_field.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.text_datatype.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/reference_field_selects.test.tsx`
- [x] `yarn test:jest
x-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx`

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
(cherry picked from commit a31fae8)
kapral18 added a commit to kapral18/kibana that referenced this pull request Mar 30, 2026
…stic#258942)

- Migrates flaky Index Management client integration coverage to focused
unit/section tests (mappings editor + template wizard).
- Speeds up `mappings_editor.test.tsx` by mocking UI-heavy bits and adds
compensation unit tests for `TypeParameter` and `ReferenceFieldSelects`.
- Removes legacy `__jest__/client_integration` specs/helpers for these
areas.

- Closes elastic#257682
- Closes elastic#256305
- Closes elastic#253534
- Closes elastic#239816
- Closes elastic#239817
- Closes elastic#239818
- Closes elastic#254922
- Closes elastic#254951

- [Integration → unit test mapping
(gist)](https://gist.github.com/kapral18/24d218baaddaa374822493dd812cfe7e)

- [x] `node scripts/check_changes.ts`
- [x] `yarn test:jest
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.edit_field.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.text_datatype.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/reference_field_selects.test.tsx`
- [x] `yarn test:jest
x-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx`

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
(cherry picked from commit a31fae8)
kapral18 added a commit to kapral18/kibana that referenced this pull request Mar 30, 2026
…stic#258942)

- Migrates flaky Index Management client integration coverage to focused
unit/section tests (mappings editor + template wizard).
- Speeds up `mappings_editor.test.tsx` by mocking UI-heavy bits and adds
compensation unit tests for `TypeParameter` and `ReferenceFieldSelects`.
- Removes legacy `__jest__/client_integration` specs/helpers for these
areas.

- Closes elastic#257682
- Closes elastic#256305
- Closes elastic#253534
- Closes elastic#239816
- Closes elastic#239817
- Closes elastic#239818
- Closes elastic#254922
- Closes elastic#254951

- [Integration → unit test mapping
(gist)](https://gist.github.com/kapral18/24d218baaddaa374822493dd812cfe7e)

- [x] `node scripts/check_changes.ts`
- [x] `yarn test:jest
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.edit_field.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.text_datatype.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/reference_field_selects.test.tsx`
- [x] `yarn test:jest
x-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx`

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
(cherry picked from commit a31fae8)
kapral18 added a commit to kapral18/kibana that referenced this pull request Mar 30, 2026
…stic#258942)

- Migrates flaky Index Management client integration coverage to focused
unit/section tests (mappings editor + template wizard).
- Speeds up `mappings_editor.test.tsx` by mocking UI-heavy bits and adds
compensation unit tests for `TypeParameter` and `ReferenceFieldSelects`.
- Removes legacy `__jest__/client_integration` specs/helpers for these
areas.

- Closes elastic#257682
- Closes elastic#256305
- Closes elastic#253534
- Closes elastic#239816
- Closes elastic#239817
- Closes elastic#239818
- Closes elastic#254922
- Closes elastic#254951

- [Integration → unit test mapping
(gist)](https://gist.github.com/kapral18/24d218baaddaa374822493dd812cfe7e)

- [x] `node scripts/check_changes.ts`
- [x] `yarn test:jest
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.edit_field.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.text_datatype.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/reference_field_selects.test.tsx`
- [x] `yarn test:jest
x-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx`

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
(cherry picked from commit a31fae8)
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 30, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.
cc: @kapral18

kapral18 added a commit that referenced this pull request Mar 31, 2026
#258942) (#260061)

# Backport

This will backport the following commits from `main` to `9.3`:
- [[Index Management] Migrate flaky integration tests to unit tests
(#258942)](#258942)

<!--- Backport version: 11.0.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Karen
Grigoryan","email":"karen.grigoryan@elastic.co"},"sourceCommit":{"committedDate":"2026-03-26T20:42:27Z","message":"[Index
Management] Migrate flaky integration tests to unit tests
(#258942)\n\n## Summary\n- Migrates flaky Index Management client
integration coverage to focused\nunit/section tests (mappings editor +
template wizard).\n- Speeds up `mappings_editor.test.tsx` by mocking
UI-heavy bits and adds\ncompensation unit tests for `TypeParameter` and
`ReferenceFieldSelects`.\n- Removes legacy `__jest__/client_integration`
specs/helpers for these\nareas.\n\n## Closes\n- Closes #257682\n- Closes
#256305\n- Closes #253534\n- Closes #239816\n- Closes #239817\n- Closes
#239818\n- Closes #254922\n- Closes #254951\n\n## Coverage mapping\n-
[Integration → unit test
mapping\n(gist)](https://gist.github.com/kapral18/24d218baaddaa374822493dd812cfe7e)\n\n##
Test plan\n- [x] `node scripts/check_changes.ts`\n- [x] `yarn
test:jest\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.edit_field.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.text_datatype.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/reference_field_selects.test.tsx`\n-
[x] `yarn
test:jest\nx-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts\nx-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx`\n\n---------\n\nCo-authored-by:
Claude Opus 4.6 (1M context)
<noreply@anthropic.com>","sha":"a31fae822fc66741614cb3bf85053306b68e37dd","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Index
Management","Team:Kibana
Management","release_note:skip","backport:version","v9.4.0","v9.3.3"],"title":"[Index
Management] Migrate flaky integration tests to unit
tests","number":258942,"url":"https://github.com/elastic/kibana/pull/258942","mergeCommit":{"message":"[Index
Management] Migrate flaky integration tests to unit tests
(#258942)\n\n## Summary\n- Migrates flaky Index Management client
integration coverage to focused\nunit/section tests (mappings editor +
template wizard).\n- Speeds up `mappings_editor.test.tsx` by mocking
UI-heavy bits and adds\ncompensation unit tests for `TypeParameter` and
`ReferenceFieldSelects`.\n- Removes legacy `__jest__/client_integration`
specs/helpers for these\nareas.\n\n## Closes\n- Closes #257682\n- Closes
#256305\n- Closes #253534\n- Closes #239816\n- Closes #239817\n- Closes
#239818\n- Closes #254922\n- Closes #254951\n\n## Coverage mapping\n-
[Integration → unit test
mapping\n(gist)](https://gist.github.com/kapral18/24d218baaddaa374822493dd812cfe7e)\n\n##
Test plan\n- [x] `node scripts/check_changes.ts`\n- [x] `yarn
test:jest\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.edit_field.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.text_datatype.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/reference_field_selects.test.tsx`\n-
[x] `yarn
test:jest\nx-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts\nx-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx`\n\n---------\n\nCo-authored-by:
Claude Opus 4.6 (1M context)
<noreply@anthropic.com>","sha":"a31fae822fc66741614cb3bf85053306b68e37dd"}},"sourceBranch":"main","suggestedTargetBranches":["9.3"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/258942","number":258942,"mergeCommit":{"message":"[Index
Management] Migrate flaky integration tests to unit tests
(#258942)\n\n## Summary\n- Migrates flaky Index Management client
integration coverage to focused\nunit/section tests (mappings editor +
template wizard).\n- Speeds up `mappings_editor.test.tsx` by mocking
UI-heavy bits and adds\ncompensation unit tests for `TypeParameter` and
`ReferenceFieldSelects`.\n- Removes legacy `__jest__/client_integration`
specs/helpers for these\nareas.\n\n## Closes\n- Closes #257682\n- Closes
#256305\n- Closes #253534\n- Closes #239816\n- Closes #239817\n- Closes
#239818\n- Closes #254922\n- Closes #254951\n\n## Coverage mapping\n-
[Integration → unit test
mapping\n(gist)](https://gist.github.com/kapral18/24d218baaddaa374822493dd812cfe7e)\n\n##
Test plan\n- [x] `node scripts/check_changes.ts`\n- [x] `yarn
test:jest\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.edit_field.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.text_datatype.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/reference_field_selects.test.tsx`\n-
[x] `yarn
test:jest\nx-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts\nx-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx\nx-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx`\n\n---------\n\nCo-authored-by:
Claude Opus 4.6 (1M context)
<noreply@anthropic.com>","sha":"a31fae822fc66741614cb3bf85053306b68e37dd"}},{"branch":"9.3","label":"v9.3.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 31, 2026
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Apr 1, 2026
…stic#258942)

## Summary
- Migrates flaky Index Management client integration coverage to focused
unit/section tests (mappings editor + template wizard).
- Speeds up `mappings_editor.test.tsx` by mocking UI-heavy bits and adds
compensation unit tests for `TypeParameter` and `ReferenceFieldSelects`.
- Removes legacy `__jest__/client_integration` specs/helpers for these
areas.

## Closes
- Closes elastic#257682
- Closes elastic#256305
- Closes elastic#253534
- Closes elastic#239816
- Closes elastic#239817
- Closes elastic#239818
- Closes elastic#254922
- Closes elastic#254951

## Coverage mapping
- [Integration → unit test mapping
(gist)](https://gist.github.com/kapral18/24d218baaddaa374822493dd812cfe7e)

## Test plan
- [x] `node scripts/check_changes.ts`
- [x] `yarn test:jest
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.edit_field.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.text_datatype.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/reference_field_selects.test.tsx`
- [x] `yarn test:jest
x-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx`

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Apr 2, 2026
…stic#258942)

## Summary
- Migrates flaky Index Management client integration coverage to focused
unit/section tests (mappings editor + template wizard).
- Speeds up `mappings_editor.test.tsx` by mocking UI-heavy bits and adds
compensation unit tests for `TypeParameter` and `ReferenceFieldSelects`.
- Removes legacy `__jest__/client_integration` specs/helpers for these
areas.

## Closes
- Closes elastic#257682
- Closes elastic#256305
- Closes elastic#253534
- Closes elastic#239816
- Closes elastic#239817
- Closes elastic#239818
- Closes elastic#254922
- Closes elastic#254951

## Coverage mapping
- [Integration → unit test mapping
(gist)](https://gist.github.com/kapral18/24d218baaddaa374822493dd812cfe7e)

## Test plan
- [x] `node scripts/check_changes.ts`
- [x] `yarn test:jest
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.edit_field.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.text_datatype.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/select_inference_id.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/reference_field_selects.test.tsx`
- [x] `yarn test:jest
x-pack/platform/plugins/shared/index_management/public/application/sections/template_clone/template_clone.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/sections/template_create/template_create.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/sections/template_edit/template_edit.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/utils/build_template_from_wizard_data.test.ts
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_components.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_logistics.test.tsx
x-pack/platform/plugins/shared/index_management/public/application/components/template_form/steps/step_review.test.tsx`

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels Feature:Index Management Index and index templates UI release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// v9.3.3 v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failing test: Jest Tests.x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor - Mappings editor datatypes other datatype allow to change a field type to a custom type Failing test: Jest Tests.x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/__jest__/client_integration - Mappings editor: edit field should update form parameters when changing the field datatype Failing test: Jest Tests.x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/__jest__/client_integration - Mappings editor: text datatype analyzer parameter: default values Failing test: Jest Tests.x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/__jest__/client_integration/datatypes - Mappings editor: text datatype analyzer parameter: default values Failing test: Jest Tests.x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_template_wizard - <TemplateCreate /> form payload & api errors should send the correct payload

4 participants