Skip to content

Commit

Permalink
conditional click to close
Browse files Browse the repository at this point in the history
  • Loading branch information
thompsongl committed Dec 15, 2021
1 parent 9d0a26e commit 07eee93
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/functional/page_objects/time_picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

import moment from 'moment';
import { setTimeout as setTimeoutAsync } from 'timers/promises';
import { FtrService } from '../ftr_provider_context';
import { WebElementWrapper } from '../services/lib/web_element_wrapper';

Expand Down Expand Up @@ -108,9 +107,10 @@ export class TimePickerPageObject extends FtrService {
await this.testSubjects.click('superDatePickerShowDatesButton');
}
await this.testSubjects.exists('superDatePickerstartDatePopoverButton');
// Close the start date popover which opens automatically when the button is shown
await setTimeoutAsync(250);
await this.testSubjects.click('superDatePickerstartDatePopoverButton');
// Close the start date popover which opens automatically if `superDatePickerShowDatesButton` is clicked
if (isShowDatesButton) {
await this.testSubjects.click('superDatePickerstartDatePopoverButton');
}
}

/**
Expand All @@ -129,7 +129,7 @@ export class TimePickerPageObject extends FtrService {
await this.testSubjects.click('superDatePickerAbsoluteTab');
await this.testSubjects.click('superDatePickerAbsoluteDateInput');
await this.inputValue('superDatePickerAbsoluteDateInput', toTime);
await this.browser.pressKeys(this.browser.keys.ESCAPE); // close popover because sometimes browser can't find start input
await this.testSubjects.click('superDatePickerendDatePopoverButton'); // close popover because sometimes browser can't find start input
const actualToTime = await this.testSubjects.getVisibleText(
'superDatePickerendDatePopoverButton'
);
Expand Down

0 comments on commit 07eee93

Please sign in to comment.