Skip to content

Commit

Permalink
fix flaky test Chrome X-Pack UI Functional Tests.x-pack/test/function…
Browse files Browse the repository at this point in the history
…al/apps/maps/group2/embeddable/add_to_dashboard·js (#168500)

Closes #168029

flaky test runner
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3447

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
nreese and kibanamachine authored Oct 11, 2023
1 parent 91cdbe2 commit f088e55
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions test/functional/page_objects/time_to_visualize_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand All @@ -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 = {}
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit f088e55

Please sign in to comment.