Skip to content

Commit 8e172a7

Browse files
kapral18mattkime
andauthored
[9.2] [index management] Move tests from FTR to scout (#242825) (#245141)
# Backport This will backport the following commits from `main` to `9.2`: - [[index management] Move tests from FTR to scout (#242825)](#242825) <!--- Backport version: 10.2.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Matthew Kime","email":"matt@mattki.me"},"sourceCommit":{"committedDate":"2025-12-03T07:31:36Z","message":"[index management] Move tests from FTR to scout (#242825)\n\n## Summary\n\nMoving index management tests from FTR to scout. Scout hates it when the\ndata-test-subj value has been used more than once so there are some\nchanges to address that.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>","sha":"74233253898ba714584572dceabb404738047e4e","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Index Management","Team:Kibana Management","release_note:skip","backport:all-open","v9.3.0"],"title":"[index management] Move tests from FTR to scout","number":242825,"url":"https://github.com/elastic/kibana/pull/242825","mergeCommit":{"message":"[index management] Move tests from FTR to scout (#242825)\n\n## Summary\n\nMoving index management tests from FTR to scout. Scout hates it when the\ndata-test-subj value has been used more than once so there are some\nchanges to address that.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>","sha":"74233253898ba714584572dceabb404738047e4e"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/242825","number":242825,"mergeCommit":{"message":"[index management] Move tests from FTR to scout (#242825)\n\n## Summary\n\nMoving index management tests from FTR to scout. Scout hates it when the\ndata-test-subj value has been used more than once so there are some\nchanges to address that.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>","sha":"74233253898ba714584572dceabb404738047e4e"}}]}] BACKPORT--> Co-authored-by: Matthew Kime <matt@mattki.me>
1 parent aa1506e commit 8e172a7

28 files changed

Lines changed: 768 additions & 546 deletions

File tree

.buildkite/scout_ci_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins:
44
- apm
55
- console
66
- discover_enhanced
7+
- index_management
78
- maps
89
- observability
910
- observability_onboarding

x-pack/platform/plugins/shared/index_management/__jest__/client_integration/helpers/test_subjects.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,10 @@ export type TestSubjects =
118118
| 'noIndicesMessage'
119119
| 'clearIndicesSearch'
120120
| 'usingMaxRetention'
121-
| 'componentTemplatesLink';
121+
| 'componentTemplatesLink'
122+
| 'summaryTabBtn'
123+
| 'settingsTabBtn'
124+
| 'mappingsTabBtn'
125+
| 'aliasesTabBtn'
126+
| 'previewTabBtn'
127+
| 'configureFailureStoreButton';

x-pack/platform/plugins/shared/index_management/__jest__/client_integration/home/index_templates_tab.helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ const createActions = (testBed: TestBed<TestSubjects>) => {
4040
const selectDetailsTab = async (
4141
tab: 'summary' | 'settings' | 'mappings' | 'aliases' | 'preview'
4242
) => {
43-
const tabs = ['summary', 'settings', 'mappings', 'aliases', 'preview'];
43+
const tabTestDataSubj = `${tab}TabBtn` as TestSubjects;
4444

4545
await act(async () => {
46-
testBed.find('templateDetails.tab').at(tabs.indexOf(tab)).simulate('click');
46+
testBed.find(tabTestDataSubj).simulate('click');
4747
});
4848
testBed.component.update();
4949
};

x-pack/platform/plugins/shared/index_management/__jest__/client_integration/home/index_templates_tab.test.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -624,14 +624,11 @@ describe('Index Templates tab', () => {
624624

625625
await actions.clickTemplateAt(0);
626626

627-
expect(find('templateDetails.tab').length).toBe(5);
628-
expect(find('templateDetails.tab').map((t) => t.text())).toEqual([
629-
'Summary',
630-
'Settings',
631-
'Mappings',
632-
'Aliases',
633-
'Preview',
634-
]);
627+
expect(exists('summaryTabBtn')).toBe(true);
628+
expect(exists('settingsTabBtn')).toBe(true);
629+
expect(exists('mappingsTabBtn')).toBe(true);
630+
expect(exists('aliasesTabBtn')).toBe(true);
631+
expect(exists('previewTabBtn')).toBe(true);
635632

636633
// Summary tab should be initial active tab
637634
expect(exists('summaryTab')).toBe(true);
@@ -671,15 +668,14 @@ describe('Index Templates tab', () => {
671668
isLegacy: true,
672669
});
673670

674-
const { actions, find, exists } = testBed;
671+
const { actions, exists } = testBed;
675672

676673
httpRequestsMockHelpers.setLoadTemplateResponse(
677674
templates[0].name,
678675
templateWithNoOptionalFields
679676
);
680677
await actions.clickTemplateAt(0);
681678

682-
expect(find('templateDetails.tab').length).toBe(5);
683679
expect(exists('summaryTab')).toBe(true);
684680

685681
// Navigate and verify callout message per tab

x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_template_wizard/template_create.test.tsx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -390,21 +390,14 @@ describe('<TemplateCreate />', () => {
390390
});
391391

392392
describe('plugin parameters', () => {
393-
const selectMappingsEditorTab = async (
394-
tab: 'fields' | 'runtimeFields' | 'templates' | 'advanced'
395-
) => {
396-
const tabIndex = ['fields', 'runtimeFields', 'templates', 'advanced'].indexOf(tab);
397-
const tabElement = testBed.find('mappingsEditor.formTab').at(tabIndex);
398-
await act(async () => {
399-
tabElement.simulate('click');
400-
});
401-
testBed.component.update();
402-
};
403-
404393
test('should not render the _size parameter if the mapper size plugin is not installed', async () => {
405394
const { exists } = testBed;
406395
// Navigate to the advanced configuration
407-
await selectMappingsEditorTab('advanced');
396+
397+
await act(async () => {
398+
testBed.find('advancedOptionsTab').simulate('click');
399+
});
400+
testBed.component.update();
408401

409402
expect(exists('mappingsEditor.advancedConfiguration.sizeEnabledToggle')).toBe(false);
410403
});
@@ -418,7 +411,10 @@ describe('<TemplateCreate />', () => {
418411
testBed.component.update();
419412
await navigateToMappingsStep();
420413

421-
await selectMappingsEditorTab('advanced');
414+
await act(async () => {
415+
testBed.find('advancedOptionsTab').simulate('click');
416+
});
417+
testBed.component.update();
422418

423419
expect(testBed.exists('mappingsEditor.advancedConfiguration.sizeEnabledToggle')).toBe(
424420
true

x-pack/platform/plugins/shared/index_management/__jest__/client_integration/index_template_wizard/template_form.helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,6 @@ export type TestSubjects =
402402
| 'valueDataRetentionField'
403403
| 'formWizardStep-5'
404404
| 'lifecycleValue'
405-
| 'mappingsEditor.formTab'
406405
| 'mappingsEditor.advancedConfiguration.sizeEnabledToggle'
407-
| 'previewIndexTemplate';
406+
| 'previewIndexTemplate'
407+
| 'advancedOptionsTab';

x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,9 @@ const createActions = (testBed: TestBed<TestSubjects>) => {
314314
// --- Other ---
315315
const selectTab = async (tab: 'fields' | 'runtimeFields' | 'templates' | 'advanced') => {
316316
const index = ['fields', 'runtimeFields', 'templates', 'advanced'].indexOf(tab);
317+
const dataTestSubjValues = ['fieldsTab', 'runtimeTab', 'templatesTab', 'advancedOptionsTab'];
317318

318-
const tabElement = find('formTab').at(index);
319+
const tabElement = find(dataTestSubjValues[index]);
319320
if (tabElement.length === 0) {
320321
throw new Error(`Tab not found: "${tab}"`);
321322
}

x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,10 @@ describe('Mappings editor: core', () => {
166166

167167
test('should have 4 tabs (fields, runtime, template, advanced settings)', () => {
168168
const { find } = testBed;
169-
const tabs = find('formTab').map((wrapper) => wrapper.text());
170-
171-
expect(tabs).toEqual([
172-
'Mapped fields',
173-
'Runtime fields',
174-
'Dynamic templates',
169+
expect(find('fieldsTab').map((wrapper) => wrapper.text())).toEqual(['Mapped fields']);
170+
expect(find('runtimeTab').map((wrapper) => wrapper.text())).toEqual(['Runtime fields']);
171+
expect(find('templatesTab').map((wrapper) => wrapper.text())).toEqual(['Dynamic templates']);
172+
expect(find('advancedOptionsTab').map((wrapper) => wrapper.text())).toEqual([
175173
'Advanced options',
176174
]);
177175
});

x-pack/platform/plugins/shared/index_management/public/application/components/mappings_editor/mappings_editor.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export const MappingsEditor = React.memo(
184184
<EuiTab
185185
onClick={() => changeTab('fields')}
186186
isSelected={selectedTab === 'fields'}
187-
data-test-subj="formTab"
187+
data-test-subj="fieldsTab"
188188
>
189189
{i18n.translate('xpack.idxMgmt.mappingsEditor.fieldsTabLabel', {
190190
defaultMessage: 'Mapped fields',
@@ -193,7 +193,7 @@ export const MappingsEditor = React.memo(
193193
<EuiTab
194194
onClick={() => changeTab('runtimeFields')}
195195
isSelected={selectedTab === 'runtimeFields'}
196-
data-test-subj="formTab"
196+
data-test-subj="runtimeTab"
197197
>
198198
{i18n.translate('xpack.idxMgmt.mappingsEditor.runtimeFieldsTabLabel', {
199199
defaultMessage: 'Runtime fields',
@@ -202,7 +202,7 @@ export const MappingsEditor = React.memo(
202202
<EuiTab
203203
onClick={() => changeTab('templates')}
204204
isSelected={selectedTab === 'templates'}
205-
data-test-subj="formTab"
205+
data-test-subj="templatesTab"
206206
>
207207
{i18n.translate('xpack.idxMgmt.mappingsEditor.templatesTabLabel', {
208208
defaultMessage: 'Dynamic templates',
@@ -211,7 +211,7 @@ export const MappingsEditor = React.memo(
211211
<EuiTab
212212
onClick={() => changeTab('advanced')}
213213
isSelected={selectedTab === 'advanced'}
214-
data-test-subj="formTab"
214+
data-test-subj="advancedOptionsTab"
215215
>
216216
{i18n.translate('xpack.idxMgmt.mappingsEditor.advancedTabLabel', {
217217
defaultMessage: 'Advanced options',

x-pack/platform/plugins/shared/index_management/public/application/components/no_match/no_match.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ export const NoMatch = ({
9494
/>
9595
</p>
9696
}
97-
actions={<CreateIndexButton loadIndices={loadIndices} share={share} />}
97+
actions={
98+
<CreateIndexButton
99+
loadIndices={loadIndices}
100+
share={share}
101+
dataTestSubj="createIndexButtonEmptyList"
102+
/>
103+
}
98104
/>
99105
);
100106
};

0 commit comments

Comments
 (0)