From ec971486f46f885fd01679f8ef44043a4b02ffec Mon Sep 17 00:00:00 2001 From: Brian Seeders Date: Mon, 18 Apr 2022 16:13:19 -0400 Subject: [PATCH] [functional-tests] TimePicker optimizations (#130200) (cherry picked from commit fb87699eb884cb7047a20e5cf1940e4f3487ee39) --- test/functional/page_objects/time_picker.ts | 31 +++++++++++++-------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/test/functional/page_objects/time_picker.ts b/test/functional/page_objects/time_picker.ts index 37933a91a9d70..5c3c0d81890dd 100644 --- a/test/functional/page_objects/time_picker.ts +++ b/test/functional/page_objects/time_picker.ts @@ -48,7 +48,9 @@ export class TimePickerPageObject extends FtrService { } async ensureHiddenNoDataPopover() { - const isVisible = await this.testSubjects.exists('noDataPopoverDismissButton'); + const isVisible = await this.testSubjects.exists('noDataPopoverDismissButton', { + timeout: 100, + }); if (isVisible) { await this.testSubjects.click('noDataPopoverDismissButton'); } @@ -103,15 +105,19 @@ export class TimePickerPageObject extends FtrService { private async showStartEndTimes() { // This first await makes sure the superDatePicker has loaded before we check for the ShowDatesButton await this.testSubjects.exists('superDatePickerToggleQuickMenuButton', { timeout: 20000 }); - const isShowDatesButton = await this.testSubjects.exists('superDatePickerShowDatesButton'); - if (isShowDatesButton) { - await this.testSubjects.click('superDatePickerShowDatesButton'); - } - await this.testSubjects.exists('superDatePickerstartDatePopoverButton'); - // Close the start date popover which opens automatically if `superDatePickerShowDatesButton` is clicked - if (isShowDatesButton) { - await this.testSubjects.click('superDatePickerstartDatePopoverButton'); - } + await this.retry.tryForTime(5000, async () => { + const isShowDatesButton = await this.testSubjects.exists('superDatePickerShowDatesButton', { + timeout: 50, + }); + if (isShowDatesButton) { + await this.testSubjects.click('superDatePickerShowDatesButton', 50); + } + await this.testSubjects.exists('superDatePickerstartDatePopoverButton', { timeout: 1000 }); + // Close the start date popover which opens automatically if `superDatePickerShowDatesButton` is clicked + if (isShowDatesButton) { + await this.testSubjects.click('superDatePickerstartDatePopoverButton'); + } + }); } /** @@ -156,11 +162,12 @@ export class TimePickerPageObject extends FtrService { await this.retry.waitFor('Timepicker popover to close', async () => { await this.browser.pressKeys(this.browser.keys.ESCAPE); - return !(await this.testSubjects.exists('superDatePickerAbsoluteDateInput')); + return !(await this.testSubjects.exists('superDatePickerAbsoluteDateInput', { timeout: 50 })); }); const superDatePickerApplyButtonExists = await this.testSubjects.exists( - 'superDatePickerApplyTimeButton' + 'superDatePickerApplyTimeButton', + { timeout: 100 } ); if (superDatePickerApplyButtonExists) { // Timepicker is in top nav