From 46dcea538f9bcac77bb2d7ec1f4546da4d93e94c Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Wed, 4 Mar 2020 11:10:52 +0100 Subject: [PATCH] stabilize dashboard snapshot toast closing (#58709) (#59271) --- test/functional/apps/dashboard/dashboard_snapshots.js | 4 ++-- test/functional/page_objects/common_page.ts | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/test/functional/apps/dashboard/dashboard_snapshots.js b/test/functional/apps/dashboard/dashboard_snapshots.js index 3a09b46a713cc..f370067d84e36 100644 --- a/test/functional/apps/dashboard/dashboard_snapshots.js +++ b/test/functional/apps/dashboard/dashboard_snapshots.js @@ -50,7 +50,7 @@ export default function({ getService, getPageObjects, updateBaselines }) { await PageObjects.dashboard.clickNewDashboard(); await PageObjects.timePicker.setLogstashDataRange(); await dashboardAddPanel.addVisualization('Rendering Test: tsvb-ts'); - await PageObjects.common.closeToast(); + await PageObjects.common.closeToastIfExists(); await PageObjects.dashboard.saveDashboard('tsvb'); await PageObjects.dashboard.clickFullScreenMode(); @@ -73,7 +73,7 @@ export default function({ getService, getPageObjects, updateBaselines }) { await PageObjects.dashboard.clickNewDashboard(); await PageObjects.timePicker.setLogstashDataRange(); await dashboardAddPanel.addVisualization('Rendering Test: area with not filter'); - await PageObjects.common.closeToast(); + await PageObjects.common.closeToastIfExists(); await PageObjects.dashboard.saveDashboard('area'); await PageObjects.dashboard.clickFullScreenMode(); diff --git a/test/functional/page_objects/common_page.ts b/test/functional/page_objects/common_page.ts index 9861f9f93f7d9..8edfa8613a31a 100644 --- a/test/functional/page_objects/common_page.ts +++ b/test/functional/page_objects/common_page.ts @@ -429,6 +429,13 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo return title; } + async closeToastIfExists() { + const toastShown = await find.existsByCssSelector('.euiToast'); + if (toastShown) { + await this.closeToast(); + } + } + async clearAllToasts() { const toasts = await find.allByCssSelector('.euiToast'); for (const toastElement of toasts) {