[functional-tests] TimePicker optimizations (#130200) (#130506)

(cherry picked from commit fb87699eb8)

Co-authored-by: Brian Seeders <brian.seeders@elastic.co>
This commit is contained in:
Kibana Machine 2022-04-18 16:40:02 -05:00 committed by GitHub
parent 8661bbd1a2
commit 66df1c2291
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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