Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[functional-tests] TimePicker optimizations #130200

Merged
31 changes: 19 additions & 12 deletions test/functional/page_objects/time_picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down Expand Up @@ -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');
}
});
}

/**
Expand Down Expand Up @@ -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
Expand Down