From 5e4acf43222f95ac6e5b642a37041cf2f4ef768a Mon Sep 17 00:00:00 2001 From: Catherine Liu Date: Thu, 29 Apr 2021 12:56:58 -0700 Subject: [PATCH] Fixed dashboard_save functional test --- test/functional/apps/dashboard/dashboard_save.ts | 9 ++++++--- test/functional/page_objects/dashboard_page.ts | 10 ++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/test/functional/apps/dashboard/dashboard_save.ts b/test/functional/apps/dashboard/dashboard_save.ts index 0a0a2fc1dd286..dce59744db305 100644 --- a/test/functional/apps/dashboard/dashboard_save.ts +++ b/test/functional/apps/dashboard/dashboard_save.ts @@ -9,12 +9,12 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { - const PageObjects = getPageObjects(['dashboard', 'header']); + const PageObjects = getPageObjects(['dashboard', 'header', 'visualize']); const listingTable = getService('listingTable'); const testSubjects = getService('testSubjects'); + const dashboardAddPanel = getService('dashboardAddPanel'); - // FLAKY: https://github.com/elastic/kibana/issues/89476 - describe.skip('dashboard save', function describeIndexTests() { + describe('dashboard save', function describeIndexTests() { this.tags('includeFirefox'); const dashboardName = 'Dashboard Save Test'; const dashboardNameEnterKey = 'Dashboard Save Test with Enter Key'; @@ -127,6 +127,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.dashboard.switchToEditMode(); await PageObjects.dashboard.expectExistsQuickSaveOption(); + await dashboardAddPanel.clickMarkdownQuickButton(); + await PageObjects.visualize.saveVisualizationAndReturn(); + await PageObjects.dashboard.waitForRenderComplete(); await PageObjects.dashboard.clickQuickSave(); await testSubjects.existOrFail('saveDashboardSuccess'); diff --git a/test/functional/page_objects/dashboard_page.ts b/test/functional/page_objects/dashboard_page.ts index b0610b36eb65f..49ceede601932 100644 --- a/test/functional/page_objects/dashboard_page.ts +++ b/test/functional/page_objects/dashboard_page.ts @@ -271,6 +271,7 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide } public async clickQuickSave() { + await this.expectQuickSaveButtonEnabled(); log.debug('clickQuickSave'); await testSubjects.click('dashboardQuickSaveMenuItem'); } @@ -624,6 +625,15 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide await testSubjects.existOrFail('dashboardQuickSaveMenuItem'); } + public async expectQuickSaveButtonEnabled() { + log.debug('expectQuickSaveButtonEnabled'); + const quickSaveButton = await testSubjects.find('dashboardQuickSaveMenuItem'); + const isDisabled = await quickSaveButton.getAttribute('disabled'); + if (isDisabled) { + throw new Error('Quick save button disabled'); + } + } + public async getNotLoadedVisualizations(vizList: string[]) { const checkList = []; for (const name of vizList) {