From cbbd6d83ee72933f224bccb054b1be0b0d7b5778 Mon Sep 17 00:00:00 2001 From: Julia Rechkunova Date: Wed, 4 Sep 2024 17:38:31 +0200 Subject: [PATCH] [Discover] More updates --- .../extensions/_get_cell_renderers.ts | 73 +++++++++++++------ .../extensions/_get_cell_renderers.ts | 73 +++++++++++++------ 2 files changed, 104 insertions(+), 42 deletions(-) diff --git a/test/functional/apps/discover/context_awareness/extensions/_get_cell_renderers.ts b/test/functional/apps/discover/context_awareness/extensions/_get_cell_renderers.ts index d378931a7dc7f..d290777c9008f 100644 --- a/test/functional/apps/discover/context_awareness/extensions/_get_cell_renderers.ts +++ b/test/functional/apps/discover/context_awareness/extensions/_get_cell_renderers.ts @@ -8,6 +8,7 @@ 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) { @@ -18,6 +19,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const dataViews = getService('dataViews'); const queryBar = getService('queryBar'); const browser = getService('browser'); + const retry = getService('retry'); describe('extension getCellRenderers', () => { before(async () => { @@ -42,6 +44,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.unifiedFieldList.clickFieldListItemAdd('log.level'); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.waitUntilSearchingHasFinished(); + const firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 0); const logLevelBadge = await firstCell.findByTestSubject('*logLevelBadgeCell-'); expect(await logLevelBadge.getVisibleText()).to.be('debug'); @@ -63,9 +68,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.unifiedFieldList.clickFieldListItemAdd('log.level'); - const firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 0); - expect(await firstCell.getVisibleText()).to.be('debug'); - await testSubjects.missingOrFail('*logLevelBadgeCell-'); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.waitUntilSearchingHasFinished(); + + await retry.try(async () => { + const firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 0); + expect(await firstCell.getVisibleText()).to.be('debug'); + await testSubjects.missingOrFail('*logLevelBadgeCell-'); + }); }); }); @@ -79,14 +89,23 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dataViews.switchToAndValidate('my-example-logs,logstash*'); await queryBar.setQuery('log.level:*'); await queryBar.submitQuery(); + await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.unifiedFieldList.clickFieldListItemAdd('log.level'); - let firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 1); - let logLevelBadge = await firstCell.findByTestSubject('*logLevelBadgeCell-'); - expect(await logLevelBadge.getVisibleText()).to.be('debug'); - expect(await logLevelBadge.getComputedStyle('background-color')).to.be( - 'rgba(190, 207, 227, 1)' - ); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.waitUntilSearchingHasFinished(); + + let firstCell: WebElementWrapper; + let logLevelBadge: WebElementWrapper; + + await retry.try(async () => { + firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 1); + logLevelBadge = await firstCell.findByTestSubject('*logLevelBadgeCell-'); + expect(await logLevelBadge.getVisibleText()).to.be('debug'); + expect(await logLevelBadge.getComputedStyle('background-color')).to.be( + 'rgba(190, 207, 227, 1)' + ); + }); // check Surrounding docs page await dataGrid.clickRowToggle(); @@ -96,12 +115,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await browser.refresh(); await PageObjects.header.waitUntilLoadingHasFinished(); - firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 1); - logLevelBadge = await firstCell.findByTestSubject('*logLevelBadgeCell-'); - expect(await logLevelBadge.getVisibleText()).to.be('debug'); - expect(await logLevelBadge.getComputedStyle('background-color')).to.be( - 'rgba(190, 207, 227, 1)' - ); + await retry.try(async () => { + firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 1); + logLevelBadge = await firstCell.findByTestSubject('*logLevelBadgeCell-'); + expect(await logLevelBadge.getVisibleText()).to.be('debug'); + expect(await logLevelBadge.getComputedStyle('background-color')).to.be( + 'rgba(190, 207, 227, 1)' + ); + }); }); it("should not render log.level badge cell if it's not a logs data source", async () => { @@ -113,11 +134,19 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dataViews.switchToAndValidate('my-example-*'); await queryBar.setQuery('log.level:*'); await queryBar.submitQuery(); + await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.unifiedFieldList.clickFieldListItemAdd('log.level'); - let firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 1); - expect(await firstCell.getVisibleText()).to.be('debug'); - await testSubjects.missingOrFail('*logLevelBadgeCell-'); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.waitUntilSearchingHasFinished(); + + let firstCell: WebElementWrapper; + + await retry.try(async () => { + firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 1); + expect(await firstCell.getVisibleText()).to.be('debug'); + await testSubjects.missingOrFail('*logLevelBadgeCell-'); + }); // check Surrounding docs page await dataGrid.clickRowToggle(); @@ -127,9 +156,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await browser.refresh(); await PageObjects.header.waitUntilLoadingHasFinished(); - firstCell = await dataGrid.getCellElementExcludingControlColumns(1, 1); - expect(await firstCell.getVisibleText()).to.be('debug'); - await testSubjects.missingOrFail('*logLevelBadgeCell-'); + await retry.try(async () => { + firstCell = await dataGrid.getCellElementExcludingControlColumns(1, 1); + expect(await firstCell.getVisibleText()).to.be('debug'); + await testSubjects.missingOrFail('*logLevelBadgeCell-'); + }); }); }); }); diff --git a/x-pack/test_serverless/functional/test_suites/common/discover/context_awareness/extensions/_get_cell_renderers.ts b/x-pack/test_serverless/functional/test_suites/common/discover/context_awareness/extensions/_get_cell_renderers.ts index 1259d5afa0f22..e25c833c80441 100644 --- a/x-pack/test_serverless/functional/test_suites/common/discover/context_awareness/extensions/_get_cell_renderers.ts +++ b/x-pack/test_serverless/functional/test_suites/common/discover/context_awareness/extensions/_get_cell_renderers.ts @@ -7,6 +7,7 @@ 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) { @@ -23,6 +24,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const dataViews = getService('dataViews'); const queryBar = getService('queryBar'); const browser = getService('browser'); + const retry = getService('retry'); describe('extension getCellRenderers', () => { before(async () => { @@ -48,6 +50,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.unifiedFieldList.clickFieldListItemAdd('log.level'); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.waitUntilSearchingHasFinished(); + const firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 0); const logLevelBadge = await firstCell.findByTestSubject('*logLevelBadgeCell-'); expect(await logLevelBadge.getVisibleText()).to.be('debug'); @@ -69,9 +74,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.unifiedFieldList.clickFieldListItemAdd('log.level'); - const firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 0); - expect(await firstCell.getVisibleText()).to.be('debug'); - await testSubjects.missingOrFail('*logLevelBadgeCell-'); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.waitUntilSearchingHasFinished(); + + await retry.try(async () => { + const firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 0); + expect(await firstCell.getVisibleText()).to.be('debug'); + await testSubjects.missingOrFail('*logLevelBadgeCell-'); + }); }); }); @@ -85,14 +95,23 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dataViews.switchToAndValidate('my-example-logs,logstash*'); await queryBar.setQuery('log.level:*'); await queryBar.submitQuery(); + await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.unifiedFieldList.clickFieldListItemAdd('log.level'); - let firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 1); - let logLevelBadge = await firstCell.findByTestSubject('*logLevelBadgeCell-'); - expect(await logLevelBadge.getVisibleText()).to.be('debug'); - expect(await logLevelBadge.getComputedStyle('background-color')).to.be( - 'rgba(190, 207, 227, 1)' - ); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.waitUntilSearchingHasFinished(); + + let firstCell: WebElementWrapper; + let logLevelBadge: WebElementWrapper; + + await retry.try(async () => { + firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 1); + logLevelBadge = await firstCell.findByTestSubject('*logLevelBadgeCell-'); + expect(await logLevelBadge.getVisibleText()).to.be('debug'); + expect(await logLevelBadge.getComputedStyle('background-color')).to.be( + 'rgba(190, 207, 227, 1)' + ); + }); // check Surrounding docs page await dataGrid.clickRowToggle(); @@ -102,12 +121,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await browser.refresh(); await PageObjects.header.waitUntilLoadingHasFinished(); - firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 1); - logLevelBadge = await firstCell.findByTestSubject('*logLevelBadgeCell-'); - expect(await logLevelBadge.getVisibleText()).to.be('debug'); - expect(await logLevelBadge.getComputedStyle('background-color')).to.be( - 'rgba(190, 207, 227, 1)' - ); + await retry.try(async () => { + firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 1); + logLevelBadge = await firstCell.findByTestSubject('*logLevelBadgeCell-'); + expect(await logLevelBadge.getVisibleText()).to.be('debug'); + expect(await logLevelBadge.getComputedStyle('background-color')).to.be( + 'rgba(190, 207, 227, 1)' + ); + }); }); it("should not render log.level badge cell if it's not a logs data source", async () => { @@ -119,11 +140,19 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await dataViews.switchToAndValidate('my-example-*'); await queryBar.setQuery('log.level:*'); await queryBar.submitQuery(); + await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.unifiedFieldList.clickFieldListItemAdd('log.level'); - let firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 1); - expect(await firstCell.getVisibleText()).to.be('debug'); - await testSubjects.missingOrFail('*logLevelBadgeCell-'); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.waitUntilSearchingHasFinished(); + + let firstCell: WebElementWrapper; + + await retry.try(async () => { + firstCell = await dataGrid.getCellElementExcludingControlColumns(0, 1); + expect(await firstCell.getVisibleText()).to.be('debug'); + await testSubjects.missingOrFail('*logLevelBadgeCell-'); + }); // check Surrounding docs page await dataGrid.clickRowToggle(); @@ -133,9 +162,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await browser.refresh(); await PageObjects.header.waitUntilLoadingHasFinished(); - firstCell = await dataGrid.getCellElementExcludingControlColumns(1, 1); - expect(await firstCell.getVisibleText()).to.be('debug'); - await testSubjects.missingOrFail('*logLevelBadgeCell-'); + await retry.try(async () => { + firstCell = await dataGrid.getCellElementExcludingControlColumns(1, 1); + expect(await firstCell.getVisibleText()).to.be('debug'); + await testSubjects.missingOrFail('*logLevelBadgeCell-'); + }); }); }); });