Skip to content

Commit

Permalink
[Discover] Unskip flaky field token tests (elastic#168130)
Browse files Browse the repository at this point in the history
- Closes elastic#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
  • Loading branch information
jughosta authored Oct 10, 2023
1 parent 7839d51 commit 570963b
Show file tree
Hide file tree
Showing 19 changed files with 80 additions and 25 deletions.
1 change: 1 addition & 0 deletions .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 22 additions & 12 deletions test/functional/apps/discover/group2/_data_grid_field_tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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');
Expand All @@ -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');
Expand Down
13 changes: 0 additions & 13 deletions test/functional/apps/discover/group2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand All @@ -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'));
});
}
18 changes: 18 additions & 0 deletions test/functional/apps/discover/group4/config.ts
Original file line number Diff line number Diff line change
@@ -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('.')],
};
}
37 changes: 37 additions & 0 deletions test/functional/apps/discover/group4/index.ts
Original file line number Diff line number Diff line change
@@ -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'));
});
}
2 changes: 2 additions & 0 deletions test/functional/firefox/discover.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 570963b

Please sign in to comment.