From 6292f12be6cd52e301cfe92d7a3f32432540534d Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Sun, 28 Jan 2018 11:49:38 -0800 Subject: [PATCH] Fix assertions against toasts in Dashboard and Discover functional tests. --- test/functional/apps/dashboard/_dashboard_time.js | 9 ++++++--- test/functional/apps/dashboard/_view_edit.js | 3 ++- test/functional/apps/discover/_shared_links.js | 6 ++++-- test/functional/page_objects/discover_page.js | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/test/functional/apps/dashboard/_dashboard_time.js b/test/functional/apps/dashboard/_dashboard_time.js index 04fef56e2d9ca..8e17c3896435d 100644 --- a/test/functional/apps/dashboard/_dashboard_time.js +++ b/test/functional/apps/dashboard/_dashboard_time.js @@ -22,7 +22,8 @@ export default function ({ getPageObjects }) { it('is saved', async function () { await PageObjects.dashboard.clickNewDashboard(); await PageObjects.dashboard.addVisualizations([PageObjects.dashboard.getTestVisualizationNames()[0]]); - await PageObjects.dashboard.saveDashboard(dashboardName, { storeTimeWithDashboard: false }); + const isDashboardSaved = await PageObjects.dashboard.saveDashboard(dashboardName, { storeTimeWithDashboard: false }); + expect(isDashboardSaved).to.eql(true); }); it('Does not set the time picker on open', async function () { @@ -41,7 +42,8 @@ export default function ({ getPageObjects }) { it('is saved with quick time', async function () { await PageObjects.dashboard.clickEdit(); await PageObjects.header.setQuickTime('Today'); - await PageObjects.dashboard.saveDashboard(dashboardName, { storeTimeWithDashboard: true }); + const isDashboardSaved = await PageObjects.dashboard.saveDashboard(dashboardName, { storeTimeWithDashboard: true }); + expect(isDashboardSaved).to.eql(true); }); it('sets quick time on open', async function () { @@ -56,7 +58,8 @@ export default function ({ getPageObjects }) { it('is saved with absolute time', async function () { await PageObjects.dashboard.clickEdit(); await PageObjects.header.setAbsoluteRange(fromTime, toTime); - await PageObjects.dashboard.saveDashboard(dashboardName, { storeTimeWithDashboard: true }); + const isDashboardSaved = await PageObjects.dashboard.saveDashboard(dashboardName, { storeTimeWithDashboard: true }); + expect(isDashboardSaved).to.eql(true); }); it('sets absolute time on open', async function () { diff --git a/test/functional/apps/dashboard/_view_edit.js b/test/functional/apps/dashboard/_view_edit.js index 3d95086b469f1..1cd910f89bfaf 100644 --- a/test/functional/apps/dashboard/_view_edit.js +++ b/test/functional/apps/dashboard/_view_edit.js @@ -29,7 +29,8 @@ export default function ({ getService, getPageObjects }) { await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.clickNewDashboard(); await PageObjects.dashboard.addVisualizations(PageObjects.dashboard.getTestVisualizationNames()); - await PageObjects.dashboard.saveDashboard(dashboardName); + const isDashboardSaved = await PageObjects.dashboard.saveDashboard(dashboardName); + expect(isDashboardSaved).to.eql(true); }); it('existing dashboard opens in view mode', async function () { diff --git a/test/functional/apps/discover/_shared_links.js b/test/functional/apps/discover/_shared_links.js index 2c00ced30194d..d63edcc5544b6 100644 --- a/test/functional/apps/discover/_shared_links.js +++ b/test/functional/apps/discover/_shared_links.js @@ -79,7 +79,8 @@ export default function ({ getService, getPageObjects }) { }); it('gets copied to clipboard', async function () { - return await PageObjects.discover.clickCopyToClipboard(); + const isCopiedToClipboard = await PageObjects.discover.clickCopyToClipboard(); + expect(isCopiedToClipboard).to.eql(true); }); // TODO: verify clipboard contents @@ -98,7 +99,8 @@ export default function ({ getService, getPageObjects }) { // NOTE: This test has to run immediately after the test above it('copies short URL to clipboard', async function () { - return await PageObjects.discover.clickCopyToClipboard(); + const isCopiedToClipboard = await PageObjects.discover.clickCopyToClipboard(); + expect(isCopiedToClipboard).to.eql(true); }); }); }); diff --git a/test/functional/page_objects/discover_page.js b/test/functional/page_objects/discover_page.js index c6c71d4d35982..8e70d5abd5457 100644 --- a/test/functional/page_objects/discover_page.js +++ b/test/functional/page_objects/discover_page.js @@ -201,7 +201,7 @@ export function DiscoverPageProvider({ getService, getPageObjects }) { } async clickCopyToClipboard() { - testSubjects.click('sharedSnapshotCopyButton'); + await testSubjects.click('sharedSnapshotCopyButton'); // Confirm that the content was copied to the clipboard. return await testSubjects.exists('shareCopyToClipboardSuccess');