From a6f3b8fc5029a0499a88c1349d0a472f7ea612df Mon Sep 17 00:00:00 2001 From: Yan Savitski Date: Mon, 6 Jan 2025 14:51:14 +0100 Subject: [PATCH] Fix indexManagement ftr tests --- .../accessibility/apps/group1/management.ts | 2 ++ .../index_management/index_details_page.ts | 6 ++-- .../remote_clusters_index_management_flow.ts | 4 +-- .../page_objects/index_management_page.ts | 5 +--- .../page_objects/search_index_detail.ts | 29 ++++++++++++------- .../index_management/index_detail.ts | 21 +++++++++----- 6 files changed, 40 insertions(+), 27 deletions(-) diff --git a/x-pack/test/accessibility/apps/group1/management.ts b/x-pack/test/accessibility/apps/group1/management.ts index 0a11e649c29ac..11e27ca1655ea 100644 --- a/x-pack/test/accessibility/apps/group1/management.ts +++ b/x-pack/test/accessibility/apps/group1/management.ts @@ -14,6 +14,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { 'header', 'indexPatternFieldEditorObjects', 'indexManagement', + 'searchIndexDetail', ]); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); @@ -52,6 +53,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('index details - overview', async () => { await PageObjects.settings.clickIndexManagement(); await PageObjects.indexManagement.clickIndexAt(0); + await PageObjects.searchIndexDetail.expectIndexDetailsPageIsLoaded(); await a11y.testAppSnapshot(); }); diff --git a/x-pack/test/functional/apps/index_management/index_details_page.ts b/x-pack/test/functional/apps/index_management/index_details_page.ts index 454210ef9ab76..587872a777507 100644 --- a/x-pack/test/functional/apps/index_management/index_details_page.ts +++ b/x-pack/test/functional/apps/index_management/index_details_page.ts @@ -8,7 +8,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default ({ getPageObjects, getService }: FtrProviderContext) => { - const pageObjects = getPageObjects(['common', 'indexManagement', 'header']); + const pageObjects = getPageObjects(['common', 'indexManagement', 'header', 'searchIndexDetail']); const log = getService('log'); const security = getService('security'); @@ -24,8 +24,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { // display hidden indices to have some rows in the indices table await pageObjects.indexManagement.toggleHiddenIndices(); // click the first index in the table and wait for the index details page - await pageObjects.indexManagement.indexDetailsPage.openIndexDetailsPage(0); - await pageObjects.indexManagement.indexDetailsPage.expectIndexDetailsPageIsLoaded(); + await pageObjects.searchIndexDetail.openIndicesDetailFromIndexManagementIndicesListTable(0); + await pageObjects.searchIndexDetail.expectIndexDetailsPageIsLoaded(); }); }); }; diff --git a/x-pack/test/functional/apps/remote_clusters/ccs/remote_clusters_index_management_flow.ts b/x-pack/test/functional/apps/remote_clusters/ccs/remote_clusters_index_management_flow.ts index 4f710b3730353..5666fd540fe99 100644 --- a/x-pack/test/functional/apps/remote_clusters/ccs/remote_clusters_index_management_flow.ts +++ b/x-pack/test/functional/apps/remote_clusters/ccs/remote_clusters_index_management_flow.ts @@ -14,6 +14,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { 'remoteClusters', 'indexManagement', 'crossClusterReplication', + 'searchIndexDetail', ]); const security = getService('security'); const retry = getService('retry'); @@ -88,8 +89,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); it('Verify that the follower index is duplicating from the remote.', async () => { await pageObjects.indexManagement.clickIndexAt(0); - await pageObjects.indexManagement.performIndexAction('flush'); - await testSubjects.click('indexDetailsBackToIndicesButton'); + await pageObjects.searchIndexDetail.expectIndexDetailsPageIsLoaded(); await pageObjects.common.navigateToApp('indexManagement'); await retry.waitForWithTimeout('indices table to be visible', 15000, async () => { return await testSubjects.isDisplayed('indicesList'); diff --git a/x-pack/test/functional/page_objects/index_management_page.ts b/x-pack/test/functional/page_objects/index_management_page.ts index aa95a2e5492d3..02c4d7a1d9ffa 100644 --- a/x-pack/test/functional/page_objects/index_management_page.ts +++ b/x-pack/test/functional/page_objects/index_management_page.ts @@ -82,9 +82,6 @@ export function IndexManagementPageProvider({ getService }: FtrProviderContext) async clickIndexAt(indexOfRow: number): Promise { const indexList = await testSubjects.findAll('indexTableIndexNameLink'); await indexList[indexOfRow].click(); - await retry.waitFor('details page title to show up', async () => { - return (await testSubjects.isDisplayed('searchIndexDetailsHeader')) === true; - }); }, async performIndexAction(action: string) { @@ -162,7 +159,7 @@ export function IndexManagementPageProvider({ getService }: FtrProviderContext) const indexList = await testSubjects.findAll('indexTableIndexNameLink'); await indexList[indexOfRow].click(); await retry.waitFor('index details page title to show up', async () => { - return (await testSubjects.isDisplayed('searchIndexDetailsHeader')) === true; + return (await testSubjects.isDisplayed('indexDetailsHeader')) === true; }); }, async expectIndexDetailsPageIsLoaded() { diff --git a/x-pack/test/functional/page_objects/search_index_detail.ts b/x-pack/test/functional/page_objects/search_index_detail.ts index 7440ee1c94c41..5a2c7d012fd8d 100644 --- a/x-pack/test/functional/page_objects/search_index_detail.ts +++ b/x-pack/test/functional/page_objects/search_index_detail.ts @@ -13,12 +13,26 @@ export function SearchIndexDetailProvider({ getService }: FtrProviderContext) { const browser = getService('browser'); const retry = getService('retry'); + const expectIndexDetailPageHeader = async function () { + await testSubjects.existOrFail('searchIndexDetailsHeader', { timeout: 2000 }); + }; + const expectSearchIndexDetailsTabsExists = async function () { + await testSubjects.existOrFail('dataTab'); + await testSubjects.existOrFail('mappingsTab'); + await testSubjects.existOrFail('settingsTab'); + }; + const expectAPIReferenceDocLinkExists = async function () { + await testSubjects.existOrFail('ApiReferenceDoc', { timeout: 2000 }); + }; + return { - async expectIndexDetailPageHeader() { - await testSubjects.existOrFail('searchIndexDetailsHeader', { timeout: 2000 }); - }, - async expectAPIReferenceDocLinkExists() { - await testSubjects.existOrFail('ApiReferenceDoc', { timeout: 2000 }); + expectIndexDetailPageHeader, + expectSearchIndexDetailsTabsExists, + expectAPIReferenceDocLinkExists, + async expectIndexDetailsPageIsLoaded() { + await expectIndexDetailPageHeader(); + await expectSearchIndexDetailsTabsExists(); + await expectAPIReferenceDocLinkExists(); }, async expectActionItemReplacedWhenHasDocs() { await testSubjects.missingOrFail('ApiReferenceDoc', { timeout: 2000 }); @@ -270,11 +284,6 @@ export function SearchIndexDetailProvider({ getService }: FtrProviderContext) { return (await testSubjects.isDisplayed('searchIndexDetailsHeader')) === true; }); }, - async expectSearchIndexDetailsTabsExists() { - await testSubjects.existOrFail('dataTab'); - await testSubjects.existOrFail('mappingsTab'); - await testSubjects.existOrFail('settingsTab'); - }, async expectBreadcrumbNavigationWithIndexName(indexName: string) { await testSubjects.existOrFail('euiBreadcrumb'); diff --git a/x-pack/test_serverless/functional/test_suites/common/management/index_management/index_detail.ts b/x-pack/test_serverless/functional/test_suites/common/management/index_management/index_detail.ts index 7330a5d162240..9846d0c97b701 100644 --- a/x-pack/test_serverless/functional/test_suites/common/management/index_management/index_detail.ts +++ b/x-pack/test_serverless/functional/test_suites/common/management/index_management/index_detail.ts @@ -9,7 +9,13 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../../ftr_provider_context'; export default ({ getPageObjects, getService }: FtrProviderContext) => { - const pageObjects = getPageObjects(['svlCommonPage', 'common', 'indexManagement', 'header']); + const pageObjects = getPageObjects([ + 'svlCommonPage', + 'common', + 'indexManagement', + 'header', + 'searchIndexDetail', + ]); const browser = getService('browser'); const security = getService('security'); const testIndexName = `index-ftr-test-${Math.random()}`; @@ -36,17 +42,16 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); describe('can view index details', function () { it('index with no documents', async () => { - await pageObjects.indexManagement.indexDetailsPage.openIndexDetailsPage(0); - await pageObjects.indexManagement.indexDetailsPage.expectIndexDetailsPageIsLoaded(); - await pageObjects.indexManagement.indexDetailsPage.expectTabsExists(); + await pageObjects.searchIndexDetail.openIndicesDetailFromIndexManagementIndicesListTable(0); + await pageObjects.searchIndexDetail.expectIndexDetailsPageIsLoaded(); }); it('can add mappings', async () => { - await pageObjects.indexManagement.indexDetailsPage.changeTab('indexDetailsTab-mappings'); - await pageObjects.indexManagement.indexDetailsPage.expectIndexDetailsMappingsAddFieldToBeEnabled(); + await pageObjects.searchIndexDetail.changeTab('mappingsTab'); + await pageObjects.searchIndexDetail.expectAddFieldToBeEnabled(); }); it('can edit settings', async () => { - await pageObjects.indexManagement.indexDetailsPage.changeTab('indexDetailsTab-settings'); - await pageObjects.indexManagement.indexDetailsPage.expectEditSettingsToBeEnabled(); + await pageObjects.searchIndexDetail.changeTab('settingsTab'); + await pageObjects.searchIndexDetail.expectEditSettingsToBeEnabled(); }); }); });