From fbf1d04b18d25a59e3d8ad41b913db6d10f698d3 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Thu, 5 Oct 2023 12:52:41 +0200 Subject: [PATCH] [Log Explorer] Update serverless tests stability (#167482) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 📓 Summary Update login logic, sorting and search algorithm to stabilize the flaky tests for Log Explorer. Closes #165915 Closes #165916 Closes #165975 Closes #166016 Closes #166672 Closes #166675 Closes #166817 Closes #167058 Closes #167189 Closes #167499 Closes #167515 Closes #167562 Closes #167567 Closes #167621 Closes #167664 Closes #167773 --------- Co-authored-by: Marco Antonio Ghiani Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .../data_views/src/state_machine.ts | 5 ++- .../datasets/src/state_machine.ts | 9 +++++- .../integrations/src/state_machine.ts | 9 +++++- .../columns_selection.ts | 9 ++---- .../dataset_selection_state.ts | 13 ++++---- .../dataset_selector.ts | 5 ++- .../observability_log_explorer/header_menu.ts | 3 -- .../observability_log_explorer.ts | 31 ++++++++++++++++--- .../columns_selection.ts | 17 ++++------ .../dataset_selection_state.ts | 14 ++++----- .../dataset_selector.ts | 5 ++- .../filter_controls.ts | 6 ++-- .../observability_log_explorer/header_menu.ts | 4 --- 13 files changed, 73 insertions(+), 57 deletions(-) diff --git a/x-pack/plugins/log_explorer/public/state_machines/data_views/src/state_machine.ts b/x-pack/plugins/log_explorer/public/state_machines/data_views/src/state_machine.ts index 9f0aa9af396f3..55be0c470573f 100644 --- a/x-pack/plugins/log_explorer/public/state_machines/data_views/src/state_machine.ts +++ b/x-pack/plugins/log_explorer/public/state_machines/data_views/src/state_machine.ts @@ -146,7 +146,10 @@ export const createDataViewsStateMachine = ({ const searchParams = context.search; return context.cache.has(searchParams) ? Promise.resolve(context.cache.get(searchParams)) - : dataViews.getIdsWithTitle().then((views) => views.map(parseDataViewListItem)); + : dataViews + .getIdsWithTitle() + .then((views) => views.map(parseDataViewListItem)) + .then((views) => searchDataViews(views, searchParams)); }, }, }); diff --git a/x-pack/plugins/log_explorer/public/state_machines/datasets/src/state_machine.ts b/x-pack/plugins/log_explorer/public/state_machines/datasets/src/state_machine.ts index 005f41b18beaf..480d0f5bb8ff1 100644 --- a/x-pack/plugins/log_explorer/public/state_machines/datasets/src/state_machine.ts +++ b/x-pack/plugins/log_explorer/public/state_machines/datasets/src/state_machine.ts @@ -20,7 +20,7 @@ import type { export const createPureDatasetsStateMachine = ( initialContext: DefaultDatasetsContext = DEFAULT_CONTEXT ) => - /** @xstate-layout N4IgpgJg5mDOIC5QBECGAXVBldAnMqAtrAHQCuAdgJbXpWoA2VAXpAMQAyA8gILID6yHgBUe-LMIBKAUR4BZLAG0ADAF1EoAA4B7WFTraKGkAA9EAdmUBWEuYCMygJwBmc1YA0IAJ6IATFeUSO3NHewAOZWCrczC7XwBfeM80TBx8IlIGbVQIGig2CEMwEhoAN20Aa2KU7DwCYhIsnLyEMu0AYwwqQxVVXuMdPQMjJFMLO0dbOzC3Tx8EWJIA5WVnayiYuMTkjFr0hqbcinywXFxtXBJNBgwAMwvCEhq0+szso6hWinLO4d7+0aDfTdEagMwIOzTcwkXyrOIebx+RyTZx2NZWNEBRyQgAsVm2IGedQyjXe7CwskkAGEABKCERiCQyeRKNQDXTAwzGcF2ABsgTxqP8c0QVjFJCcvOcYRxvJlvhxOMcBKJ+zeOXJXEkwnponEUlkCgBWg5w25iD5AqsQoR82cOOhjmtdjFGLcmxVuxeJIgYAARtpKO0wFgCLh2gALPKq15sCk8al0oR6pmG1nqQGmkHmhA45w2KxhWE2kW57EkXkhcKRd2xT2pYkNX0BoMhsOR6NexuwNgmWCYdDFVC3Qe4AAUa2UAEo2DGff7AxRg6HUOGo8c58RjSAgWbRuDLDZ7E5XLbRfYK1XpjXonWkoSu2rSc1jgAxVBUBjsGTcPi6xkGiy267tm+4WlCMJwsKiIIAqYQkLE6KYk4uJhIk94UNovrwKMm44SaQygWCiAALS8qWZH1nsr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EFZEAoi7wD084qZyAK9AgAC0OiSj5QbCYkxBkH81B0JAbmJvRkwGAWcr3jYJjWjYGJ2C4X7TFp4LgiqIIToKJgBZsjxVLskV0Z5uL8kEfgpYY-o2BKX5PiZBgYiliWNRIHqzusgUlYuEDlWp0WepK5hOlptjTcs07deWfXFYRy7EaR0EUXBVHDR5QKWamQpWW1VndUErptcY-gGPoyp8osfJFSG2zpBJUkRVe7ntnY3YjsqCJTAYcqovMrpingaIYo4V0pXx912UAA */ createMachine( { context: initialContext, @@ -44,6 +44,13 @@ export const createPureDatasetsStateMachine = ( }, onError: 'loadingFailed', }, + on: { + SEARCH_DATASETS: 'debounceSearchingDatasets', + SORT_DATASETS: { + target: 'loading', + actions: 'storeSearch', + }, + }, }, loaded: { on: { diff --git a/x-pack/plugins/log_explorer/public/state_machines/integrations/src/state_machine.ts b/x-pack/plugins/log_explorer/public/state_machines/integrations/src/state_machine.ts index e3c858e6f2658..b6bcc5ddd5922 100644 --- a/x-pack/plugins/log_explorer/public/state_machines/integrations/src/state_machine.ts +++ b/x-pack/plugins/log_explorer/public/state_machines/integrations/src/state_machine.ts @@ -24,7 +24,7 @@ export const createPureIntegrationsStateMachine = ( ) => createMachine( { - /** @xstate-layout N4IgpgJg5mDOIC5QEkB2AXMUBOBDdAlgPaqwB0ArqgdYbgDYEBekAxANoAMAuoqAA5FYBQiT4gAHogC0ATgBs8sgEYAHAHYALMs7rV85ctkAmADQgAnonWcysgKwHZmgMwPlN1aoC+382kwcfGJSMnoiXAgaKFYIEjAyGgA3IgBrBICsPFFQ8MjohGSiAGNgki5uCvFBYRzxKQRpdQ8yY3tlRTVOF05OTXMrBGUXJXtZVU1J1UMXTWNffwwsstyIqNQYsGxsImwyfnp8ADNdgFsyTKCc8jz1qELUFNKciqqkEBqREPqZHWNjMj2GzGTiqWQuYyuYyqAaIaFKVScZzydT2EY6FwuBYgS7ZEI3NaQRIQehgVgAGQA8gBBAAiAH0ALKUgBKAFF6cgAHIAFTZAHEWdSech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sQZGB9E2MghgQyaCbJCBBydyYywzvLYOWjSB53VkfGKZ9-GDCifYVoHwvT8lBBKTQY1OLNgdJ6RQshnAUOQVEHufdgG+NyTRC8bhAkfDCYGVQdSrGIBVElJsnhHSV0DGoXeXggA */ context: initialContext, preserveActionOrder: true, predictableActionArguments: true, @@ -45,6 +45,13 @@ export const createPureIntegrationsStateMachine = ( }, onError: 'loadingFailed', }, + on: { + SEARCH_INTEGRATIONS: 'loaded.debounceSearchingIntegrations', + SORT_INTEGRATIONS: { + target: '#loading', + actions: 'storeSearch', + }, + }, }, loaded: { id: 'loaded', diff --git a/x-pack/test/functional/apps/observability_log_explorer/columns_selection.ts b/x-pack/test/functional/apps/observability_log_explorer/columns_selection.ts index b8af643d828c7..7738d3b97b2bc 100644 --- a/x-pack/test/functional/apps/observability_log_explorer/columns_selection.ts +++ b/x-pack/test/functional/apps/observability_log_explorer/columns_selection.ts @@ -6,7 +6,6 @@ */ import expect from '@kbn/expect'; import rison from '@kbn/rison'; -import querystring from 'querystring'; import { FtrProviderContext } from '../../ftr_provider_context'; const defaultLogColumns = ['@timestamp', 'service.name', 'host.name', 'message']; @@ -33,8 +32,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it("should initialize the table columns to logs' default selection", async () => { await PageObjects.observabilityLogExplorer.navigateTo(); - await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); - await retry.try(async () => { expect(await PageObjects.discover.getColumnHeaders()).to.eql(defaultLogColumns); }); @@ -42,15 +39,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should restore the table columns from the URL state if exists', async () => { await PageObjects.observabilityLogExplorer.navigateTo({ - search: querystring.stringify({ + search: { _a: rison.encode({ columns: ['service.name', 'host.name', 'message', 'data_stream.namespace'], }), - }), + }, }); - await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); - await retry.try(async () => { expect(await PageObjects.discover.getColumnHeaders()).to.eql([ ...defaultLogColumns, diff --git a/x-pack/test/functional/apps/observability_log_explorer/dataset_selection_state.ts b/x-pack/test/functional/apps/observability_log_explorer/dataset_selection_state.ts index 1a62d952546b9..e232b9df5f1c4 100644 --- a/x-pack/test/functional/apps/observability_log_explorer/dataset_selection_state.ts +++ b/x-pack/test/functional/apps/observability_log_explorer/dataset_selection_state.ts @@ -6,7 +6,6 @@ */ import expect from '@kbn/expect'; import rison from '@kbn/rison'; -import querystring from 'querystring'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { @@ -30,9 +29,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const azureActivitylogsIndex = 'BQZwpgNmDGAuCWB7AdgLmAEwIay+W6yWAtmKgOQSIDmIAtFgF4CuATmAHRZzwBu8sAJ5VadAFTkANAlhRU3BPyEiQASklFS8lu2kC55AII6wAAgAyNEFN5hWIJGnIBGDgFYOAJgDM5deCgeFAAVQQAHMgdkaihVIA==='; await PageObjects.observabilityLogExplorer.navigateTo({ - search: querystring.stringify({ + search: { _a: rison.encode({ index: azureActivitylogsIndex }), - }), + }, }); const datasetSelectionTitle = @@ -44,9 +43,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should fallback to the "All logs" selection and notify the user of an invalid encoded index', async () => { const invalidEncodedIndex = 'invalid-encoded-index'; await PageObjects.observabilityLogExplorer.navigateTo({ - search: querystring.stringify({ + search: { _a: rison.encode({ index: invalidEncodedIndex }), - }), + }, }); const datasetSelectionTitle = @@ -67,10 +66,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const azureActivitylogsIndex = 'BQZwpgNmDGAuCWB7AdgLmAEwIay+W6yWAtmKgOQSIDmIAtFgF4CuATmAHRZzwBu8sAJ5VadAFTkANAlhRU3BPyEiQASklFS8lu2kC55AII6wAAgAyNEFN5hWIJGnIBGDgFYOAJgDM5deCgeFAAVQQAHMgdkaihVIA==='; await PageObjects.observabilityLogExplorer.navigateTo({ - search: querystring.stringify({ + search: { _a: rison.encode({ index: azureActivitylogsIndex }), controlPanels: rison.encode({}), - }), + }, }); const azureDatasetSelectionTitle = await PageObjects.observabilityLogExplorer.getDatasetSelectorButtonText(); diff --git a/x-pack/test/functional/apps/observability_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/observability_log_explorer/dataset_selector.ts index b630cfea6ba4d..73426c990ec48 100644 --- a/x-pack/test/functional/apps/observability_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/observability_log_explorer/dataset_selector.ts @@ -14,7 +14,7 @@ const initialPackageMap = { }; const initialPackagesTexts = Object.values(initialPackageMap); -const expectedDataViews = ['logstash-*', 'logs-*', 'metrics-*']; +const expectedDataViews = ['logs-*', 'logstash-*', 'metrics-*']; const sortedExpectedDataViews = expectedDataViews.slice().sort(); const uncategorized = ['logs-gaming-*', 'logs-manufacturing-*', 'logs-retail-*']; @@ -30,8 +30,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const noIntegrationsTitle = 'No integrations found'; const noUncategorizedTitle = 'No data streams found'; - // Failing: See https://github.com/elastic/kibana/issues/167621 - describe.skip('Dataset Selector', () => { + describe('Dataset Selector', () => { before(async () => { await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); await PageObjects.observabilityLogExplorer.removeInstalledPackages(); diff --git a/x-pack/test/functional/apps/observability_log_explorer/header_menu.ts b/x-pack/test/functional/apps/observability_log_explorer/header_menu.ts index b67cac94ae32f..eb3c94b62403b 100644 --- a/x-pack/test/functional/apps/observability_log_explorer/header_menu.ts +++ b/x-pack/test/functional/apps/observability_log_explorer/header_menu.ts @@ -47,9 +47,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should navigate to discover keeping the current columns/filters/query/time/data view', async () => { - // Set timerange to specific values to match data and retrieve config - await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); - await retry.try(async () => { await testSubjects.existOrFail('superDatePickerstartDatePopoverButton'); await testSubjects.existOrFail('superDatePickerendDatePopoverButton'); diff --git a/x-pack/test/functional/page_objects/observability_log_explorer.ts b/x-pack/test/functional/page_objects/observability_log_explorer.ts index e4b8270cff6d4..15da13b99c70f 100644 --- a/x-pack/test/functional/page_objects/observability_log_explorer.ts +++ b/x-pack/test/functional/page_objects/observability_log_explorer.ts @@ -5,6 +5,8 @@ * 2.0. */ import expect from '@kbn/expect'; +import rison from '@kbn/rison'; +import querystring from 'querystring'; import { WebElementWrapper } from '../../../../test/functional/services/lib/web_element_wrapper'; import { FtrProviderContext } from '../ftr_provider_context'; @@ -99,6 +101,9 @@ const packages: IntegrationPackage[] = [ const initialPackages = packages.slice(0, 3); const additionalPackages = packages.slice(3); +const FROM = '2023-08-03T10:24:14.035Z'; +const TO = '2023-08-03T10:24:14.091Z'; + export function ObservabilityLogExplorerPageObject({ getPageObjects, getService, @@ -109,7 +114,12 @@ export function ObservabilityLogExplorerPageObject({ const testSubjects = getService('testSubjects'); const toasts = getService('toasts'); - type NavigateToAppOptions = Parameters[1]; + type NavigateToAppOptions = Omit< + Parameters[1], + 'search' + > & { + search?: Record; + }; return { uninstallPackage: ({ name, version }: IntegrationPackage) => { @@ -172,8 +182,19 @@ export function ObservabilityLogExplorerPageObject({ }; }, - async navigateTo(options?: NavigateToAppOptions) { - return await PageObjects.common.navigateToApp('observabilityLogExplorer', options); + async navigateTo(options: NavigateToAppOptions = {}) { + const { search = {}, ...extraOptions } = options; + const composedSearch = querystring.stringify({ + ...search, + _g: rison.encode({ + time: { from: FROM, to: TO }, + }), + }); + + return await PageObjects.common.navigateToApp('observabilityLogExplorer', { + search: composedSearch, + ...extraOptions, + }); }, getDatasetSelector() { @@ -181,7 +202,7 @@ export function ObservabilityLogExplorerPageObject({ }, getDatasetSelectorButton() { - return testSubjects.find('datasetSelectorPopoverButton', 30000); // Increase timeout if refresh takes longer before opening the selector + return testSubjects.find('datasetSelectorPopoverButton', 120000); // Increase timeout if refresh takes longer before opening the selector }, getDatasetSelectorContent() { @@ -290,7 +311,7 @@ export function ObservabilityLogExplorerPageObject({ const searchField = await searchControlsContainer.findByCssSelector('input[type=search]'); await searchField.clearValueWithKeyboard(); - return searchField.type(name); + return searchField.type(name, { charByChar: true }); }, async clearSearchField() { diff --git a/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/columns_selection.ts b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/columns_selection.ts index 955ef8d22055f..a011a00a24f9c 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/columns_selection.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/columns_selection.ts @@ -6,7 +6,6 @@ */ import expect from '@kbn/expect'; import rison from '@kbn/rison'; -import querystring from 'querystring'; import { FtrProviderContext } from '../../../ftr_provider_context'; const defaultLogColumns = ['@timestamp', 'service.name', 'host.name', 'message']; @@ -14,18 +13,18 @@ const defaultLogColumns = ['@timestamp', 'service.name', 'host.name', 'message'] export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const retry = getService('retry'); - const PageObjects = getPageObjects(['discover', 'observabilityLogExplorer']); + const PageObjects = getPageObjects(['discover', 'observabilityLogExplorer', 'svlCommonPage']); - // FLAKY: https://github.com/elastic/kibana/issues/165915 - // FLAKY: https://github.com/elastic/kibana/issues/165916 - describe.skip('Columns selection initialization and update', () => { + describe('Columns selection initialization and update', () => { before(async () => { await esArchiver.load( 'x-pack/test/functional/es_archives/observability_log_explorer/data_streams' ); + await PageObjects.svlCommonPage.login(); }); after(async () => { + await PageObjects.svlCommonPage.forceLogout(); await esArchiver.unload( 'x-pack/test/functional/es_archives/observability_log_explorer/data_streams' ); @@ -35,8 +34,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it("should initialize the table columns to logs' default selection", async () => { await PageObjects.observabilityLogExplorer.navigateTo(); - await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); - await retry.try(async () => { expect(await PageObjects.discover.getColumnHeaders()).to.eql(defaultLogColumns); }); @@ -44,15 +41,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should restore the table columns from the URL state if exists', async () => { await PageObjects.observabilityLogExplorer.navigateTo({ - search: querystring.stringify({ + search: { _a: rison.encode({ columns: ['service.name', 'host.name', 'message', 'data_stream.namespace'], }), - }), + }, }); - await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); - await retry.try(async () => { expect(await PageObjects.discover.getColumnHeaders()).to.eql([ ...defaultLogColumns, diff --git a/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/dataset_selection_state.ts b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/dataset_selection_state.ts index 1e12a054c852f..9f6e978e1f270 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/dataset_selection_state.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/dataset_selection_state.ts @@ -6,7 +6,6 @@ */ import expect from '@kbn/expect'; import rison from '@kbn/rison'; -import querystring from 'querystring'; import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { @@ -19,7 +18,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { 'header', ]); - // https://github.com/elastic/kibana/issues/166016 describe('DatasetSelection initialization and update', () => { before(async () => { await PageObjects.svlCommonPage.login(); @@ -45,9 +43,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const azureActivitylogsIndex = 'BQZwpgNmDGAuCWB7AdgLmAEwIay+W6yWAtmKgOQSIDmIAtFgF4CuATmAHRZzwBu8sAJ5VadAFTkANAlhRU3BPyEiQASklFS8lu2kC55AII6wAAgAyNEFN5hWIJGnIBGDgFYOAJgDM5deCgeFAAVQQAHMgdkaihVIA==='; await PageObjects.observabilityLogExplorer.navigateTo({ - search: querystring.stringify({ + search: { _a: rison.encode({ index: azureActivitylogsIndex }), - }), + }, }); await PageObjects.header.waitUntilLoadingHasFinished(); @@ -60,9 +58,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should fallback to the "All logs" selection and notify the user of an invalid encoded index', async () => { const invalidEncodedIndex = 'invalid-encoded-index'; await PageObjects.observabilityLogExplorer.navigateTo({ - search: querystring.stringify({ + search: { _a: rison.encode({ index: invalidEncodedIndex }), - }), + }, }); await PageObjects.header.waitUntilLoadingHasFinished(); @@ -85,10 +83,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const azureActivitylogsIndex = 'BQZwpgNmDGAuCWB7AdgLmAEwIay+W6yWAtmKgOQSIDmIAtFgF4CuATmAHRZzwBu8sAJ5VadAFTkANAlhRU3BPyEiQASklFS8lu2kC55AII6wAAgAyNEFN5hWIJGnIBGDgFYOAJgDM5deCgeFAAVQQAHMgdkaihVIA==='; await PageObjects.observabilityLogExplorer.navigateTo({ - search: querystring.stringify({ + search: { _a: rison.encode({ index: azureActivitylogsIndex }), controlPanels: rison.encode({}), - }), + }, }); await PageObjects.header.waitUntilLoadingHasFinished(); const azureDatasetSelectionTitle = diff --git a/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/dataset_selector.ts b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/dataset_selector.ts index 4d0ff2f3b2378..ef51de3c4b693 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/dataset_selector.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/dataset_selector.ts @@ -34,8 +34,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const noIntegrationsTitle = 'No integrations found'; const noUncategorizedTitle = 'No data streams found'; - // Failing: See https://github.com/elastic/kibana/issues/167773 - describe.skip('Dataset Selector', () => { + describe('Dataset Selector', () => { before(async () => { await PageObjects.svlCommonPage.login(); await PageObjects.observabilityLogExplorer.removeInstalledPackages(); @@ -55,7 +54,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.observabilityLogExplorer.openDatasetSelector(); }); - it('should always display the Integrations Uncategorized and Data Views top level tabs', async () => { + it('should always display the Integrations, Uncategorized and Data Views top level tabs', async () => { const integrationsTab = await PageObjects.observabilityLogExplorer.getIntegrationsTab(); const uncategorizedTab = await PageObjects.observabilityLogExplorer.getUncategorizedTab(); const dataViewsTab = await PageObjects.observabilityLogExplorer.getDataViewsTab(); diff --git a/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/filter_controls.ts b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/filter_controls.ts index b28c040f56c98..4cd5924e7608c 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/filter_controls.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/filter_controls.ts @@ -8,18 +8,18 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const kibanaServer = getService('kibanaServer'); - const PageObjects = getPageObjects(['observabilityLogExplorer', 'svlCommonPage']); const testSubjects = getService('testSubjects'); + const PageObjects = getPageObjects(['observabilityLogExplorer', 'svlCommonPage']); describe('Filter controls customization', () => { before('initialize tests', async () => { - await PageObjects.svlCommonPage.login(); await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); + await PageObjects.svlCommonPage.login(); }); after('clean up archives', async () => { - await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); await PageObjects.svlCommonPage.forceLogout(); + await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); }); it('renders a filter controls section as part of the unified search bar', async () => { diff --git a/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/header_menu.ts b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/header_menu.ts index 882c5803a6cc0..c9f8e598ff2a8 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/header_menu.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/header_menu.ts @@ -21,7 +21,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { 'header', ]); - // FLAKY: https://github.com/elastic/kibana/issues/167189 describe('Header menu', () => { before(async () => { await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); @@ -58,9 +57,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should navigate to discover keeping the current columns/filters/query/time/data view', async () => { - // Set timerange to specific values to match data and retrieve config - await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); - await retry.try(async () => { await testSubjects.existOrFail('superDatePickerstartDatePopoverButton'); await testSubjects.existOrFail('superDatePickerendDatePopoverButton');