From 71260466181c253cda8cb6e91a4a77c7accafb44 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:23:37 +1100 Subject: [PATCH] [8.x] [Discover] Unskip get_render_app_wrapper test (#199456) (#200868) # Backport This will backport the following commits from `main` to `8.x`: - [[Discover] Unskip get_render_app_wrapper test (#199456)](https://github.com/elastic/kibana/pull/199456) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Julia Rechkunova --- .../extensions/_get_render_app_wrapper.ts | 35 ++++++++----- test/functional/services/data_grid.ts | 6 +++ .../extensions/_get_render_app_wrapper.ts | 50 ++++++++++++------- 3 files changed, 60 insertions(+), 31 deletions(-) diff --git a/test/functional/apps/discover/context_awareness/extensions/_get_render_app_wrapper.ts b/test/functional/apps/discover/context_awareness/extensions/_get_render_app_wrapper.ts index b30d16c215044..b22d54ffe51c5 100644 --- a/test/functional/apps/discover/context_awareness/extensions/_get_render_app_wrapper.ts +++ b/test/functional/apps/discover/context_awareness/extensions/_get_render_app_wrapper.ts @@ -9,15 +9,17 @@ import kbnRison from '@kbn/rison'; import expect from '@kbn/expect'; +import type { WebElementWrapper } from '@kbn/ftr-common-functional-ui-services'; import type { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { - const { common, discover, header, unifiedFieldList, dashboard } = getPageObjects([ + const { common, discover, header, unifiedFieldList, dashboard, context } = getPageObjects([ 'common', 'discover', 'header', 'unifiedFieldList', 'dashboard', + 'context', ]); const testSubjects = getService('testSubjects'); const dataViews = getService('dataViews'); @@ -41,17 +43,21 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await common.navigateToActualUrl('discover', `?_a=${state}`, { ensureCurrentUrl: false, }); + await header.waitUntilLoadingHasFinished(); await discover.waitUntilSearchingHasFinished(); await unifiedFieldList.clickFieldListItemAdd('message'); - let messageCell = await dataGrid.getCellElementExcludingControlColumns(0, 2); + await header.waitUntilLoadingHasFinished(); + await discover.waitUntilSearchingHasFinished(); + let messageCell: WebElementWrapper; await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(0, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); }); let message = await testSubjects.find('exampleRootProfileCurrentMessage'); expect(await message.getVisibleText()).to.be('This is a debug log'); - messageCell = await dataGrid.getCellElementExcludingControlColumns(1, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(1, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); message = await testSubjects.find('exampleRootProfileCurrentMessage'); @@ -69,15 +75,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await header.waitUntilLoadingHasFinished(); await dashboard.waitForRenderComplete(); - messageCell = await dataGrid.getCellElementExcludingControlColumns(0, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(0, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); }); message = await testSubjects.find('exampleRootProfileCurrentMessage'); expect(await message.getVisibleText()).to.be('This is a debug log'); - messageCell = await dataGrid.getCellElementExcludingControlColumns(1, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(1, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); message = await testSubjects.find('exampleRootProfileCurrentMessage'); @@ -93,18 +99,22 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await common.navigateToActualUrl('discover', undefined, { ensureCurrentUrl: false, }); - await dataViews.switchTo('my-example-logs'); + await dataViews.switchToAndValidate('my-example-logs'); + await header.waitUntilLoadingHasFinished(); await discover.waitUntilSearchingHasFinished(); await unifiedFieldList.clickFieldListItemAdd('message'); - let messageCell = await dataGrid.getCellElementExcludingControlColumns(0, 2); + await header.waitUntilLoadingHasFinished(); + await discover.waitUntilSearchingHasFinished(); + let messageCell: WebElementWrapper; await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(0, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); }); let message = await testSubjects.find('exampleRootProfileCurrentMessage'); expect(await message.getVisibleText()).to.be('This is a debug log'); - messageCell = await dataGrid.getCellElementExcludingControlColumns(1, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(1, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); message = await testSubjects.find('exampleRootProfileCurrentMessage'); @@ -120,16 +130,17 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await header.waitUntilLoadingHasFinished(); await browser.refresh(); await header.waitUntilLoadingHasFinished(); + await context.waitUntilContextLoadingHasFinished(); - messageCell = await dataGrid.getCellElementExcludingControlColumns(0, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(0, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); }); message = await testSubjects.find('exampleRootProfileCurrentMessage'); expect(await message.getVisibleText()).to.be('This is a debug log'); - messageCell = await dataGrid.getCellElementExcludingControlColumns(1, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(1, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); message = await testSubjects.find('exampleRootProfileCurrentMessage'); @@ -149,15 +160,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await header.waitUntilLoadingHasFinished(); await dashboard.waitForRenderComplete(); - messageCell = await dataGrid.getCellElementExcludingControlColumns(0, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(0, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); }); message = await testSubjects.find('exampleRootProfileCurrentMessage'); expect(await message.getVisibleText()).to.be('This is a debug log'); - messageCell = await dataGrid.getCellElementExcludingControlColumns(1, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(1, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); message = await testSubjects.find('exampleRootProfileCurrentMessage'); diff --git a/test/functional/services/data_grid.ts b/test/functional/services/data_grid.ts index f56b58cfa88f1..36e5285a529b8 100644 --- a/test/functional/services/data_grid.ts +++ b/test/functional/services/data_grid.ts @@ -166,6 +166,12 @@ export class DataGridService extends FtrService { ); } + public async getCellElementByColumnName(rowIndex: number, columnName: string) { + return await this.find.byCssSelector( + `[data-test-subj="euiDataGridBody"] [data-test-subj="dataGridRowCell"][data-gridcell-column-id="${columnName}"][data-gridcell-visible-row-index="${rowIndex}"]` + ); + } + private async getCellActionButton( rowIndex: number = 0, columnIndex: number = 0, diff --git a/x-pack/test_serverless/functional/test_suites/common/discover/context_awareness/extensions/_get_render_app_wrapper.ts b/x-pack/test_serverless/functional/test_suites/common/discover/context_awareness/extensions/_get_render_app_wrapper.ts index a2a1d4d9156ae..3506f132f9026 100644 --- a/x-pack/test_serverless/functional/test_suites/common/discover/context_awareness/extensions/_get_render_app_wrapper.ts +++ b/x-pack/test_serverless/functional/test_suites/common/discover/context_awareness/extensions/_get_render_app_wrapper.ts @@ -7,17 +7,20 @@ import kbnRison from '@kbn/rison'; import expect from '@kbn/expect'; +import type { WebElementWrapper } from '@kbn/ftr-common-functional-ui-services'; import type { FtrProviderContext } from '../../../../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { - const { common, discover, header, unifiedFieldList, dashboard, svlCommonPage } = getPageObjects([ - 'common', - 'discover', - 'header', - 'unifiedFieldList', - 'dashboard', - 'svlCommonPage', - ]); + const { common, discover, header, unifiedFieldList, dashboard, context, svlCommonPage } = + getPageObjects([ + 'common', + 'discover', + 'header', + 'unifiedFieldList', + 'dashboard', + 'context', + 'svlCommonPage', + ]); const testSubjects = getService('testSubjects'); const dataViews = getService('dataViews'); const dataGrid = getService('dataGrid'); @@ -44,17 +47,21 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await common.navigateToActualUrl('discover', `?_a=${state}`, { ensureCurrentUrl: false, }); + await header.waitUntilLoadingHasFinished(); await discover.waitUntilSearchingHasFinished(); await unifiedFieldList.clickFieldListItemAdd('message'); - let messageCell = await dataGrid.getCellElementExcludingControlColumns(0, 2); + await header.waitUntilLoadingHasFinished(); + await discover.waitUntilSearchingHasFinished(); + let messageCell: WebElementWrapper; await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(0, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); }); let message = await testSubjects.find('exampleRootProfileCurrentMessage'); expect(await message.getVisibleText()).to.be('This is a debug log'); - messageCell = await dataGrid.getCellElementExcludingControlColumns(1, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(1, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); message = await testSubjects.find('exampleRootProfileCurrentMessage'); @@ -72,15 +79,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await header.waitUntilLoadingHasFinished(); await dashboard.waitForRenderComplete(); - messageCell = await dataGrid.getCellElementExcludingControlColumns(0, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(0, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); }); message = await testSubjects.find('exampleRootProfileCurrentMessage'); expect(await message.getVisibleText()).to.be('This is a debug log'); - messageCell = await dataGrid.getCellElementExcludingControlColumns(1, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(1, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); message = await testSubjects.find('exampleRootProfileCurrentMessage'); @@ -96,18 +103,22 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await common.navigateToActualUrl('discover', undefined, { ensureCurrentUrl: false, }); - await dataViews.switchTo('my-example-logs'); + await dataViews.switchToAndValidate('my-example-logs'); + await header.waitUntilLoadingHasFinished(); await discover.waitUntilSearchingHasFinished(); await unifiedFieldList.clickFieldListItemAdd('message'); - let messageCell = await dataGrid.getCellElementExcludingControlColumns(0, 2); + await header.waitUntilLoadingHasFinished(); + await discover.waitUntilSearchingHasFinished(); + let messageCell: WebElementWrapper; await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(0, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); }); let message = await testSubjects.find('exampleRootProfileCurrentMessage'); expect(await message.getVisibleText()).to.be('This is a debug log'); - messageCell = await dataGrid.getCellElementExcludingControlColumns(1, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(1, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); message = await testSubjects.find('exampleRootProfileCurrentMessage'); @@ -123,16 +134,17 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await header.waitUntilLoadingHasFinished(); await browser.refresh(); await header.waitUntilLoadingHasFinished(); + await context.waitUntilContextLoadingHasFinished(); - messageCell = await dataGrid.getCellElementExcludingControlColumns(0, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(0, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); }); message = await testSubjects.find('exampleRootProfileCurrentMessage'); expect(await message.getVisibleText()).to.be('This is a debug log'); - messageCell = await dataGrid.getCellElementExcludingControlColumns(1, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(1, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); message = await testSubjects.find('exampleRootProfileCurrentMessage'); @@ -152,15 +164,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await header.waitUntilLoadingHasFinished(); await dashboard.waitForRenderComplete(); - messageCell = await dataGrid.getCellElementExcludingControlColumns(0, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(0, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); }); message = await testSubjects.find('exampleRootProfileCurrentMessage'); expect(await message.getVisibleText()).to.be('This is a debug log'); - messageCell = await dataGrid.getCellElementExcludingControlColumns(1, 2); await retry.try(async () => { + messageCell = await dataGrid.getCellElementByColumnName(1, 'message'); await (await messageCell.findByTestSubject('exampleDataSourceProfileMessage')).click(); await testSubjects.existOrFail('exampleRootProfileFlyout'); message = await testSubjects.find('exampleRootProfileCurrentMessage');