From 570963b07b2e2cbffd2e5c10eae9896c50f019b2 Mon Sep 17 00:00:00 2001 From: Julia Rechkunova Date: Tue, 10 Oct 2023 11:25:12 +0200 Subject: [PATCH] [Discover] Unskip flaky field token tests (#168130) - Closes https://github.com/elastic/kibana/issues/168115 This PR unskips the flaky test and also extracts other tests from `discover/group2` into a new `discover/group4`. 100x group2 https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3390 100x group4 https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3386 --- .buildkite/ftr_configs.yml | 1 + .../group2/_data_grid_field_tokens.ts | 34 +++++++++++------ test/functional/apps/discover/group2/index.ts | 13 ------- .../{group2 => group4}/_adhoc_data_views.ts | 0 .../{group2 => group4}/_chart_hidden.ts | 0 .../_context_encoded_url_params.ts | 0 .../{group2 => group4}/_data_view_edit.ts | 0 .../{group2 => group4}/_date_nested.ts | 0 .../_discover_fields_api.ts | 0 .../discover/{group2 => group4}/_esql_view.ts | 0 .../{group2 => group4}/_hide_announcements.ts | 0 .../{group2 => group4}/_huge_fields.ts | 0 .../_indexpattern_with_unmapped_fields.ts | 0 .../_indexpattern_without_timefield.ts | 0 .../_runtime_fields_editor.ts | 0 .../_search_on_page_load.ts | 0 .../functional/apps/discover/group4/config.ts | 18 +++++++++ test/functional/apps/discover/group4/index.ts | 37 +++++++++++++++++++ test/functional/firefox/discover.config.ts | 2 + 19 files changed, 80 insertions(+), 25 deletions(-) rename test/functional/apps/discover/{group2 => group4}/_adhoc_data_views.ts (100%) rename test/functional/apps/discover/{group2 => group4}/_chart_hidden.ts (100%) rename test/functional/apps/discover/{group2 => group4}/_context_encoded_url_params.ts (100%) rename test/functional/apps/discover/{group2 => group4}/_data_view_edit.ts (100%) rename test/functional/apps/discover/{group2 => group4}/_date_nested.ts (100%) rename test/functional/apps/discover/{group2 => group4}/_discover_fields_api.ts (100%) rename test/functional/apps/discover/{group2 => group4}/_esql_view.ts (100%) rename test/functional/apps/discover/{group2 => group4}/_hide_announcements.ts (100%) rename test/functional/apps/discover/{group2 => group4}/_huge_fields.ts (100%) rename test/functional/apps/discover/{group2 => group4}/_indexpattern_with_unmapped_fields.ts (100%) rename test/functional/apps/discover/{group2 => group4}/_indexpattern_without_timefield.ts (100%) rename test/functional/apps/discover/{group2 => group4}/_runtime_fields_editor.ts (100%) rename test/functional/apps/discover/{group2 => group4}/_search_on_page_load.ts (100%) create mode 100644 test/functional/apps/discover/group4/config.ts create mode 100644 test/functional/apps/discover/group4/index.ts diff --git a/.buildkite/ftr_configs.yml b/.buildkite/ftr_configs.yml index 3e0a5e0e9381b..2cc8d8cb0ed7a 100644 --- a/.buildkite/ftr_configs.yml +++ b/.buildkite/ftr_configs.yml @@ -112,6 +112,7 @@ enabled: - test/functional/apps/discover/group1/config.ts - test/functional/apps/discover/group2/config.ts - test/functional/apps/discover/group3/config.ts + - test/functional/apps/discover/group4/config.ts - test/functional/apps/getting_started/config.ts - test/functional/apps/home/config.ts - test/functional/apps/kibana_overview/config.ts diff --git a/test/functional/apps/discover/group2/_data_grid_field_tokens.ts b/test/functional/apps/discover/group2/_data_grid_field_tokens.ts index 44e573d0dafa5..3731c1e15f446 100644 --- a/test/functional/apps/discover/group2/_data_grid_field_tokens.ts +++ b/test/functional/apps/discover/group2/_data_grid_field_tokens.ts @@ -7,7 +7,6 @@ */ import expect from '@kbn/expect'; -import { WebElementWrapper } from '../../../services/lib/web_element_wrapper'; import { FtrProviderContext } from '../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { @@ -21,6 +20,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { 'header', ]); const esArchiver = getService('esArchiver'); + const log = getService('log'); + const retry = getService('retry'); const dashboardAddPanel = getService('dashboardAddPanel'); const testSubjects = getService('testSubjects'); const kibanaServer = getService('kibanaServer'); @@ -31,26 +32,35 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }; async function findFirstColumnTokens() { - const header = await testSubjects.find('euiDataGridBody > dataGridHeader'); - return await findFirstFieldIcons(header); + return await findFirstFieldIcons('euiDataGridBody > dataGridHeader'); } async function findFirstDocViewerTokens() { await dataGrid.clickRowToggle({ rowIndex: 0 }); - const docViewer = await testSubjects.find('docTableDetailsFlyout'); - return await findFirstFieldIcons(docViewer); + return await findFirstFieldIcons('docTableDetailsFlyout'); } - async function findFirstFieldIcons(element: WebElementWrapper) { - const fieldIcons = await element.findAllByCssSelector('.kbnFieldIcon svg'); + async function findFirstFieldIcons(elementSelector: string) { + let firstFieldIcons: string[] | undefined; - return await Promise.all( - fieldIcons.map((fieldIcon) => fieldIcon.getAttribute('aria-label')).slice(0, 10) - ); + await retry.waitFor('field tokens', async () => { + const element = await testSubjects.find(elementSelector); + const fieldIcons = await element.findAllByCssSelector('.kbnFieldIcon svg'); + + firstFieldIcons = await Promise.all( + fieldIcons.slice(0, 10).map((fieldIcon) => fieldIcon.getAttribute('aria-label')) + ).catch((error) => { + log.debug(`error in findFirstFieldIcons: ${error.message}`); + return undefined; + }); + + return typeof firstFieldIcons !== 'undefined'; + }); + + return firstFieldIcons; } - // Failing: See https://github.com/elastic/kibana/issues/168115 - describe.skip('discover data grid field tokens', function () { + describe('discover data grid field tokens', function () { before(async () => { await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']); await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional'); diff --git a/test/functional/apps/discover/group2/index.ts b/test/functional/apps/discover/group2/index.ts index a01110b5dc6ac..8174e3ef93aba 100644 --- a/test/functional/apps/discover/group2/index.ts +++ b/test/functional/apps/discover/group2/index.ts @@ -20,8 +20,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional'); }); - loadTestFile(require.resolve('./_indexpattern_without_timefield')); - loadTestFile(require.resolve('./_discover_fields_api')); loadTestFile(require.resolve('./_data_grid')); loadTestFile(require.resolve('./_data_grid_context')); loadTestFile(require.resolve('./_data_grid_field_data')); @@ -33,16 +31,5 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./_data_grid_pagination')); loadTestFile(require.resolve('./_data_grid_footer')); loadTestFile(require.resolve('./_data_grid_field_tokens')); - loadTestFile(require.resolve('./_adhoc_data_views')); - loadTestFile(require.resolve('./_esql_view')); - loadTestFile(require.resolve('./_indexpattern_with_unmapped_fields')); - loadTestFile(require.resolve('./_runtime_fields_editor')); - loadTestFile(require.resolve('./_huge_fields')); - loadTestFile(require.resolve('./_date_nested')); - loadTestFile(require.resolve('./_search_on_page_load')); - loadTestFile(require.resolve('./_chart_hidden')); - loadTestFile(require.resolve('./_context_encoded_url_params')); - loadTestFile(require.resolve('./_hide_announcements')); - loadTestFile(require.resolve('./_data_view_edit')); }); } diff --git a/test/functional/apps/discover/group2/_adhoc_data_views.ts b/test/functional/apps/discover/group4/_adhoc_data_views.ts similarity index 100% rename from test/functional/apps/discover/group2/_adhoc_data_views.ts rename to test/functional/apps/discover/group4/_adhoc_data_views.ts diff --git a/test/functional/apps/discover/group2/_chart_hidden.ts b/test/functional/apps/discover/group4/_chart_hidden.ts similarity index 100% rename from test/functional/apps/discover/group2/_chart_hidden.ts rename to test/functional/apps/discover/group4/_chart_hidden.ts diff --git a/test/functional/apps/discover/group2/_context_encoded_url_params.ts b/test/functional/apps/discover/group4/_context_encoded_url_params.ts similarity index 100% rename from test/functional/apps/discover/group2/_context_encoded_url_params.ts rename to test/functional/apps/discover/group4/_context_encoded_url_params.ts diff --git a/test/functional/apps/discover/group2/_data_view_edit.ts b/test/functional/apps/discover/group4/_data_view_edit.ts similarity index 100% rename from test/functional/apps/discover/group2/_data_view_edit.ts rename to test/functional/apps/discover/group4/_data_view_edit.ts diff --git a/test/functional/apps/discover/group2/_date_nested.ts b/test/functional/apps/discover/group4/_date_nested.ts similarity index 100% rename from test/functional/apps/discover/group2/_date_nested.ts rename to test/functional/apps/discover/group4/_date_nested.ts diff --git a/test/functional/apps/discover/group2/_discover_fields_api.ts b/test/functional/apps/discover/group4/_discover_fields_api.ts similarity index 100% rename from test/functional/apps/discover/group2/_discover_fields_api.ts rename to test/functional/apps/discover/group4/_discover_fields_api.ts diff --git a/test/functional/apps/discover/group2/_esql_view.ts b/test/functional/apps/discover/group4/_esql_view.ts similarity index 100% rename from test/functional/apps/discover/group2/_esql_view.ts rename to test/functional/apps/discover/group4/_esql_view.ts diff --git a/test/functional/apps/discover/group2/_hide_announcements.ts b/test/functional/apps/discover/group4/_hide_announcements.ts similarity index 100% rename from test/functional/apps/discover/group2/_hide_announcements.ts rename to test/functional/apps/discover/group4/_hide_announcements.ts diff --git a/test/functional/apps/discover/group2/_huge_fields.ts b/test/functional/apps/discover/group4/_huge_fields.ts similarity index 100% rename from test/functional/apps/discover/group2/_huge_fields.ts rename to test/functional/apps/discover/group4/_huge_fields.ts diff --git a/test/functional/apps/discover/group2/_indexpattern_with_unmapped_fields.ts b/test/functional/apps/discover/group4/_indexpattern_with_unmapped_fields.ts similarity index 100% rename from test/functional/apps/discover/group2/_indexpattern_with_unmapped_fields.ts rename to test/functional/apps/discover/group4/_indexpattern_with_unmapped_fields.ts diff --git a/test/functional/apps/discover/group2/_indexpattern_without_timefield.ts b/test/functional/apps/discover/group4/_indexpattern_without_timefield.ts similarity index 100% rename from test/functional/apps/discover/group2/_indexpattern_without_timefield.ts rename to test/functional/apps/discover/group4/_indexpattern_without_timefield.ts diff --git a/test/functional/apps/discover/group2/_runtime_fields_editor.ts b/test/functional/apps/discover/group4/_runtime_fields_editor.ts similarity index 100% rename from test/functional/apps/discover/group2/_runtime_fields_editor.ts rename to test/functional/apps/discover/group4/_runtime_fields_editor.ts diff --git a/test/functional/apps/discover/group2/_search_on_page_load.ts b/test/functional/apps/discover/group4/_search_on_page_load.ts similarity index 100% rename from test/functional/apps/discover/group2/_search_on_page_load.ts rename to test/functional/apps/discover/group4/_search_on_page_load.ts diff --git a/test/functional/apps/discover/group4/config.ts b/test/functional/apps/discover/group4/config.ts new file mode 100644 index 0000000000000..a70a190ca63f8 --- /dev/null +++ b/test/functional/apps/discover/group4/config.ts @@ -0,0 +1,18 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { FtrConfigProviderContext } from '@kbn/test'; + +export default async function ({ readConfigFile }: FtrConfigProviderContext) { + const functionalConfig = await readConfigFile(require.resolve('../../../config.base.js')); + + return { + ...functionalConfig.getAll(), + testFiles: [require.resolve('.')], + }; +} diff --git a/test/functional/apps/discover/group4/index.ts b/test/functional/apps/discover/group4/index.ts new file mode 100644 index 0000000000000..1aab3db2bfc43 --- /dev/null +++ b/test/functional/apps/discover/group4/index.ts @@ -0,0 +1,37 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ +import { FtrProviderContext } from '../ftr_provider_context'; + +export default function ({ getService, loadTestFile }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const browser = getService('browser'); + + describe('discover/group4', function () { + before(async function () { + await browser.setWindowSize(1600, 1200); + }); + + after(async function unloadMakelogs() { + await esArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional'); + }); + + loadTestFile(require.resolve('./_indexpattern_without_timefield')); + loadTestFile(require.resolve('./_discover_fields_api')); + loadTestFile(require.resolve('./_adhoc_data_views')); + loadTestFile(require.resolve('./_esql_view')); + loadTestFile(require.resolve('./_indexpattern_with_unmapped_fields')); + loadTestFile(require.resolve('./_runtime_fields_editor')); + loadTestFile(require.resolve('./_huge_fields')); + loadTestFile(require.resolve('./_date_nested')); + loadTestFile(require.resolve('./_search_on_page_load')); + loadTestFile(require.resolve('./_chart_hidden')); + loadTestFile(require.resolve('./_context_encoded_url_params')); + loadTestFile(require.resolve('./_hide_announcements')); + loadTestFile(require.resolve('./_data_view_edit')); + }); +} diff --git a/test/functional/firefox/discover.config.ts b/test/functional/firefox/discover.config.ts index 332caa668b409..8b7e7205cd434 100644 --- a/test/functional/firefox/discover.config.ts +++ b/test/functional/firefox/discover.config.ts @@ -20,6 +20,8 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { require.resolve('../apps/discover/classic'), require.resolve('../apps/discover/group1'), require.resolve('../apps/discover/group2'), + require.resolve('../apps/discover/group3'), + require.resolve('../apps/discover/group4'), ], junit: {