Fix assertions against toasts in Dashboard and Discover functional tests. (#16336) (#16344)

This commit is contained in:
CJ Cenizal 2018-01-28 17:53:26 -08:00 committed by GitHub
parent 7bd9876453
commit ff9caf9675
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 7 deletions

View file

@ -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 () {

View file

@ -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 () {

View file

@ -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);
});
});
});

View file

@ -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');