From f088e55fdde2066f2d5f4fa528d382112b6320f8 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Wed, 11 Oct 2023 08:31:06 -0600 Subject: [PATCH] =?UTF-8?q?fix=20flaky=20test=20Chrome=20X-Pack=20UI=20Fun?= =?UTF-8?q?ctional=20Tests.x-pack/test/functional/apps/maps/group2/embedda?= =?UTF-8?q?ble/add=5Fto=5Fdashboard=C2=B7js=20(#168500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes https://github.com/elastic/kibana/issues/168029 flaky test runner https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3447 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .../page_objects/time_to_visualize_page.ts | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/test/functional/page_objects/time_to_visualize_page.ts b/test/functional/page_objects/time_to_visualize_page.ts index 9ff567fcb4ef3..ac8a4414eaa30 100644 --- a/test/functional/page_objects/time_to_visualize_page.ts +++ b/test/functional/page_objects/time_to_visualize_page.ts @@ -27,6 +27,7 @@ export class TimeToVisualizePageObject extends FtrService { private readonly find = this.ctx.getService('find'); private readonly common = this.ctx.getPageObject('common'); private readonly dashboard = this.ctx.getPageObject('dashboard'); + private readonly retry = this.ctx.getService('retry'); public async ensureSaveModalIsOpen() { await this.testSubjects.exists('savedObjectSaveModal', { timeout: 5000 }); @@ -47,6 +48,21 @@ export class TimeToVisualizePageObject extends FtrService { await this.dashboard.clickNewDashboard(false); } + private async selectDashboard(dashboardId: string) { + await this.retry.try(async () => { + await this.testSubjects.waitForEnabled('open-dashboard-picker'); + await this.testSubjects.click('open-dashboard-picker'); + await this.testSubjects.setValue('dashboard-picker-search', dashboardId); + await this.common.sleep(150); // wait for input debounce so loading starts + await this.testSubjects.waitForEnabled('open-dashboard-picker'); + await this.testSubjects.click(`dashboard-picker-option-${dashboardId.replaceAll(' ', '-')}`); + const dashboardPickerLabel = await this.testSubjects.getVisibleText('open-dashboard-picker'); + if (dashboardPickerLabel === 'Select dashboard') { + throw new Error(`Dashboard not selected`); + } + }); + } + public async setSaveModalValues( vizName: string, { saveAsNew, redirectToOrigin, addToDashboard, dashboardId, saveToLibrary }: SaveModalArgs = {} @@ -75,14 +91,7 @@ export class TimeToVisualizePageObject extends FtrService { await label.click(); if (dashboardId) { - await this.testSubjects.waitForEnabled('open-dashboard-picker'); - await this.testSubjects.click('open-dashboard-picker'); - await this.testSubjects.setValue('dashboard-picker-search', dashboardId); - await this.common.sleep(150); // wait for input debounce so loading starts - await this.testSubjects.waitForEnabled('open-dashboard-picker'); - await this.testSubjects.click( - `dashboard-picker-option-${dashboardId.replaceAll(' ', '-')}` - ); + await this.selectDashboard(dashboardId); } }