Skip to content

Commit

Permalink
Fix assertions against toasts in Dashboard and Discover functional te…
Browse files Browse the repository at this point in the history
…sts. (#16336)
  • Loading branch information
cjcenizal authored Jan 29, 2018
1 parent ec3485b commit 23bdf47
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
9 changes: 6 additions & 3 deletions test/functional/apps/dashboard/_dashboard_time.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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 () {
Expand All @@ -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 () {
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/dashboard/_view_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
6 changes: 4 additions & 2 deletions test/functional/apps/discover/_shared_links.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/functional/page_objects/discover_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 23bdf47

Please sign in to comment.