From d81a0fc60b22078a742cb2b37a5261278c51c780 Mon Sep 17 00:00:00 2001 From: bhavyarm Date: Mon, 17 Feb 2020 16:20:38 -0500 Subject: [PATCH 1/3] adding comprehensive dashboard tests --- test/accessibility/apps/dashboard.ts | 127 +++++++++++++++++++++++++-- 1 file changed, 120 insertions(+), 7 deletions(-) diff --git a/test/accessibility/apps/dashboard.ts b/test/accessibility/apps/dashboard.ts index 9988e0f72ad3d..862044e285f1f 100644 --- a/test/accessibility/apps/dashboard.ts +++ b/test/accessibility/apps/dashboard.ts @@ -20,27 +20,34 @@ import { FtrProviderContext } from '../ftr_provider_context'; export default function({ getService, getPageObjects }: FtrProviderContext) { - const PageObjects = getPageObjects(['common', 'dashboard', 'header']); + const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'home']); const a11y = getService('a11y'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); + const dashboardPanelActions = getService('dashboardPanelActions'); + const dashboardAddPanel = getService('dashboardAddPanel'); + const testSubjects = getService('testSubjects'); + const listingTable = getService('listingTable'); describe('Dashboard', () => { const dashboardName = 'Dashboard Listing A11y'; + const deletedDashboardName = 'Dashboard Listing A11y Copy'; before(async () => { - await esArchiver.loadIfNeeded('logstash_functional'); - await kibanaServer.uiSettings.update({ - defaultIndex: 'logstash-*', - }); - await PageObjects.common.navigateToApp('dashboard'); + // await esArchiver.loadIfNeeded('logstash_functional'); + // await kibanaServer.uiSettings.update({ + // defaultIndex: 'logstash-*', + // }); + await PageObjects.common.navigateToUrl('home', 'tutorial_directory/sampleData'); + await PageObjects.home.addSampleDataSet('flights'); }); it('dashboard', async () => { + await PageObjects.common.navigateToApp('dashboard'); await a11y.testAppSnapshot(); }); it('create dashboard button', async () => { - await PageObjects.dashboard.clickCreateDashboardPrompt(); + await PageObjects.dashboard.clickNewDashboard(); await a11y.testAppSnapshot(); }); @@ -49,9 +56,115 @@ export default function({ getService, getPageObjects }: FtrProviderContext) { await a11y.testAppSnapshot(); }); + it('Open Edit mode', async () => { + await PageObjects.dashboard.switchToEditMode(); + await a11y.testAppSnapshot(); + }); + + it('Open add panel', async () => { + await dashboardAddPanel.clickOpenAddPanel(); + await a11y.testAppSnapshot(); + }); + + it('add a visualization', async () => { + await testSubjects.click('savedObjectTitle[Flights]-Delay-Buckets'); + await a11y.testAppSnapshot(); + }); + + it('add a saved search', async () => { + await dashboardAddPanel.addSavedSearch('[Flights] Flight Log'); + await a11y.testAppSnapshot(); + }); + + it('save the dashboard', async () => { + await PageObjects.dashboard.saveDashboard(dashboardName); + await a11y.testAppSnapshot(); + }); + + it('Open Edit mode', async () => { + await PageObjects.dashboard.switchToEditMode(); + await a11y.testAppSnapshot(); + }); + + it('open options menu', async () => { + await PageObjects.dashboard.openOptions(); + await a11y.testAppSnapshot(); + }); + + it('Should be able to hide panel titles', async () => { + await testSubjects.click('dashboardPanelTitlesCheckbox'); + await a11y.testAppSnapshot(); + }); + + it('Should be able display panels without margins', async () => { + await testSubjects.click('dashboardMarginsCheckbox'); + await a11y.testAppSnapshot(); + }); + + it('Open add panel', async () => { + await dashboardAddPanel.clickOpenAddPanel(); + await a11y.testAppSnapshot(); + }); + + it('Add one more saved object to cancel it', async () => { + await testSubjects.click('savedObjectTitle[Flights]-Average-Ticket-Price'); + await a11y.testAppSnapshot(); + }); + + it('Close add panel', async () => { + await dashboardAddPanel.closeAddPanel(); + await a11y.testAppSnapshot(); + }); + + it('Exit out of edit mode', async () => { + await PageObjects.dashboard.clickCancelOutOfEditMode(dashboardName); + await a11y.testAppSnapshot(); + }); + + it('Discard changes', async () => { + await PageObjects.common.clickConfirmOnModal(); + await a11y.testAppSnapshot(); + }); + + it('Test full screen', async () => { + await PageObjects.dashboard.clickFullScreenMode(); + await a11y.testAppSnapshot(); + }); + + it('Exit out of full screen mode', async () => { + const logoButton = await PageObjects.dashboard.getExitFullScreenLogoButton(); + await logoButton.moveMouseTo(); + await PageObjects.dashboard.clickExitFullScreenTextButton(); + await a11y.testAppSnapshot(); + }); + + it('Make a clone of the dashboard', async () => { + await PageObjects.dashboard.clickClone(); + await a11y.testAppSnapshot(); + }); + + it('Confirm clone with *copy* appended', async () => { + await PageObjects.dashboard.confirmClone(); + await a11y.testAppSnapshot(); + }); + it('Dashboard listing table', async () => { await PageObjects.dashboard.gotoDashboardLandingPage(); await a11y.testAppSnapshot(); }); + + it('Delete the original', async () => { + await listingTable.searchForItemWithName(dashboardName); + await listingTable.checkListingSelectAllCheckbox(); + await listingTable.clickDeleteSelected(); + await a11y.testAppSnapshot(); + await PageObjects.common.clickConfirmOnModal(); + await a11y.testAppSnapshot(); + }); + + it('Open flight dashboard', async () => { + await testSubjects.click('dashboardListingTitleLink-[Flights]-Global-Flight-Dashboard'); + await a11y.testAppSnapshot(); + }); }); } From 056fb5acff2326323ddb78ea92ab6ee7dc5cee7c Mon Sep 17 00:00:00 2001 From: bhavyarm Date: Wed, 19 Feb 2020 18:11:41 -0500 Subject: [PATCH 2/3] fixing delete and adding dima changes --- test/accessibility/apps/dashboard.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/accessibility/apps/dashboard.ts b/test/accessibility/apps/dashboard.ts index 862044e285f1f..04a85f6fc5132 100644 --- a/test/accessibility/apps/dashboard.ts +++ b/test/accessibility/apps/dashboard.ts @@ -20,18 +20,20 @@ import { FtrProviderContext } from '../ftr_provider_context'; export default function({ getService, getPageObjects }: FtrProviderContext) { - const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'home']); + const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'home', 'settings']); const a11y = getService('a11y'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const dashboardPanelActions = getService('dashboardPanelActions'); const dashboardAddPanel = getService('dashboardAddPanel'); const testSubjects = getService('testSubjects'); + const find = getService('find'); const listingTable = getService('listingTable'); describe('Dashboard', () => { const dashboardName = 'Dashboard Listing A11y'; - const deletedDashboardName = 'Dashboard Listing A11y Copy'; + const clonedDashboardName = 'Dashboard Listing A11y Copy'; + before(async () => { // await esArchiver.loadIfNeeded('logstash_functional'); // await kibanaServer.uiSettings.update({ @@ -153,13 +155,13 @@ export default function({ getService, getPageObjects }: FtrProviderContext) { await a11y.testAppSnapshot(); }); - it('Delete the original', async () => { - await listingTable.searchForItemWithName(dashboardName); + it('Delete a11y clone dashboard', async () => { + await listingTable.searchForItemWithName(clonedDashboardName); await listingTable.checkListingSelectAllCheckbox(); await listingTable.clickDeleteSelected(); await a11y.testAppSnapshot(); await PageObjects.common.clickConfirmOnModal(); - await a11y.testAppSnapshot(); + await listingTable.searchForItemWithName(''); }); it('Open flight dashboard', async () => { From cab78c9b5e8d7836813c51e504dcd281fd4b20b7 Mon Sep 17 00:00:00 2001 From: bhavyarm Date: Fri, 21 Feb 2020 12:53:02 -0500 Subject: [PATCH 3/3] addressing review comments --- test/accessibility/apps/dashboard.ts | 8 +------- test/functional/apps/dashboard/full_screen_mode.js | 4 +--- test/functional/page_objects/dashboard_page.ts | 6 ++++++ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/test/accessibility/apps/dashboard.ts b/test/accessibility/apps/dashboard.ts index 04a85f6fc5132..5eaf719c68a5a 100644 --- a/test/accessibility/apps/dashboard.ts +++ b/test/accessibility/apps/dashboard.ts @@ -35,10 +35,6 @@ export default function({ getService, getPageObjects }: FtrProviderContext) { const clonedDashboardName = 'Dashboard Listing A11y Copy'; before(async () => { - // await esArchiver.loadIfNeeded('logstash_functional'); - // await kibanaServer.uiSettings.update({ - // defaultIndex: 'logstash-*', - // }); await PageObjects.common.navigateToUrl('home', 'tutorial_directory/sampleData'); await PageObjects.home.addSampleDataSet('flights'); }); @@ -134,9 +130,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) { }); it('Exit out of full screen mode', async () => { - const logoButton = await PageObjects.dashboard.getExitFullScreenLogoButton(); - await logoButton.moveMouseTo(); - await PageObjects.dashboard.clickExitFullScreenTextButton(); + await PageObjects.dashboard.exitFullScreenMode(); await a11y.testAppSnapshot(); }); diff --git a/test/functional/apps/dashboard/full_screen_mode.js b/test/functional/apps/dashboard/full_screen_mode.js index 69c0a05b8413b..df00f64530ca0 100644 --- a/test/functional/apps/dashboard/full_screen_mode.js +++ b/test/functional/apps/dashboard/full_screen_mode.js @@ -75,9 +75,7 @@ export default function({ getService, getPageObjects }) { }); it('exits when the text button is clicked on', async () => { - const logoButton = await PageObjects.dashboard.getExitFullScreenLogoButton(); - await logoButton.moveMouseTo(); - await PageObjects.dashboard.clickExitFullScreenTextButton(); + await PageObjects.dashboard.exitFullScreenMode(); await retry.try(async () => { const isChromeVisible = await PageObjects.common.isChromeVisible(); expect(isChromeVisible).to.be(true); diff --git a/test/functional/page_objects/dashboard_page.ts b/test/functional/page_objects/dashboard_page.ts index 3fd7ce27e27d4..887f76bace40d 100644 --- a/test/functional/page_objects/dashboard_page.ts +++ b/test/functional/page_objects/dashboard_page.ts @@ -95,6 +95,12 @@ export function DashboardPageProvider({ getService, getPageObjects }: FtrProvide await this.waitForRenderComplete(); } + public async exitFullScreenMode() { + const logoButton = await this.getExitFullScreenLogoButton(); + await logoButton.moveMouseTo(); + await this.clickExitFullScreenTextButton(); + } + public async getDashboardIdFromCurrentUrl() { const currentUrl = await browser.getCurrentUrl(); const urlSubstring = 'kibana#/dashboard/';