From 07e7e3d4d036d30b6f6bb7aa9f95916e11b7980e Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 22 Nov 2024 04:12:53 +1100 Subject: [PATCH] [8.17] [Discover] Unskip ES|QL switch modal tests and fix other flaky tests in the same suite (#200923) (#201112) # Backport This will backport the following commits from `main` to `8.17`: - [[Discover] Unskip ES|QL switch modal tests and fix other flaky tests in the same suite (#200923)](https://github.com/elastic/kibana/pull/200923) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Julia Rechkunova Co-authored-by: Brad White --- .../functional/apps/discover/esql/_esql_view.ts | 17 ++++++++++++++--- .../page_objects/unified_field_list.ts | 3 +-- .../functional/apps/discover/visualize_field.ts | 11 ++++++++--- .../common/discover/esql/_esql_view.ts | 15 ++++++++++++--- .../common/discover/x_pack/visualize_field.ts | 6 +++++- 5 files changed, 40 insertions(+), 12 deletions(-) diff --git a/test/functional/apps/discover/esql/_esql_view.ts b/test/functional/apps/discover/esql/_esql_view.ts index 93b76aff14312..9d00928cbe7ea 100644 --- a/test/functional/apps/discover/esql/_esql_view.ts +++ b/test/functional/apps/discover/esql/_esql_view.ts @@ -143,9 +143,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should perform test query correctly', async function () { await timePicker.setDefaultAbsoluteRange(); + await header.waitUntilLoadingHasFinished(); + await discover.waitUntilSearchingHasFinished(); await discover.selectTextBaseLang(); - const testQuery = `from logstash-* | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`; + await header.waitUntilLoadingHasFinished(); + await discover.waitUntilSearchingHasFinished(); + const testQuery = `from logstash-* | sort @timestamp | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`; await monacoEditor.setCodeEditorValue(testQuery); await testSubjects.click('querySubmitButton'); await header.waitUntilLoadingHasFinished(); @@ -159,7 +163,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should render when switching to a time range with no data, then back to a time range with data', async () => { await discover.selectTextBaseLang(); - const testQuery = `from logstash-* | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`; + await header.waitUntilLoadingHasFinished(); + await discover.waitUntilSearchingHasFinished(); + + const testQuery = `from logstash-* | sort @timestamp | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`; await monacoEditor.setCodeEditorValue(testQuery); await testSubjects.click('querySubmitButton'); await header.waitUntilLoadingHasFinished(); @@ -182,8 +189,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should query an index pattern that doesnt translate to a dataview correctly', async function () { await discover.selectTextBaseLang(); - const testQuery = `from logstash* | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`; + await header.waitUntilLoadingHasFinished(); + await discover.waitUntilSearchingHasFinished(); + const testQuery = `from logstash* | sort @timestamp | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`; await monacoEditor.setCodeEditorValue(testQuery); await testSubjects.click('querySubmitButton'); await header.waitUntilLoadingHasFinished(); @@ -297,6 +306,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await header.waitUntilLoadingHasFinished(); await discover.waitUntilSearchingHasFinished(); await discover.saveSearch('esql_test2'); + await header.waitUntilLoadingHasFinished(); + await discover.waitUntilSearchingHasFinished(); const testQuery = 'from logstash-* | limit 100 | drop @timestamp'; await monacoEditor.setCodeEditorValue(testQuery); await testSubjects.click('querySubmitButton'); diff --git a/test/functional/page_objects/unified_field_list.ts b/test/functional/page_objects/unified_field_list.ts index 4751769f717bd..6a5f16a2cac30 100644 --- a/test/functional/page_objects/unified_field_list.ts +++ b/test/functional/page_objects/unified_field_list.ts @@ -204,10 +204,9 @@ export class UnifiedFieldListPageObject extends FtrService { if (!isActive) { // expand the field to show the "Visualize" button - await field.click(); + await this.clickFieldListItem(fieldName); } - await this.waitUntilFieldPopoverIsOpen(); const visualizeButtonTestSubject = `fieldVisualize-${fieldName}`; // wrap visualize button click in retry to ensure button is clicked and retry if button click is not registered await this.retry.try(async () => { diff --git a/x-pack/test/functional/apps/discover/visualize_field.ts b/x-pack/test/functional/apps/discover/visualize_field.ts index 0ee6a996652be..3d8bdc9c7d781 100644 --- a/x-pack/test/functional/apps/discover/visualize_field.ts +++ b/x-pack/test/functional/apps/discover/visualize_field.ts @@ -51,14 +51,19 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('discover field visualize button', () => { before(async () => { await kibanaServer.uiSettings.replace(defaultSettings); - }); - beforeEach(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); await kibanaServer.importExport.load( 'x-pack/test/functional/fixtures/kbn_archiver/lens/lens_basic.json' ); + }); + + beforeEach(async () => { await common.navigateToApp('discover'); + await header.waitUntilLoadingHasFinished(); + await discover.waitUntilSearchingHasFinished(); await setDiscoverTimeRange(); + await header.waitUntilLoadingHasFinished(); + await discover.waitUntilSearchingHasFinished(); }); after(async () => { @@ -73,7 +78,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await unifiedFieldList.expectFieldListItemVisualize('bytes'); }); - it('visualizes field to Lens and loads fields to the dimesion editor', async () => { + it('visualizes field to Lens and loads fields to the dimension editor', async () => { await unifiedFieldList.findFieldByName('bytes'); await unifiedFieldList.clickFieldListItemVisualize('bytes'); await header.waitUntilLoadingHasFinished(); diff --git a/x-pack/test_serverless/functional/test_suites/common/discover/esql/_esql_view.ts b/x-pack/test_serverless/functional/test_suites/common/discover/esql/_esql_view.ts index 348cad966c5e1..03dc8cea4a100 100644 --- a/x-pack/test_serverless/functional/test_suites/common/discover/esql/_esql_view.ts +++ b/x-pack/test_serverless/functional/test_suites/common/discover/esql/_esql_view.ts @@ -141,8 +141,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should perform test query correctly', async function () { await PageObjects.timePicker.setDefaultAbsoluteRange(); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.discover.selectTextBaseLang(); - const testQuery = `from logstash-* | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`; + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.waitUntilSearchingHasFinished(); + const testQuery = `from logstash-* | sort @timestamp | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`; await monacoEditor.setCodeEditorValue(testQuery); await testSubjects.click('querySubmitButton'); @@ -157,7 +161,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should render when switching to a time range with no data, then back to a time range with data', async () => { await PageObjects.discover.selectTextBaseLang(); - const testQuery = `from logstash-* | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`; + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.waitUntilSearchingHasFinished(); + + const testQuery = `from logstash-* | sort @timestamp | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`; await monacoEditor.setCodeEditorValue(testQuery); await testSubjects.click('querySubmitButton'); await PageObjects.header.waitUntilLoadingHasFinished(); @@ -183,7 +190,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); - const testQuery = `from logstash* | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`; + const testQuery = `from logstash* | sort @timestamp | limit 10 | stats countB = count(bytes) by geo.dest | sort countB`; await monacoEditor.setCodeEditorValue(testQuery); await testSubjects.click('querySubmitButton'); await PageObjects.header.waitUntilLoadingHasFinished(); @@ -301,6 +308,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.discover.waitUntilSearchingHasFinished(); await PageObjects.discover.saveSearch('esql_test2'); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.waitUntilSearchingHasFinished(); const testQuery = 'from logstash-* | limit 100 | drop @timestamp'; await monacoEditor.setCodeEditorValue(testQuery); await testSubjects.click('querySubmitButton'); diff --git a/x-pack/test_serverless/functional/test_suites/common/discover/x_pack/visualize_field.ts b/x-pack/test_serverless/functional/test_suites/common/discover/x_pack/visualize_field.ts index 42d1ad33b30f0..7d145542e5884 100644 --- a/x-pack/test_serverless/functional/test_suites/common/discover/x_pack/visualize_field.ts +++ b/x-pack/test_serverless/functional/test_suites/common/discover/x_pack/visualize_field.ts @@ -48,7 +48,11 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { beforeEach(async () => { await PageObjects.common.navigateToApp('discover'); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.waitUntilSearchingHasFinished(); await setDiscoverTimeRange(); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.discover.waitUntilSearchingHasFinished(); }); after(async () => { @@ -64,7 +68,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await PageObjects.unifiedFieldList.expectFieldListItemVisualize('bytes'); }); - it('visualizes field to Lens and loads fields to the dimesion editor', async () => { + it('visualizes field to Lens and loads fields to the dimension editor', async () => { await PageObjects.unifiedFieldList.findFieldByName('bytes'); await PageObjects.unifiedFieldList.clickFieldListItemVisualize('bytes'); await PageObjects.header.waitUntilLoadingHasFinished();