Skip to content

Commit

Permalink
Fix indexManagement ftr tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yansavitski committed Jan 6, 2025
1 parent 735e3b5 commit a6f3b8f
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 27 deletions.
2 changes: 2 additions & 0 deletions x-pack/test/accessibility/apps/group1/management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
'header',
'indexPatternFieldEditorObjects',
'indexManagement',
'searchIndexDetail',
]);
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
Expand Down Expand Up @@ -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();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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();
});
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
'remoteClusters',
'indexManagement',
'crossClusterReplication',
'searchIndexDetail',
]);
const security = getService('security');
const retry = getService('retry');
Expand Down Expand Up @@ -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');
Expand Down
5 changes: 1 addition & 4 deletions x-pack/test/functional/page_objects/index_management_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ export function IndexManagementPageProvider({ getService }: FtrProviderContext)
async clickIndexAt(indexOfRow: number): Promise<void> {
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) {
Expand Down Expand Up @@ -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() {
Expand Down
29 changes: 19 additions & 10 deletions x-pack/test/functional/page_objects/search_index_detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`;
Expand All @@ -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();
});
});
});
Expand Down

0 comments on commit a6f3b8f

Please sign in to comment.