Fix flaky test from #172781 (#176972)

## Summary

This PR fixes the flaky test skipped in #172781.

Flaky test runner x95:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5187.

Resolves #172781.

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
Davis McPhee 2024-02-15 16:08:13 -04:00 committed by GitHub
parent 8e7e5b23ec
commit d2f566970c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 4 deletions

View file

@ -73,7 +73,7 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => {
await PageObjects.timePicker.setAbsoluteRange(TEST_START_TIME, TEST_END_TIME);
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.unifiedFieldList.waitUntilSidebarHasLoaded();
await PageObjects.unifiedFieldList.toggleSidebarSection('meta');
await PageObjects.unifiedFieldList.openSidebarSection('meta');
});
after(async () => {

View file

@ -88,6 +88,22 @@ export class UnifiedFieldListPageObject extends FtrService {
);
}
public async openSidebarSection(sectionName: SidebarSectionName) {
const openedSectionSelector = `${this.getSidebarSectionSelector(
sectionName,
true
)}.euiAccordion-isOpen`;
if (await this.find.existsByCssSelector(openedSectionSelector)) {
return;
}
await this.retry.waitFor(`${sectionName} fields section to open`, async () => {
await this.toggleSidebarSection(sectionName);
return await this.find.existsByCssSelector(openedSectionSelector);
});
}
public async waitUntilFieldPopoverIsOpen() {
await this.retry.waitFor('popover is open', async () => {
return Boolean(await this.find.byCssSelector('[data-popover-open="true"]'));

View file

@ -78,7 +78,7 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => {
await PageObjects.timePicker.setAbsoluteRange(TEST_START_TIME, TEST_END_TIME);
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.unifiedFieldList.waitUntilSidebarHasLoaded();
await PageObjects.unifiedFieldList.toggleSidebarSection('meta');
await PageObjects.unifiedFieldList.openSidebarSection('meta');
});
after(async () => {
@ -92,8 +92,7 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => {
await kibanaServer.savedObjects.cleanStandardList();
});
// FLAKY: https://github.com/elastic/kibana/issues/172781
describe.skip('existence', () => {
describe('existence', () => {
it('should find which fields exist in the sample documents', async () => {
const sidebarFields = await PageObjects.unifiedFieldList.getAllFieldNames();
expect(sidebarFields.sort()).to.eql([...metaFields, ...fieldsWithData].sort());