diff --git a/test/functional/apps/visualize/_area_chart.js b/test/functional/apps/visualize/_area_chart.js index 685894bf31958..0b5d86159af3d 100644 --- a/test/functional/apps/visualize/_area_chart.js +++ b/test/functional/apps/visualize/_area_chart.js @@ -59,7 +59,6 @@ export default function ({ getService, getPageObjects }) { it('should save and load with special characters', async function () { const vizNamewithSpecialChars = vizName1 + '/?&=%'; await PageObjects.visualize.saveVisualizationExpectSuccessAndBreadcrumb(vizNamewithSpecialChars); - await PageObjects.visualize.waitForVisualizationSavedToastGone(); }); it('should save and load with non-ascii characters', async function () { @@ -69,7 +68,6 @@ export default function ({ getService, getPageObjects }) { it('should save and load', async function () { await PageObjects.visualize.saveVisualizationExpectSuccessAndBreadcrumb(vizName1); - await PageObjects.visualize.waitForVisualizationSavedToastGone(); await PageObjects.visualize.loadSavedVisualization(vizName1); await PageObjects.visualize.waitForVisualization(); }); diff --git a/test/functional/apps/visualize/_data_table.js b/test/functional/apps/visualize/_data_table.js index b540c1e949fbc..138631be05bb0 100644 --- a/test/functional/apps/visualize/_data_table.js +++ b/test/functional/apps/visualize/_data_table.js @@ -67,7 +67,7 @@ export default function ({ getService, getPageObjects }) { it('should be able to save and load', async function () { await PageObjects.visualize.saveVisualizationExpectSuccessAndBreadcrumb(vizName1); - await PageObjects.visualize.waitForVisualizationSavedToastGone(); + await PageObjects.visualize.loadSavedVisualization(vizName1); await PageObjects.visualize.waitForVisualization(); }); @@ -129,7 +129,7 @@ export default function ({ getService, getPageObjects }) { // check that it works after a save and reload const SAVE_NAME = 'viz w/ percents'; await PageObjects.visualize.saveVisualizationExpectSuccessAndBreadcrumb(SAVE_NAME); - await PageObjects.visualize.waitForVisualizationSavedToastGone(); + await PageObjects.visualize.loadSavedVisualization(SAVE_NAME); await PageObjects.visualize.waitForVisualization(); diff --git a/test/functional/apps/visualize/_data_table_nontimeindex.js b/test/functional/apps/visualize/_data_table_nontimeindex.js index 6cc0962140329..f55c88cb3a486 100644 --- a/test/functional/apps/visualize/_data_table_nontimeindex.js +++ b/test/functional/apps/visualize/_data_table_nontimeindex.js @@ -64,7 +64,7 @@ export default function ({ getService, getPageObjects }) { it('should be able to save and load', async function () { await PageObjects.visualize.saveVisualizationExpectSuccessAndBreadcrumb(vizName1); - await PageObjects.visualize.waitForVisualizationSavedToastGone(); + await PageObjects.visualize.loadSavedVisualization(vizName1); await PageObjects.visualize.waitForVisualization(); }); diff --git a/test/functional/apps/visualize/_heatmap_chart.js b/test/functional/apps/visualize/_heatmap_chart.js index ac48f78b5dde7..9d1f436cf6982 100644 --- a/test/functional/apps/visualize/_heatmap_chart.js +++ b/test/functional/apps/visualize/_heatmap_chart.js @@ -49,7 +49,7 @@ export default function ({ getService, getPageObjects }) { it('should save and load', async function () { await PageObjects.visualize.saveVisualizationExpectSuccessAndBreadcrumb(vizName1); - await PageObjects.visualize.waitForVisualizationSavedToastGone(); + await PageObjects.visualize.loadSavedVisualization(vizName1); await PageObjects.visualize.waitForVisualization(); }); diff --git a/test/functional/apps/visualize/_line_chart.js b/test/functional/apps/visualize/_line_chart.js index 29116b0ca56c4..02442533c1b6c 100644 --- a/test/functional/apps/visualize/_line_chart.js +++ b/test/functional/apps/visualize/_line_chart.js @@ -142,7 +142,7 @@ export default function ({ getService, getPageObjects }) { it('should be able to save and load', async function () { await PageObjects.visualize.saveVisualizationExpectSuccessAndBreadcrumb(vizName1); - await PageObjects.visualize.waitForVisualizationSavedToastGone(); + await PageObjects.visualize.loadSavedVisualization(vizName1); await PageObjects.visualize.waitForVisualization(); }); diff --git a/test/functional/apps/visualize/_pie_chart.js b/test/functional/apps/visualize/_pie_chart.js index b9c10aaf578bf..157d862993dec 100644 --- a/test/functional/apps/visualize/_pie_chart.js +++ b/test/functional/apps/visualize/_pie_chart.js @@ -53,7 +53,7 @@ export default function ({ getService, getPageObjects }) { it('should save and load', async function () { await PageObjects.visualize.saveVisualizationExpectSuccessAndBreadcrumb(vizName1); - await PageObjects.visualize.waitForVisualizationSavedToastGone(); + await PageObjects.visualize.loadSavedVisualization(vizName1); await PageObjects.visualize.waitForVisualization(); }); @@ -158,7 +158,7 @@ export default function ({ getService, getPageObjects }) { it('should correctly save disabled agg', async () => { await PageObjects.visualize.saveVisualizationExpectSuccessAndBreadcrumb(vizName1); - await PageObjects.visualize.waitForVisualizationSavedToastGone(); + await PageObjects.visualize.loadSavedVisualization(vizName1); await PageObjects.visualize.waitForRenderingCount(); diff --git a/test/functional/apps/visualize/_tag_cloud.js b/test/functional/apps/visualize/_tag_cloud.js index 4ed95214550c1..4a07bb242fd79 100644 --- a/test/functional/apps/visualize/_tag_cloud.js +++ b/test/functional/apps/visualize/_tag_cloud.js @@ -98,7 +98,7 @@ export default function ({ getService, getPageObjects }) { it('should save and load', async function () { await PageObjects.visualize.saveVisualizationExpectSuccessAndBreadcrumb(vizName1); - await PageObjects.visualize.waitForVisualizationSavedToastGone(); + await PageObjects.visualize.loadSavedVisualization(vizName1); await PageObjects.visualize.waitForVisualization(); }); diff --git a/test/functional/apps/visualize/_vertical_bar_chart.js b/test/functional/apps/visualize/_vertical_bar_chart.js index 08bd6b819ab88..73a70107d9069 100644 --- a/test/functional/apps/visualize/_vertical_bar_chart.js +++ b/test/functional/apps/visualize/_vertical_bar_chart.js @@ -53,7 +53,7 @@ export default function ({ getService, getPageObjects }) { it('should save and load', async function () { await PageObjects.visualize.saveVisualizationExpectSuccessAndBreadcrumb(vizName1); - await PageObjects.visualize.waitForVisualizationSavedToastGone(); + await PageObjects.visualize.loadSavedVisualization(vizName1); await PageObjects.visualize.waitForVisualization(); }); diff --git a/test/functional/apps/visualize/_vertical_bar_chart_nontimeindex.js b/test/functional/apps/visualize/_vertical_bar_chart_nontimeindex.js index a884f82376493..712963f07b877 100644 --- a/test/functional/apps/visualize/_vertical_bar_chart_nontimeindex.js +++ b/test/functional/apps/visualize/_vertical_bar_chart_nontimeindex.js @@ -50,7 +50,7 @@ export default function ({ getService, getPageObjects }) { it('should save and load', async function () { await PageObjects.visualize.saveVisualizationExpectSuccessAndBreadcrumb(vizName1); - await PageObjects.visualize.waitForVisualizationSavedToastGone(); + await PageObjects.visualize.loadSavedVisualization(vizName1); await PageObjects.visualize.waitForVisualization(); }); diff --git a/test/functional/page_objects/common_page.ts b/test/functional/page_objects/common_page.ts index 19a7bd25db9c6..0e9a64e736999 100644 --- a/test/functional/page_objects/common_page.ts +++ b/test/functional/page_objects/common_page.ts @@ -409,6 +409,14 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo }); return response.status !== 200; } + async waitForSaveModalToClose() { + log.debug('Waiting for save modal to close'); + await retry.try(async () => { + if (await testSubjects.exists('savedObjectSaveModal')) { + throw new Error('save modal still open'); + } + }); + } } return new CommonPage(); diff --git a/test/functional/page_objects/dashboard_page.js b/test/functional/page_objects/dashboard_page.js index 55143643f31f0..3ec51072bc617 100644 --- a/test/functional/page_objects/dashboard_page.js +++ b/test/functional/page_objects/dashboard_page.js @@ -326,20 +326,11 @@ export function DashboardPageProvider({ getService, getPageObjects }) { await testSubjects.existOrFail('saveDashboardSuccess'); const message = await PageObjects.common.closeToast(); await PageObjects.header.waitUntilLoadingHasFinished(); - await this.waitForSaveModalToClose(); + await PageObjects.common.waitForSaveModalToClose(); return message; } - async waitForSaveModalToClose() { - log.debug('Waiting for dashboard save modal to close'); - await retry.try(async () => { - if (await testSubjects.exists('savedObjectSaveModal')) { - throw new Error('dashboard save still open'); - } - }); - } - async deleteDashboard(dashboardName, dashboardId) { await this.gotoDashboardLandingPage(); await this.searchForDashboardWithName(dashboardName); diff --git a/test/functional/page_objects/visualize_page.js b/test/functional/page_objects/visualize_page.js index 67494f201adae..65b792f4b094b 100644 --- a/test/functional/page_objects/visualize_page.js +++ b/test/functional/page_objects/visualize_page.js @@ -734,19 +734,23 @@ export function VisualizePageProvider({ getService, getPageObjects, updateBaseli await testSubjects.click('saveAsNewCheckbox'); } log.debug('Click Save Visualization button'); + await testSubjects.click('confirmSaveSavedObjectButton'); - // if we wait for this, the success toast message could be gone :-() - // wait for save to complete before completion - // await PageObjects.header.waitUntilLoadingHasFinished(); + // Confirm that the Visualization has actually been saved + await testSubjects.existOrFail('saveVisualizationSuccess'); + const message = await PageObjects.common.closeToast(); + await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.common.waitForSaveModalToClose(); + + return message; } async saveVisualizationExpectSuccess(vizName, { saveAsNew = false } = {}) { - await this.saveVisualization(vizName, { saveAsNew }); - const successToast = await testSubjects.exists('saveVisualizationSuccess', { - timeout: 2 * defaultFindTimeout - }); - expect(successToast).to.be(true); + const saveMessage = await this.saveVisualization(vizName, { saveAsNew }); + if (!saveMessage) { + throw new Error(`Expected saveVisualization to respond with the saveMessage from the toast, got ${saveMessage}`); + } } async saveVisualizationExpectSuccessAndBreadcrumb(vizName, { saveAsNew = false } = {}) { diff --git a/x-pack/test/functional/apps/graph/graph.ts b/x-pack/test/functional/apps/graph/graph.ts index f640a34b36ddf..58ee1668df701 100644 --- a/x-pack/test/functional/apps/graph/graph.ts +++ b/x-pack/test/functional/apps/graph/graph.ts @@ -82,9 +82,11 @@ export default function({ getService, getPageObjects }: FtrProviderContext) { const { nodes } = await PageObjects.graph.getGraphObjects(); const circlesText = nodes.map(({ label }) => label); expect(circlesText.length).to.equal(expectedNodes.length); - circlesText.forEach(circleText => { - expect(expectedNodes.includes(circleText)).to.be(true); - }); + const unexpectedCircleTexts = circlesText.filter(t => !expectedNodes.includes(t)); + + if (unexpectedCircleTexts.length) { + throw new Error(`Find unexpected circle texts: ${unexpectedCircleTexts}`); + } }); it('should show correct connections', async function() {