fix flaky test x-pack/test/functional/apps/dashboard/group2/panel_time_range·ts (#150630)

Fixers https://github.com/elastic/kibana/issues/150490

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

Failures caused by settings panel not closing. PR resolves issue by
dismissing toasts so save button is clickable and retrying if settings
panel does not close.

<img width="500" alt="Screen Shot 2023-02-08 at 12 30 19 PM"
src="https://user-images.githubusercontent.com/373691/217639189-c1da31e8-b9d8-4d60-b95f-2e04b1d5c228.png">

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Nathan Reese 2023-02-09 10:38:34 -07:00 committed by GitHub
parent 3faf6f519c
commit cb17912b6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,6 +11,8 @@ import { CommonlyUsed } from '../../page_objects/time_picker';
export function DashboardCustomizePanelProvider({ getService }: FtrProviderContext) {
const log = getService('log');
const retry = getService('retry');
const toasts = getService('toasts');
const testSubjects = getService('testSubjects');
return new (class DashboardCustomizePanel {
@ -95,12 +97,19 @@ export function DashboardCustomizePanelProvider({ getService }: FtrProviderConte
public async clickSaveButton() {
log.debug('clickSaveButton');
await testSubjects.click('saveCustomizePanelButton');
await retry.try(async () => {
await toasts.dismissAllToasts();
await testSubjects.click('saveCustomizePanelButton');
await testSubjects.waitForDeleted('saveCustomizePanelButton');
});
}
public async clickCancelButton() {
log.debug('clickCancelButton');
await testSubjects.click('cancelCustomizePanelButton');
await retry.try(async () => {
await testSubjects.click('cancelCustomizePanelButton');
await testSubjects.waitForDeleted('cancelCustomizePanelButton');
});
}
public async clickToggleShowCustomTimeRange() {