diff --git a/test/functional/apps/dashboard/copy_panel_to.ts b/test/functional/apps/dashboard/copy_panel_to.ts index 9abdc2ceffc01..cb19b2d9e2847 100644 --- a/test/functional/apps/dashboard/copy_panel_to.ts +++ b/test/functional/apps/dashboard/copy_panel_to.ts @@ -1,126 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const dashboardVisualizations = getService('dashboardVisualizations'); - const dashboardPanelActions = getService('dashboardPanelActions'); - const testSubjects = getService('testSubjects'); - const kibanaServer = getService('kibanaServer'); - const esArchiver = getService('esArchiver'); - const find = getService('find'); - - const PageObjects = getPageObjects([ - 'header', - 'common', - 'discover', - 'dashboard', - 'visualize', - 'timePicker', - ]); - - const fewPanelsTitle = 'few panels'; - const markdownTitle = 'Copy To Markdown'; - let fewPanelsPanelCount = 0; - - const openCopyToModal = async (panelName: string) => { - await dashboardPanelActions.openCopyToModalByTitle(panelName); - const modalIsOpened = await testSubjects.exists('copyToDashboardPanel'); - expect(modalIsOpened).to.be(true); - const hasDashboardSelector = await testSubjects.exists('add-to-dashboard-options'); - expect(hasDashboardSelector).to.be(true); - }; - - describe('dashboard panel copy to', function viewEditModeTests() { - before(async function () { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.loadSavedDashboard(fewPanelsTitle); - await PageObjects.dashboard.waitForRenderComplete(); - fewPanelsPanelCount = await PageObjects.dashboard.getPanelCount(); - - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.dashboard.clickNewDashboard(); - await PageObjects.timePicker.setHistoricalDataRange(); - await dashboardVisualizations.createAndAddMarkdown({ - name: markdownTitle, - markdown: 'Please add me to some other dashboard', - }); - }); - - after(async function () { - await PageObjects.dashboard.gotoDashboardLandingPage(); - }); - - it('does not show the new dashboard option when on a new dashboard', async () => { - await openCopyToModal(markdownTitle); - const dashboardSelector = await testSubjects.find('add-to-dashboard-options'); - const isDisabled = await dashboardSelector.findByCssSelector( - `input[id="new-dashboard-option"]:disabled` - ); - expect(isDisabled).not.to.be(null); - - await testSubjects.click('cancelCopyToButton'); - }); - - it('copies a panel to an existing dashboard', async () => { - await openCopyToModal(markdownTitle); - const dashboardSelector = await testSubjects.find('add-to-dashboard-options'); - const label = await dashboardSelector.findByCssSelector( - `label[for="existing-dashboard-option"]` - ); - await label.click(); - - await testSubjects.setValue('dashboardPickerInput', fewPanelsTitle); - await testSubjects.existOrFail(`dashboard-picker-option-few-panels`); - await find.clickByButtonText(fewPanelsTitle); - await testSubjects.click('confirmCopyToButton'); - - await PageObjects.dashboard.waitForRenderComplete(); - await PageObjects.dashboard.expectOnDashboard(`Editing ${fewPanelsTitle}`); - const newPanelCount = await PageObjects.dashboard.getPanelCount(); - expect(newPanelCount).to.be(fewPanelsPanelCount + 1); - }); - - it('does not show the current dashboard in the dashboard picker', async () => { - await openCopyToModal(markdownTitle); - const dashboardSelector = await testSubjects.find('add-to-dashboard-options'); - const label = await dashboardSelector.findByCssSelector( - `label[for="existing-dashboard-option"]` - ); - await label.click(); - - await testSubjects.setValue('dashboardPickerInput', fewPanelsTitle); - await testSubjects.missingOrFail(`dashboard-picker-option-few-panels`); - - await testSubjects.click('cancelCopyToButton'); - }); - - it('copies a panel to a new dashboard', async () => { - await openCopyToModal(markdownTitle); - const dashboardSelector = await testSubjects.find('add-to-dashboard-options'); - const label = await dashboardSelector.findByCssSelector(`label[for="new-dashboard-option"]`); - await label.click(); - await testSubjects.click('confirmCopyToButton'); - - await PageObjects.dashboard.waitForRenderComplete(); - await PageObjects.dashboard.expectOnDashboard(`Editing New Dashboard`); - }); - - it('it always appends new panels instead of overwriting', async () => { - const newPanelCount = await PageObjects.dashboard.getPanelCount(); - expect(newPanelCount).to.be(2); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const dashboardVisualizations = getService('dashboardVisualizations'); const dashboardPanelActions = getService('dashboardPanelActions'); const testSubjects = getService('testSubjects'); const kibanaServer = getService('kibanaServer'); const esArchiver = getService('esArchiver'); const find = getService('find'); const PageObjects = getPageObjects([ 'header', 'common', 'discover', 'dashboard', 'visualize', 'timePicker', ]); const fewPanelsTitle = 'few panels'; const markdownTitle = 'Copy To Markdown'; let fewPanelsPanelCount = 0; const openCopyToModal = async (panelName: string) => { await dashboardPanelActions.openCopyToModalByTitle(panelName); const modalIsOpened = await testSubjects.exists('copyToDashboardPanel'); expect(modalIsOpened).to.be(true); const hasDashboardSelector = await testSubjects.exists('add-to-dashboard-options'); expect(hasDashboardSelector).to.be(true); }; describe('dashboard panel copy to', function viewEditModeTests() { before(async function () { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.loadSavedDashboard(fewPanelsTitle); await PageObjects.dashboard.waitForRenderComplete(); fewPanelsPanelCount = await PageObjects.dashboard.getPanelCount(); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.clickNewDashboard(); await PageObjects.timePicker.setHistoricalDataRange(); await dashboardVisualizations.createAndAddMarkdown({ name: markdownTitle, markdown: 'Please add me to some other dashboard', }); }); after(async function () { await PageObjects.dashboard.gotoDashboardLandingPage(); }); it('does not show the new dashboard option when on a new dashboard', async () => { await openCopyToModal(markdownTitle); const dashboardSelector = await testSubjects.find('add-to-dashboard-options'); const isDisabled = await dashboardSelector.findByCssSelector( `input[id="new-dashboard-option"]:disabled` ); expect(isDisabled).not.to.be(null); await testSubjects.click('cancelCopyToButton'); }); it('copies a panel to an existing dashboard', async () => { await openCopyToModal(markdownTitle); const dashboardSelector = await testSubjects.find('add-to-dashboard-options'); const label = await dashboardSelector.findByCssSelector( `label[for="existing-dashboard-option"]` ); await label.click(); await testSubjects.setValue('dashboardPickerInput', fewPanelsTitle); await testSubjects.existOrFail(`dashboard-picker-option-few-panels`); await find.clickByButtonText(fewPanelsTitle); await testSubjects.click('confirmCopyToButton'); await PageObjects.dashboard.waitForRenderComplete(); await PageObjects.dashboard.expectOnDashboard(`Editing ${fewPanelsTitle}`); const newPanelCount = await PageObjects.dashboard.getPanelCount(); expect(newPanelCount).to.be(fewPanelsPanelCount + 1); }); it('does not show the current dashboard in the dashboard picker', async () => { await openCopyToModal(markdownTitle); const dashboardSelector = await testSubjects.find('add-to-dashboard-options'); const label = await dashboardSelector.findByCssSelector( `label[for="existing-dashboard-option"]` ); await label.click(); await testSubjects.setValue('dashboardPickerInput', fewPanelsTitle); await testSubjects.missingOrFail(`dashboard-picker-option-few-panels`); await testSubjects.click('cancelCopyToButton'); }); it('copies a panel to a new dashboard', async () => { await openCopyToModal(markdownTitle); const dashboardSelector = await testSubjects.find('add-to-dashboard-options'); const label = await dashboardSelector.findByCssSelector(`label[for="new-dashboard-option"]`); await label.click(); await testSubjects.click('confirmCopyToButton'); await PageObjects.dashboard.waitForRenderComplete(); await PageObjects.dashboard.expectOnDashboard(`Editing New Dashboard`); }); it('it always appends new panels instead of overwriting', async () => { const newPanelCount = await PageObjects.dashboard.getPanelCount(); expect(newPanelCount).to.be(2); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/create_and_add_embeddables.ts b/test/functional/apps/dashboard/create_and_add_embeddables.ts index f4ee4e9904768..711768017f1f8 100644 --- a/test/functional/apps/dashboard/create_and_add_embeddables.ts +++ b/test/functional/apps/dashboard/create_and_add_embeddables.ts @@ -1,119 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { VisualizeConstants } from '../../../../src/plugins/visualize/public/application/visualize_constants'; -import { VISUALIZE_ENABLE_LABS_SETTING } from '../../../../src/plugins/visualizations/common/constants'; -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const retry = getService('retry'); - const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']); - const browser = getService('browser'); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const dashboardAddPanel = getService('dashboardAddPanel'); - - describe('create and add embeddables', () => { - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.loadSavedDashboard('few panels'); - }); - - describe('add new visualization link', () => { - it('adds new visualization via the top nav link', async () => { - const originalPanelCount = await PageObjects.dashboard.getPanelCount(); - await PageObjects.dashboard.switchToEditMode(); - await dashboardAddPanel.clickCreateNewLink(); - await PageObjects.visualize.clickAggBasedVisualizations(); - await PageObjects.visualize.clickAreaChart(); - await PageObjects.visualize.clickNewSearch(); - await PageObjects.visualize.saveVisualizationExpectSuccess( - 'visualization from top nav add new panel', - { redirectToOrigin: true } - ); - await retry.try(async () => { - const panelCount = await PageObjects.dashboard.getPanelCount(); - expect(panelCount).to.eql(originalPanelCount + 1); - }); - await PageObjects.dashboard.waitForRenderComplete(); - }); - - it('adds a new visualization', async () => { - const originalPanelCount = await PageObjects.dashboard.getPanelCount(); - await dashboardAddPanel.ensureAddPanelIsShowing(); - await dashboardAddPanel.clickAddNewEmbeddableLink('visualization'); - await PageObjects.visualize.clickAggBasedVisualizations(); - await PageObjects.visualize.clickAreaChart(); - await PageObjects.visualize.clickNewSearch(); - await PageObjects.visualize.saveVisualizationExpectSuccess( - 'visualization from add new link', - { redirectToOrigin: true } - ); - - await retry.try(async () => { - const panelCount = await PageObjects.dashboard.getPanelCount(); - expect(panelCount).to.eql(originalPanelCount + 1); - }); - await PageObjects.dashboard.waitForRenderComplete(); - }); - - it('saves the listing page instead of the visualization to the app link', async () => { - await PageObjects.header.clickVisualize(true); - const currentUrl = await browser.getCurrentUrl(); - expect(currentUrl).not.to.contain(VisualizeConstants.EDIT_PATH); - }); - - after(async () => { - await PageObjects.header.clickDashboard(); - }); - }); - - describe('visualize:enableLabs advanced setting', () => { - const LAB_VIS_NAME = 'Rendering Test: input control'; - - it('should display lab visualizations in add panel', async () => { - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.clickNewDashboard(); - const exists = await dashboardAddPanel.panelAddLinkExists(LAB_VIS_NAME); - await dashboardAddPanel.closeAddPanel(); - expect(exists).to.be(true); - }); - - describe('is false', () => { - before(async () => { - await PageObjects.header.clickStackManagement(); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.toggleAdvancedSettingCheckbox(VISUALIZE_ENABLE_LABS_SETTING); - }); - - it('should not display lab visualizations in add panel', async () => { - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.clickNewDashboard(); - - const exists = await dashboardAddPanel.panelAddLinkExists(LAB_VIS_NAME); - await dashboardAddPanel.closeAddPanel(); - expect(exists).to.be(false); - }); - - after(async () => { - await PageObjects.header.clickStackManagement(); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.clearAdvancedSettings(VISUALIZE_ENABLE_LABS_SETTING); - await PageObjects.header.clickDashboard(); - }); - }); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { VisualizeConstants } from '../../../../src/plugins/visualize/public/application/visualize_constants'; import { VISUALIZE_ENABLE_LABS_SETTING } from '../../../../src/plugins/visualizations/common/constants'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const retry = getService('retry'); const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']); const browser = getService('browser'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const dashboardAddPanel = getService('dashboardAddPanel'); describe('create and add embeddables', () => { before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.loadSavedDashboard('few panels'); }); describe('add new visualization link', () => { it('adds new visualization via the top nav link', async () => { const originalPanelCount = await PageObjects.dashboard.getPanelCount(); await PageObjects.dashboard.switchToEditMode(); await dashboardAddPanel.clickCreateNewLink(); await PageObjects.visualize.clickAggBasedVisualizations(); await PageObjects.visualize.clickAreaChart(); await PageObjects.visualize.clickNewSearch(); await PageObjects.visualize.saveVisualizationExpectSuccess( 'visualization from top nav add new panel', { redirectToOrigin: true } ); await retry.try(async () => { const panelCount = await PageObjects.dashboard.getPanelCount(); expect(panelCount).to.eql(originalPanelCount + 1); }); await PageObjects.dashboard.waitForRenderComplete(); }); it('adds a new visualization', async () => { const originalPanelCount = await PageObjects.dashboard.getPanelCount(); await dashboardAddPanel.ensureAddPanelIsShowing(); await dashboardAddPanel.clickAddNewEmbeddableLink('visualization'); await PageObjects.visualize.clickAggBasedVisualizations(); await PageObjects.visualize.clickAreaChart(); await PageObjects.visualize.clickNewSearch(); await PageObjects.visualize.saveVisualizationExpectSuccess( 'visualization from add new link', { redirectToOrigin: true } ); await retry.try(async () => { const panelCount = await PageObjects.dashboard.getPanelCount(); expect(panelCount).to.eql(originalPanelCount + 1); }); await PageObjects.dashboard.waitForRenderComplete(); }); it('saves the listing page instead of the visualization to the app link', async () => { await PageObjects.header.clickVisualize(true); const currentUrl = await browser.getCurrentUrl(); expect(currentUrl).not.to.contain(VisualizeConstants.EDIT_PATH); }); after(async () => { await PageObjects.header.clickDashboard(); }); }); describe('visualize:enableLabs advanced setting', () => { const LAB_VIS_NAME = 'Rendering Test: input control'; it('should display lab visualizations in add panel', async () => { await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.clickNewDashboard(); const exists = await dashboardAddPanel.panelAddLinkExists(LAB_VIS_NAME); await dashboardAddPanel.closeAddPanel(); expect(exists).to.be(true); }); describe('is false', () => { before(async () => { await PageObjects.header.clickStackManagement(); await PageObjects.settings.clickKibanaSettings(); await PageObjects.settings.toggleAdvancedSettingCheckbox(VISUALIZE_ENABLE_LABS_SETTING); }); it('should not display lab visualizations in add panel', async () => { await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.clickNewDashboard(); const exists = await dashboardAddPanel.panelAddLinkExists(LAB_VIS_NAME); await dashboardAddPanel.closeAddPanel(); expect(exists).to.be(false); }); after(async () => { await PageObjects.header.clickStackManagement(); await PageObjects.settings.clickKibanaSettings(); await PageObjects.settings.clearAdvancedSettings(VISUALIZE_ENABLE_LABS_SETTING); await PageObjects.header.clickDashboard(); }); }); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/dashboard_filter_bar.ts b/test/functional/apps/dashboard/dashboard_filter_bar.ts index cb2b4a1792a47..0facfcef2296d 100644 --- a/test/functional/apps/dashboard/dashboard_filter_bar.ts +++ b/test/functional/apps/dashboard/dashboard_filter_bar.ts @@ -1,220 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const dashboardExpect = getService('dashboardExpect'); - const dashboardAddPanel = getService('dashboardAddPanel'); - const testSubjects = getService('testSubjects'); - const filterBar = getService('filterBar'); - const pieChart = getService('pieChart'); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const browser = getService('browser'); - const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize', 'timePicker']); - - describe('dashboard filter bar', () => { - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - }); - - describe('Add a filter bar', function () { - before(async () => { - await PageObjects.dashboard.gotoDashboardLandingPage(); - }); - - it('should show on an empty dashboard', async function () { - await PageObjects.dashboard.clickNewDashboard(); - const hasAddFilter = await testSubjects.exists('addFilter'); - expect(hasAddFilter).to.be(true); - }); - - it('should continue to show for visualizations with no search source', async () => { - await dashboardAddPanel.addVisualization('Rendering-Test:-input-control'); - const hasAddFilter = await testSubjects.exists('addFilter'); - expect(hasAddFilter).to.be(true); - }); - }); - - describe('filter editor field list', function () { - this.tags(['skipFirefox']); - - before(async () => { - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.dashboard.clickNewDashboard(); - }); - - it('uses default index pattern on an empty dashboard', async () => { - await testSubjects.click('addFilter'); - await dashboardExpect.fieldSuggestions(['agent']); - await filterBar.ensureFieldEditorModalIsClosed(); - }); - - it('shows index pattern of vis when one is added', async () => { - await dashboardAddPanel.addVisualization('Rendering-Test:-animal-sounds-pie'); - await PageObjects.header.waitUntilLoadingHasFinished(); - await filterBar.ensureFieldEditorModalIsClosed(); - await testSubjects.click('addFilter'); - await dashboardExpect.fieldSuggestions(['animal']); - await filterBar.ensureFieldEditorModalIsClosed(); - }); - - it('works when a vis with no index pattern is added', async () => { - await dashboardAddPanel.addVisualization('Rendering-Test:-markdown'); - await PageObjects.header.waitUntilLoadingHasFinished(); - await filterBar.ensureFieldEditorModalIsClosed(); - await testSubjects.click('addFilter'); - await dashboardExpect.fieldSuggestions(['animal']); - }); - }); - - describe('filter pills', function () { - before(async () => { - await filterBar.ensureFieldEditorModalIsClosed(); - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.dashboard.clickNewDashboard(); - await PageObjects.timePicker.setDefaultDataRange(); - }); - - it('are not selected by default', async function () { - const filterCount = await filterBar.getFilterCount(); - expect(filterCount).to.equal(0); - }); - - it('are added when a pie chart slice is clicked', async function () { - await dashboardAddPanel.addVisualization('Rendering Test: pie'); - await PageObjects.dashboard.waitForRenderComplete(); - await pieChart.filterOnPieSlice('4,886'); - const filterCount = await filterBar.getFilterCount(); - expect(filterCount).to.equal(1); - - await pieChart.expectPieSliceCount(1); - }); - - it('are preserved after saving a dashboard', async () => { - await PageObjects.dashboard.saveDashboard('with filters'); - await PageObjects.header.waitUntilLoadingHasFinished(); - - const filterCount = await filterBar.getFilterCount(); - expect(filterCount).to.equal(1); - - await pieChart.expectPieSliceCount(1); - }); - - it('are preserved after opening a dashboard saved with filters', async () => { - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.dashboard.loadSavedDashboard('with filters'); - await PageObjects.header.waitUntilLoadingHasFinished(); - - const filterCount = await filterBar.getFilterCount(); - expect(filterCount).to.equal(1); - await pieChart.expectPieSliceCount(1); - }); - - it("restoring filters doesn't break back button", async () => { - await browser.goBack(); - await PageObjects.dashboard.expectExistsDashboardLandingPage(); - await browser.goForward(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.waitForRenderComplete(); - await pieChart.expectPieSliceCount(1); - }); - - it("saving with pinned filter doesn't unpin them", async () => { - const filterKey = 'bytes'; - await filterBar.toggleFilterPinned(filterKey); - await PageObjects.dashboard.switchToEditMode(); - await PageObjects.dashboard.saveDashboard('saved with pinned filters', { - saveAsNew: true, - }); - expect(await filterBar.isFilterPinned(filterKey)).to.be(true); - await pieChart.expectPieSliceCount(1); - }); - - it("navigating to a dashboard with global filter doesn't unpin it if same filter is saved with dashboard", async () => { - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.dashboard.loadSavedDashboard('with filters'); - await PageObjects.header.waitUntilLoadingHasFinished(); - expect(await filterBar.isFilterPinned('bytes')).to.be(true); - await pieChart.expectPieSliceCount(1); - }); - - it("pinned filters aren't saved", async () => { - await filterBar.removeFilter('bytes'); - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.dashboard.loadSavedDashboard('saved with pinned filters'); - await PageObjects.header.waitUntilLoadingHasFinished(); - expect(await filterBar.getFilterCount()).to.be(0); - await pieChart.expectPieSliceCount(5); - }); - }); - - describe('saved search filtering', function () { - before(async () => { - await filterBar.ensureFieldEditorModalIsClosed(); - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.dashboard.clickNewDashboard(); - await PageObjects.timePicker.setDefaultDataRange(); - }); - - it('are added when a cell magnifying glass is clicked', async function () { - await dashboardAddPanel.addSavedSearch('Rendering-Test:-saved-search'); - await PageObjects.dashboard.waitForRenderComplete(); - await testSubjects.click('docTableCellFilter'); - - const filterCount = await filterBar.getFilterCount(); - expect(filterCount).to.equal(1); - }); - }); - - describe('bad filters are loaded properly', function () { - before(async () => { - await filterBar.ensureFieldEditorModalIsClosed(); - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.dashboard.loadSavedDashboard('dashboard with bad filters'); - }); - - it('filter with non-existent index pattern renders in error mode', async function () { - const hasBadFieldFilter = await filterBar.hasFilter('name', 'error', false); - expect(hasBadFieldFilter).to.be(true); - }); - - it('filter with non-existent field renders in error mode', async function () { - const hasBadFieldFilter = await filterBar.hasFilter('baad-field', 'error', false); - expect(hasBadFieldFilter).to.be(true); - }); - - it('filter from unrelated index pattern is still applicable if field name is found', async function () { - const hasUnrelatedIndexPatternFilterPhrase = await filterBar.hasFilter( - '@timestamp', - '123', - true - ); - expect(hasUnrelatedIndexPatternFilterPhrase).to.be(true); - }); - - it('filter from unrelated index pattern is rendred as a warning if field name is not found', async function () { - const hasWarningFieldFilter = await filterBar.hasFilter('extension', 'warn', true); - expect(hasWarningFieldFilter).to.be(true); - }); - - it('filter without an index pattern is rendred as a warning, if the dashboard has an index pattern', async function () { - const noIndexPatternFilter = await filterBar.hasFilter('banana', 'warn', true); - expect(noIndexPatternFilter).to.be(true); - }); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const dashboardExpect = getService('dashboardExpect'); const dashboardAddPanel = getService('dashboardAddPanel'); const testSubjects = getService('testSubjects'); const filterBar = getService('filterBar'); const pieChart = getService('pieChart'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const browser = getService('browser'); const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize', 'timePicker']); describe('dashboard filter bar', () => { before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); }); describe('Add a filter bar', function () { before(async () => { await PageObjects.dashboard.gotoDashboardLandingPage(); }); it('should show on an empty dashboard', async function () { await PageObjects.dashboard.clickNewDashboard(); const hasAddFilter = await testSubjects.exists('addFilter'); expect(hasAddFilter).to.be(true); }); it('should continue to show for visualizations with no search source', async () => { await dashboardAddPanel.addVisualization('Rendering-Test:-input-control'); const hasAddFilter = await testSubjects.exists('addFilter'); expect(hasAddFilter).to.be(true); }); }); describe('filter editor field list', function () { this.tags(['skipFirefox']); before(async () => { await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.clickNewDashboard(); }); it('uses default index pattern on an empty dashboard', async () => { await testSubjects.click('addFilter'); await dashboardExpect.fieldSuggestions(['agent']); await filterBar.ensureFieldEditorModalIsClosed(); }); it('shows index pattern of vis when one is added', async () => { await dashboardAddPanel.addVisualization('Rendering-Test:-animal-sounds-pie'); await PageObjects.header.waitUntilLoadingHasFinished(); await filterBar.ensureFieldEditorModalIsClosed(); await testSubjects.click('addFilter'); await dashboardExpect.fieldSuggestions(['animal']); await filterBar.ensureFieldEditorModalIsClosed(); }); it('works when a vis with no index pattern is added', async () => { await dashboardAddPanel.addVisualization('Rendering-Test:-markdown'); await PageObjects.header.waitUntilLoadingHasFinished(); await filterBar.ensureFieldEditorModalIsClosed(); await testSubjects.click('addFilter'); await dashboardExpect.fieldSuggestions(['animal']); }); }); describe('filter pills', function () { before(async () => { await filterBar.ensureFieldEditorModalIsClosed(); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.clickNewDashboard(); await PageObjects.timePicker.setDefaultDataRange(); }); it('are not selected by default', async function () { const filterCount = await filterBar.getFilterCount(); expect(filterCount).to.equal(0); }); it('are added when a pie chart slice is clicked', async function () { await dashboardAddPanel.addVisualization('Rendering Test: pie'); await PageObjects.dashboard.waitForRenderComplete(); await pieChart.filterOnPieSlice('4,886'); const filterCount = await filterBar.getFilterCount(); expect(filterCount).to.equal(1); await pieChart.expectPieSliceCount(1); }); it('are preserved after saving a dashboard', async () => { await PageObjects.dashboard.saveDashboard('with filters'); await PageObjects.header.waitUntilLoadingHasFinished(); const filterCount = await filterBar.getFilterCount(); expect(filterCount).to.equal(1); await pieChart.expectPieSliceCount(1); }); it('are preserved after opening a dashboard saved with filters', async () => { await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.loadSavedDashboard('with filters'); await PageObjects.header.waitUntilLoadingHasFinished(); const filterCount = await filterBar.getFilterCount(); expect(filterCount).to.equal(1); await pieChart.expectPieSliceCount(1); }); it("restoring filters doesn't break back button", async () => { await browser.goBack(); await PageObjects.dashboard.expectExistsDashboardLandingPage(); await browser.goForward(); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.waitForRenderComplete(); await pieChart.expectPieSliceCount(1); }); it("saving with pinned filter doesn't unpin them", async () => { const filterKey = 'bytes'; await filterBar.toggleFilterPinned(filterKey); await PageObjects.dashboard.switchToEditMode(); await PageObjects.dashboard.saveDashboard('saved with pinned filters', { saveAsNew: true, }); expect(await filterBar.isFilterPinned(filterKey)).to.be(true); await pieChart.expectPieSliceCount(1); }); it("navigating to a dashboard with global filter doesn't unpin it if same filter is saved with dashboard", async () => { await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.loadSavedDashboard('with filters'); await PageObjects.header.waitUntilLoadingHasFinished(); expect(await filterBar.isFilterPinned('bytes')).to.be(true); await pieChart.expectPieSliceCount(1); }); it("pinned filters aren't saved", async () => { await filterBar.removeFilter('bytes'); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.loadSavedDashboard('saved with pinned filters'); await PageObjects.header.waitUntilLoadingHasFinished(); expect(await filterBar.getFilterCount()).to.be(0); await pieChart.expectPieSliceCount(5); }); }); describe('saved search filtering', function () { before(async () => { await filterBar.ensureFieldEditorModalIsClosed(); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.clickNewDashboard(); await PageObjects.timePicker.setDefaultDataRange(); }); it('are added when a cell magnifying glass is clicked', async function () { await dashboardAddPanel.addSavedSearch('Rendering-Test:-saved-search'); await PageObjects.dashboard.waitForRenderComplete(); await testSubjects.click('docTableCellFilter'); const filterCount = await filterBar.getFilterCount(); expect(filterCount).to.equal(1); }); }); describe('bad filters are loaded properly', function () { before(async () => { await filterBar.ensureFieldEditorModalIsClosed(); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.loadSavedDashboard('dashboard with bad filters'); }); it('filter with non-existent index pattern renders in error mode', async function () { const hasBadFieldFilter = await filterBar.hasFilter('name', 'error', false); expect(hasBadFieldFilter).to.be(true); }); it('filter with non-existent field renders in error mode', async function () { const hasBadFieldFilter = await filterBar.hasFilter('baad-field', 'error', false); expect(hasBadFieldFilter).to.be(true); }); it('filter from unrelated index pattern is still applicable if field name is found', async function () { const hasUnrelatedIndexPatternFilterPhrase = await filterBar.hasFilter( '@timestamp', '123', true ); expect(hasUnrelatedIndexPatternFilterPhrase).to.be(true); }); it('filter from unrelated index pattern is rendred as a warning if field name is not found', async function () { const hasWarningFieldFilter = await filterBar.hasFilter('extension', 'warn', true); expect(hasWarningFieldFilter).to.be(true); }); it('filter without an index pattern is rendred as a warning, if the dashboard has an index pattern', async function () { const noIndexPatternFilter = await filterBar.hasFilter('banana', 'warn', true); expect(noIndexPatternFilter).to.be(true); }); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/dashboard_filtering.ts b/test/functional/apps/dashboard/dashboard_filtering.ts index e995bc4e52c49..6a283d89addce 100644 --- a/test/functional/apps/dashboard/dashboard_filtering.ts +++ b/test/functional/apps/dashboard/dashboard_filtering.ts @@ -1,333 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -/** - * Test the querying capabilities of dashboard, and make sure visualizations show the expected results, especially - * with nested queries and filters on the visualizations themselves. - */ -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const dashboardExpect = getService('dashboardExpect'); - const pieChart = getService('pieChart'); - const queryBar = getService('queryBar'); - const dashboardAddPanel = getService('dashboardAddPanel'); - const renderable = getService('renderable'); - const testSubjects = getService('testSubjects'); - const filterBar = getService('filterBar'); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const security = getService('security'); - const dashboardPanelActions = getService('dashboardPanelActions'); - const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize', 'timePicker']); - - describe('dashboard filtering', function () { - this.tags('includeFirefox'); - - const populateDashboard = async () => { - await PageObjects.dashboard.clickNewDashboard(); - await PageObjects.timePicker.setDefaultDataRange(); - await dashboardAddPanel.addEveryVisualization('"Filter Bytes Test"'); - await dashboardAddPanel.addEverySavedSearch('"Filter Bytes Test"'); - - await dashboardAddPanel.closeAddPanel(); - }; - - const addFilterAndRefresh = async () => { - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.waitForRenderComplete(); - await filterBar.addFilter('bytes', 'is', '12345678'); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.waitForRenderComplete(); - // first round of requests sometimes times out, refresh all visualizations to fetch again - await queryBar.clickQuerySubmitButton(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.waitForRenderComplete(); - }; - - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader', 'animals']); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.gotoDashboardLandingPage(); - }); - - after(async () => { - await security.testUser.restoreDefaults(); - }); - - describe('adding a filter that excludes all data', () => { - before(async () => { - await populateDashboard(); - await addFilterAndRefresh(); - }); - - after(async () => { - await PageObjects.dashboard.gotoDashboardLandingPage(); - }); - - it('filters on pie charts', async () => { - await pieChart.expectPieSliceCount(0); - }); - - it('area, bar and heatmap charts filtered', async () => { - await dashboardExpect.seriesElementCount(0); - }); - - it('data tables are filtered', async () => { - await dashboardExpect.dataTableNoResult(); - }); - - it('goal and guages are filtered', async () => { - await dashboardExpect.goalAndGuageLabelsExist(['0', '0%']); - }); - - it('tsvb time series shows no data message', async () => { - expect(await testSubjects.exists('timeseriesVis > visNoResult')).to.be(true); - }); - - it('metric value shows no data', async () => { - await dashboardExpect.metricValuesExist(['-']); - }); - - it('tag cloud values are filtered', async () => { - await dashboardExpect.emptyTagCloudFound(); - }); - - it('tsvb metric is filtered', async () => { - await dashboardExpect.tsvbMetricValuesExist(['0 custom template']); - }); - - it('tsvb top n is filtered', async () => { - await dashboardExpect.tsvbTopNValuesExist(['-', '-']); - }); - - it('saved search is filtered', async () => { - await dashboardExpect.savedSearchRowCount(0); - }); - - // TODO: Uncomment once https://github.com/elastic/kibana/issues/22561 is fixed - // it('timelion is filtered', async () => { - // await dashboardExpect.timelionLegendCount(0); - // }); - - it('vega is filtered', async () => { - await dashboardExpect.vegaTextsDoNotExist(['5,000']); - }); - }); - - describe('using a pinned filter that excludes all data', () => { - before(async () => { - // Functional tests clear session storage after each suite, so it is important to repopulate unsaved panels - await populateDashboard(); - await addFilterAndRefresh(); - - await filterBar.toggleFilterPinned('bytes'); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.waitForRenderComplete(); - }); - - after(async () => { - await filterBar.toggleFilterPinned('bytes'); - await PageObjects.dashboard.gotoDashboardLandingPage(); - }); - - it('filters on pie charts', async () => { - await pieChart.expectPieSliceCount(0); - }); - - it('area, bar and heatmap charts filtered', async () => { - await dashboardExpect.seriesElementCount(0); - }); - - it('data tables are filtered', async () => { - await dashboardExpect.dataTableNoResult(); - }); - - it('goal and guages are filtered', async () => { - await dashboardExpect.goalAndGuageLabelsExist(['0', '0%']); - }); - - it('metric value shows no data', async () => { - await dashboardExpect.metricValuesExist(['-']); - }); - - it('tag cloud values are filtered', async () => { - await dashboardExpect.emptyTagCloudFound(); - }); - - it('tsvb metric is filtered', async () => { - await dashboardExpect.tsvbMetricValuesExist(['0 custom template']); - }); - - it('tsvb top n is filtered', async () => { - await dashboardExpect.tsvbTopNValuesExist(['-', '-']); - }); - - it('saved search is filtered', async () => { - await dashboardExpect.savedSearchRowCount(0); - }); - - // TODO: Uncomment once https://github.com/elastic/kibana/issues/22561 is fixed - // it('timelion is filtered', async () => { - // await dashboardExpect.timelionLegendCount(0); - // }); - - it('vega is filtered', async () => { - await dashboardExpect.vegaTextsDoNotExist(['5,000']); - }); - }); - - describe('disabling a filter unfilters the data on', function () { - before(async () => { - // Functional tests clear session storage after each suite, so it is important to repopulate unsaved panels - await populateDashboard(); - await addFilterAndRefresh(); - - await filterBar.toggleFilterEnabled('bytes'); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.waitForRenderComplete(); - }); - - it('pie charts', async () => { - await pieChart.expectPieSliceCount(5); - }); - - it('area, bar and heatmap charts', async () => { - await dashboardExpect.seriesElementCount(3); - }); - - it('data tables', async () => { - await dashboardExpect.dataTableRowCount(10); - }); - - it('goal and guages', async () => { - await dashboardExpect.goalAndGuageLabelsExist(['39.958%', '7,544']); - }); - - it('metric value', async () => { - await dashboardExpect.metricValuesExist(['101']); - }); - - it('tag cloud', async () => { - await dashboardExpect.tagCloudWithValuesFound(['9,972', '4,886', '1,944', '9,025']); - }); - - it('tsvb metric', async () => { - await dashboardExpect.tsvbMetricValuesExist(['50,465 custom template']); - }); - - it('tsvb top n', async () => { - await dashboardExpect.tsvbTopNValuesExist(['6,308.125', '6,308.125']); - }); - - it('tsvb markdown', async () => { - await dashboardExpect.tsvbMarkdownWithValuesExists(['7,209.286']); - }); - - it('saved searches', async () => { - await dashboardExpect.savedSearchRowCount(1); - }); - - it('vega', async () => { - await dashboardExpect.vegaTextsExist(['5,000']); - }); - }); - - describe('nested filtering', () => { - before(async () => { - await PageObjects.dashboard.gotoDashboardLandingPage(); - }); - - it('visualization saved with a query filters data', async () => { - await PageObjects.dashboard.clickNewDashboard(); - await PageObjects.timePicker.setDefaultDataRange(); - - await dashboardAddPanel.addVisualization('Rendering-Test:-animal-sounds-pie'); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.waitForRenderComplete(); - await pieChart.expectPieSliceCount(5); - - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickEdit(); - await queryBar.setQuery('weightLbs:>50'); - await queryBar.submitQuery(); - - await PageObjects.header.waitUntilLoadingHasFinished(); - - // We are on the visualize page, not dashboard, so can't use "PageObjects.dashboard.waitForRenderComplete();" - // as that expects an item with the `data-shared-items-count` tag. - await renderable.waitForRender(); - await pieChart.expectPieSliceCount(3); - - await PageObjects.visualize.saveVisualizationExpectSuccess( - 'Rendering Test: animal sounds pie' - ); - await PageObjects.header.clickDashboard(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.waitForRenderComplete(); - await pieChart.expectPieSliceCount(3); - }); - - it('Nested visualization filter pills filters data as expected', async () => { - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickEdit(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await renderable.waitForRender(); - await pieChart.filterOnPieSlice('grr'); - await PageObjects.header.waitUntilLoadingHasFinished(); - await pieChart.expectPieSliceCount(1); - - await PageObjects.visualize.saveVisualizationExpectSuccess('animal sounds pie'); - await PageObjects.header.clickDashboard(); - - await pieChart.expectPieSliceCount(1); - }); - - it('Removing filter pills and query unfiters data as expected', async () => { - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickEdit(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await renderable.waitForRender(); - await queryBar.setQuery(''); - await queryBar.submitQuery(); - await filterBar.removeFilter('sound.keyword'); - await PageObjects.header.waitUntilLoadingHasFinished(); - await pieChart.expectPieSliceCount(5); - - await PageObjects.visualize.saveVisualizationExpectSuccess( - 'Rendering Test: animal sounds pie' - ); - await PageObjects.header.clickDashboard(); - - await pieChart.expectPieSliceCount(5); - }); - - it('Pie chart linked to saved search filters data', async () => { - await dashboardAddPanel.addVisualization( - 'Filter Test: animals: linked to search with filter' - ); - await pieChart.expectPieSliceCount(7); - }); - - it('Pie chart linked to saved search filters shows no data with conflicting dashboard query', async () => { - await queryBar.setQuery('weightLbs<40'); - await queryBar.submitQuery(); - await PageObjects.dashboard.waitForRenderComplete(); - - await pieChart.expectPieSliceCount(5); - }); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; /** * Test the querying capabilities of dashboard, and make sure visualizations show the expected results, especially * with nested queries and filters on the visualizations themselves. */ export default function ({ getService, getPageObjects }: FtrProviderContext) { const dashboardExpect = getService('dashboardExpect'); const pieChart = getService('pieChart'); const queryBar = getService('queryBar'); const dashboardAddPanel = getService('dashboardAddPanel'); const renderable = getService('renderable'); const testSubjects = getService('testSubjects'); const filterBar = getService('filterBar'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const security = getService('security'); const dashboardPanelActions = getService('dashboardPanelActions'); const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'visualize', 'timePicker']); describe('dashboard filtering', function () { this.tags('includeFirefox'); const populateDashboard = async () => { await PageObjects.dashboard.clickNewDashboard(); await PageObjects.timePicker.setDefaultDataRange(); await dashboardAddPanel.addEveryVisualization('"Filter Bytes Test"'); await dashboardAddPanel.addEverySavedSearch('"Filter Bytes Test"'); await dashboardAddPanel.closeAddPanel(); }; const addFilterAndRefresh = async () => { await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.waitForRenderComplete(); await filterBar.addFilter('bytes', 'is', '12345678'); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.waitForRenderComplete(); // first round of requests sometimes times out, refresh all visualizations to fetch again await queryBar.clickQuerySubmitButton(); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.waitForRenderComplete(); }; before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader', 'animals']); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.gotoDashboardLandingPage(); }); after(async () => { await security.testUser.restoreDefaults(); }); describe('adding a filter that excludes all data', () => { before(async () => { await populateDashboard(); await addFilterAndRefresh(); }); after(async () => { await PageObjects.dashboard.gotoDashboardLandingPage(); }); it('filters on pie charts', async () => { await pieChart.expectPieSliceCount(0); }); it('area, bar and heatmap charts filtered', async () => { await dashboardExpect.seriesElementCount(0); }); it('data tables are filtered', async () => { await dashboardExpect.dataTableNoResult(); }); it('goal and guages are filtered', async () => { await dashboardExpect.goalAndGuageLabelsExist(['0', '0%']); }); it('tsvb time series shows no data message', async () => { expect(await testSubjects.exists('timeseriesVis > visNoResult')).to.be(true); }); it('metric value shows no data', async () => { await dashboardExpect.metricValuesExist(['-']); }); it('tag cloud values are filtered', async () => { await dashboardExpect.emptyTagCloudFound(); }); it('tsvb metric is filtered', async () => { await dashboardExpect.tsvbMetricValuesExist(['0 custom template']); }); it('tsvb top n is filtered', async () => { await dashboardExpect.tsvbTopNValuesExist(['-', '-']); }); it('saved search is filtered', async () => { await dashboardExpect.savedSearchRowCount(0); }); // TODO: Uncomment once https://github.com/elastic/kibana/issues/22561 is fixed // it('timelion is filtered', async () => { // await dashboardExpect.timelionLegendCount(0); // }); it('vega is filtered', async () => { await dashboardExpect.vegaTextsDoNotExist(['5,000']); }); }); describe('using a pinned filter that excludes all data', () => { before(async () => { // Functional tests clear session storage after each suite, so it is important to repopulate unsaved panels await populateDashboard(); await addFilterAndRefresh(); await filterBar.toggleFilterPinned('bytes'); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.waitForRenderComplete(); }); after(async () => { await filterBar.toggleFilterPinned('bytes'); await PageObjects.dashboard.gotoDashboardLandingPage(); }); it('filters on pie charts', async () => { await pieChart.expectPieSliceCount(0); }); it('area, bar and heatmap charts filtered', async () => { await dashboardExpect.seriesElementCount(0); }); it('data tables are filtered', async () => { await dashboardExpect.dataTableNoResult(); }); it('goal and guages are filtered', async () => { await dashboardExpect.goalAndGuageLabelsExist(['0', '0%']); }); it('metric value shows no data', async () => { await dashboardExpect.metricValuesExist(['-']); }); it('tag cloud values are filtered', async () => { await dashboardExpect.emptyTagCloudFound(); }); it('tsvb metric is filtered', async () => { await dashboardExpect.tsvbMetricValuesExist(['0 custom template']); }); it('tsvb top n is filtered', async () => { await dashboardExpect.tsvbTopNValuesExist(['-', '-']); }); it('saved search is filtered', async () => { await dashboardExpect.savedSearchRowCount(0); }); // TODO: Uncomment once https://github.com/elastic/kibana/issues/22561 is fixed // it('timelion is filtered', async () => { // await dashboardExpect.timelionLegendCount(0); // }); it('vega is filtered', async () => { await dashboardExpect.vegaTextsDoNotExist(['5,000']); }); }); describe('disabling a filter unfilters the data on', function () { before(async () => { // Functional tests clear session storage after each suite, so it is important to repopulate unsaved panels await populateDashboard(); await addFilterAndRefresh(); await filterBar.toggleFilterEnabled('bytes'); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.waitForRenderComplete(); }); it('pie charts', async () => { await pieChart.expectPieSliceCount(5); }); it('area, bar and heatmap charts', async () => { await dashboardExpect.seriesElementCount(3); }); it('data tables', async () => { await dashboardExpect.dataTableRowCount(10); }); it('goal and guages', async () => { await dashboardExpect.goalAndGuageLabelsExist(['39.958%', '7,544']); }); it('metric value', async () => { await dashboardExpect.metricValuesExist(['101']); }); it('tag cloud', async () => { await dashboardExpect.tagCloudWithValuesFound(['9,972', '4,886', '1,944', '9,025']); }); it('tsvb metric', async () => { await dashboardExpect.tsvbMetricValuesExist(['50,465 custom template']); }); it('tsvb top n', async () => { await dashboardExpect.tsvbTopNValuesExist(['6,308.125', '6,308.125']); }); it('tsvb markdown', async () => { await dashboardExpect.tsvbMarkdownWithValuesExists(['7,209.286']); }); it('saved searches', async () => { await dashboardExpect.savedSearchRowCount(1); }); it('vega', async () => { await dashboardExpect.vegaTextsExist(['5,000']); }); }); describe('nested filtering', () => { before(async () => { await PageObjects.dashboard.gotoDashboardLandingPage(); }); it('visualization saved with a query filters data', async () => { await PageObjects.dashboard.clickNewDashboard(); await PageObjects.timePicker.setDefaultDataRange(); await dashboardAddPanel.addVisualization('Rendering-Test:-animal-sounds-pie'); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.waitForRenderComplete(); await pieChart.expectPieSliceCount(5); await dashboardPanelActions.openContextMenu(); await dashboardPanelActions.clickEdit(); await queryBar.setQuery('weightLbs:>50'); await queryBar.submitQuery(); await PageObjects.header.waitUntilLoadingHasFinished(); // We are on the visualize page, not dashboard, so can't use "PageObjects.dashboard.waitForRenderComplete();" // as that expects an item with the `data-shared-items-count` tag. await renderable.waitForRender(); await pieChart.expectPieSliceCount(3); await PageObjects.visualize.saveVisualizationExpectSuccess( 'Rendering Test: animal sounds pie' ); await PageObjects.header.clickDashboard(); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.waitForRenderComplete(); await pieChart.expectPieSliceCount(3); }); it('Nested visualization filter pills filters data as expected', async () => { await dashboardPanelActions.openContextMenu(); await dashboardPanelActions.clickEdit(); await PageObjects.header.waitUntilLoadingHasFinished(); await renderable.waitForRender(); await pieChart.filterOnPieSlice('grr'); await PageObjects.header.waitUntilLoadingHasFinished(); await pieChart.expectPieSliceCount(1); await PageObjects.visualize.saveVisualizationExpectSuccess('animal sounds pie'); await PageObjects.header.clickDashboard(); await pieChart.expectPieSliceCount(1); }); it('Removing filter pills and query unfiters data as expected', async () => { await dashboardPanelActions.openContextMenu(); await dashboardPanelActions.clickEdit(); await PageObjects.header.waitUntilLoadingHasFinished(); await renderable.waitForRender(); await queryBar.setQuery(''); await queryBar.submitQuery(); await filterBar.removeFilter('sound.keyword'); await PageObjects.header.waitUntilLoadingHasFinished(); await pieChart.expectPieSliceCount(5); await PageObjects.visualize.saveVisualizationExpectSuccess( 'Rendering Test: animal sounds pie' ); await PageObjects.header.clickDashboard(); await pieChart.expectPieSliceCount(5); }); it('Pie chart linked to saved search filters data', async () => { await dashboardAddPanel.addVisualization( 'Filter Test: animals: linked to search with filter' ); await pieChart.expectPieSliceCount(7); }); it('Pie chart linked to saved search filters shows no data with conflicting dashboard query', async () => { await queryBar.setQuery('weightLbs<40'); await queryBar.submitQuery(); await PageObjects.dashboard.waitForRenderComplete(); await pieChart.expectPieSliceCount(5); }); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/dashboard_grid.ts b/test/functional/apps/dashboard/dashboard_grid.ts index 809fb6fc14001..29009d130e398 100644 --- a/test/functional/apps/dashboard/dashboard_grid.ts +++ b/test/functional/apps/dashboard/dashboard_grid.ts @@ -1,50 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const browser = getService('browser'); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const dashboardPanelActions = getService('dashboardPanelActions'); - const PageObjects = getPageObjects(['common', 'dashboard']); - - describe('dashboard grid', function () { - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.loadSavedDashboard('few panels'); - await PageObjects.dashboard.switchToEditMode(); - }); - - describe('move panel', () => { - // Specific test after https://github.com/elastic/kibana/issues/14764 fix - it('Can move panel from bottom to top row', async () => { - const lastVisTitle = 'Rendering Test: datatable'; - const panelTitleBeforeMove = await dashboardPanelActions.getPanelHeading(lastVisTitle); - const position1 = await panelTitleBeforeMove.getPosition(); - await browser.dragAndDrop( - { location: panelTitleBeforeMove }, - { location: { x: -20, y: -450 } } - ); - - const panelTitleAfterMove = await dashboardPanelActions.getPanelHeading(lastVisTitle); - const position2 = await panelTitleAfterMove.getPosition(); - - expect(position1.y).to.be.greaterThan(position2.y); - }); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const browser = getService('browser'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const dashboardPanelActions = getService('dashboardPanelActions'); const PageObjects = getPageObjects(['common', 'dashboard']); describe('dashboard grid', function () { before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.loadSavedDashboard('few panels'); await PageObjects.dashboard.switchToEditMode(); }); describe('move panel', () => { // Specific test after https://github.com/elastic/kibana/issues/14764 fix it('Can move panel from bottom to top row', async () => { const lastVisTitle = 'Rendering Test: datatable'; const panelTitleBeforeMove = await dashboardPanelActions.getPanelHeading(lastVisTitle); const position1 = await panelTitleBeforeMove.getPosition(); await browser.dragAndDrop( { location: panelTitleBeforeMove }, { location: { x: -20, y: -450 } } ); const panelTitleAfterMove = await dashboardPanelActions.getPanelHeading(lastVisTitle); const position2 = await panelTitleAfterMove.getPosition(); expect(position1.y).to.be.greaterThan(position2.y); }); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/dashboard_options.ts b/test/functional/apps/dashboard/dashboard_options.ts index 1f62256a3fdb5..e0f9e8206d9f8 100644 --- a/test/functional/apps/dashboard/dashboard_options.ts +++ b/test/functional/apps/dashboard/dashboard_options.ts @@ -1,50 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const retry = getService('retry'); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const PageObjects = getPageObjects(['common', 'dashboard']); - - describe('dashboard data-shared attributes', () => { - let originalTitles: string[] = []; - - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.loadSavedDashboard('few panels'); - await PageObjects.dashboard.switchToEditMode(); - originalTitles = await PageObjects.dashboard.getPanelTitles(); - }); - - it('should be able to hide all panel titles', async () => { - await PageObjects.dashboard.checkHideTitle(); - await retry.try(async () => { - const titles = await PageObjects.dashboard.getPanelTitles(); - expect(titles[0]).to.eql(''); - }); - }); - - it('should be able to unhide all panel titles', async () => { - await PageObjects.dashboard.checkHideTitle(); - await retry.try(async () => { - const titles = await PageObjects.dashboard.getPanelTitles(); - expect(titles[0]).to.eql(originalTitles[0]); - }); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const retry = getService('retry'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const PageObjects = getPageObjects(['common', 'dashboard']); describe('dashboard data-shared attributes', () => { let originalTitles: string[] = []; before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.loadSavedDashboard('few panels'); await PageObjects.dashboard.switchToEditMode(); originalTitles = await PageObjects.dashboard.getPanelTitles(); }); it('should be able to hide all panel titles', async () => { await PageObjects.dashboard.checkHideTitle(); await retry.try(async () => { const titles = await PageObjects.dashboard.getPanelTitles(); expect(titles[0]).to.eql(''); }); }); it('should be able to unhide all panel titles', async () => { await PageObjects.dashboard.checkHideTitle(); await retry.try(async () => { const titles = await PageObjects.dashboard.getPanelTitles(); expect(titles[0]).to.eql(originalTitles[0]); }); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/dashboard_query_bar.ts b/test/functional/apps/dashboard/dashboard_query_bar.ts index bf8300defc445..a653c8d14dbb2 100644 --- a/test/functional/apps/dashboard/dashboard_query_bar.ts +++ b/test/functional/apps/dashboard/dashboard_query_bar.ts @@ -1,43 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const pieChart = getService('pieChart'); - const queryBar = getService('queryBar'); - const retry = getService('retry'); - const PageObjects = getPageObjects(['common', 'dashboard', 'discover']); - - describe('dashboard query bar', () => { - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.loadSavedDashboard('dashboard with filter'); - }); - - it('causes panels to reload when refresh is clicked', async () => { - await esArchiver.unload('dashboard/current/data'); - - await queryBar.clickQuerySubmitButton(); - await retry.tryForTime(5000, async () => { - const headers = await PageObjects.discover.getColumnHeaders(); - expect(headers.length).to.be(0); - await pieChart.expectPieSliceCount(0); - }); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const pieChart = getService('pieChart'); const queryBar = getService('queryBar'); const retry = getService('retry'); const PageObjects = getPageObjects(['common', 'dashboard', 'discover']); describe('dashboard query bar', () => { before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.loadSavedDashboard('dashboard with filter'); }); it('causes panels to reload when refresh is clicked', async () => { await esArchiver.unload('dashboard/current/data'); await queryBar.clickQuerySubmitButton(); await retry.tryForTime(5000, async () => { const headers = await PageObjects.discover.getColumnHeaders(); expect(headers.length).to.be(0); await pieChart.expectPieSliceCount(0); }); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/dashboard_saved_query.ts b/test/functional/apps/dashboard/dashboard_saved_query.ts index 307c34d3f3c43..89be368e479d5 100644 --- a/test/functional/apps/dashboard/dashboard_saved_query.ts +++ b/test/functional/apps/dashboard/dashboard_saved_query.ts @@ -1,114 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const PageObjects = getPageObjects(['common', 'dashboard', 'timePicker']); - const browser = getService('browser'); - const queryBar = getService('queryBar'); - const savedQueryManagementComponent = getService('savedQueryManagementComponent'); - const testSubjects = getService('testSubjects'); - - describe('dashboard saved queries', function describeIndexTests() { - before(async function () { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - }); - - describe('saved query management component functionality', function () { - before(async () => { - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.dashboard.clickNewDashboard(); - }); - - it('should show the saved query management component when there are no saved queries', async () => { - await savedQueryManagementComponent.openSavedQueryManagementComponent(); - const descriptionText = await testSubjects.getVisibleText('saved-query-management-popover'); - expect(descriptionText).to.eql( - 'SAVED QUERIES\nThere are no saved queries. Save query text and filters that you want to use again.\nSave current query' - ); - }); - - it('should allow a query to be saved via the saved objects management component', async () => { - await queryBar.setQuery('response:200'); - await savedQueryManagementComponent.saveNewQuery( - 'OkResponse', - '200 responses for .jpg over 24 hours', - true, - true - ); - await savedQueryManagementComponent.savedQueryExistOrFail('OkResponse'); - await savedQueryManagementComponent.savedQueryTextExist('response:200'); - }); - - it('reinstates filters and the time filter when a saved query has filters and a time filter included', async () => { - await PageObjects.timePicker.setDefaultAbsoluteRange(); - await savedQueryManagementComponent.clearCurrentlyLoadedQuery(); - await savedQueryManagementComponent.loadSavedQuery('OkResponse'); - const timePickerValues = await PageObjects.timePicker.getTimeConfigAsAbsoluteTimes(); - expect(timePickerValues.start).to.not.eql(PageObjects.timePicker.defaultStartTime); - expect(timePickerValues.end).to.not.eql(PageObjects.timePicker.defaultEndTime); - }); - - it('preserves the currently loaded query when the page is reloaded', async () => { - await browser.refresh(); - const timePickerValues = await PageObjects.timePicker.getTimeConfigAsAbsoluteTimes(); - expect(timePickerValues.start).to.not.eql(PageObjects.timePicker.defaultStartTime); - expect(timePickerValues.end).to.not.eql(PageObjects.timePicker.defaultEndTime); - expect(await savedQueryManagementComponent.getCurrentlyLoadedQueryID()).to.be('OkResponse'); - }); - - it('allows saving changes to a currently loaded query via the saved query management component', async () => { - await queryBar.setQuery('response:404'); - await savedQueryManagementComponent.updateCurrentlyLoadedQuery('OkResponse', false, false); - await savedQueryManagementComponent.savedQueryExistOrFail('OkResponse'); - await savedQueryManagementComponent.clearCurrentlyLoadedQuery(); - expect(await queryBar.getQueryString()).to.eql(''); - await savedQueryManagementComponent.loadSavedQuery('OkResponse'); - expect(await queryBar.getQueryString()).to.eql('response:404'); - }); - - it('allows saving the currently loaded query as a new query', async () => { - await savedQueryManagementComponent.saveCurrentlyLoadedAsNewQuery( - 'OkResponseCopy', - '200 responses', - false, - false - ); - await savedQueryManagementComponent.savedQueryExistOrFail('OkResponseCopy'); - }); - - it('allows deleting the currently loaded saved query in the saved query management component and clears the query', async () => { - await savedQueryManagementComponent.deleteSavedQuery('OkResponseCopy'); - await savedQueryManagementComponent.savedQueryMissingOrFail('OkResponseCopy'); - expect(await queryBar.getQueryString()).to.eql(''); - }); - - it('resets any changes to a loaded query on reloading the same saved query', async () => { - await savedQueryManagementComponent.loadSavedQuery('OkResponse'); - await queryBar.setQuery('response:503'); - await savedQueryManagementComponent.loadSavedQuery('OkResponse'); - expect(await queryBar.getQueryString()).to.eql('response:404'); - }); - - it('allows clearing the currently loaded saved query', async () => { - await savedQueryManagementComponent.loadSavedQuery('OkResponse'); - await savedQueryManagementComponent.clearCurrentlyLoadedQuery(); - expect(await queryBar.getQueryString()).to.eql(''); - }); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const PageObjects = getPageObjects(['common', 'dashboard', 'timePicker']); const browser = getService('browser'); const queryBar = getService('queryBar'); const savedQueryManagementComponent = getService('savedQueryManagementComponent'); const testSubjects = getService('testSubjects'); describe('dashboard saved queries', function describeIndexTests() { before(async function () { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); }); describe('saved query management component functionality', function () { before(async () => { await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.clickNewDashboard(); }); it('should show the saved query management component when there are no saved queries', async () => { await savedQueryManagementComponent.openSavedQueryManagementComponent(); const descriptionText = await testSubjects.getVisibleText('saved-query-management-popover'); expect(descriptionText).to.eql( 'SAVED QUERIES\nThere are no saved queries. Save query text and filters that you want to use again.\nSave current query' ); }); it('should allow a query to be saved via the saved objects management component', async () => { await queryBar.setQuery('response:200'); await savedQueryManagementComponent.saveNewQuery( 'OkResponse', '200 responses for .jpg over 24 hours', true, true ); await savedQueryManagementComponent.savedQueryExistOrFail('OkResponse'); await savedQueryManagementComponent.savedQueryTextExist('response:200'); }); it('reinstates filters and the time filter when a saved query has filters and a time filter included', async () => { await PageObjects.timePicker.setDefaultAbsoluteRange(); await savedQueryManagementComponent.clearCurrentlyLoadedQuery(); await savedQueryManagementComponent.loadSavedQuery('OkResponse'); const timePickerValues = await PageObjects.timePicker.getTimeConfigAsAbsoluteTimes(); expect(timePickerValues.start).to.not.eql(PageObjects.timePicker.defaultStartTime); expect(timePickerValues.end).to.not.eql(PageObjects.timePicker.defaultEndTime); }); it('preserves the currently loaded query when the page is reloaded', async () => { await browser.refresh(); const timePickerValues = await PageObjects.timePicker.getTimeConfigAsAbsoluteTimes(); expect(timePickerValues.start).to.not.eql(PageObjects.timePicker.defaultStartTime); expect(timePickerValues.end).to.not.eql(PageObjects.timePicker.defaultEndTime); expect(await savedQueryManagementComponent.getCurrentlyLoadedQueryID()).to.be('OkResponse'); }); it('allows saving changes to a currently loaded query via the saved query management component', async () => { await queryBar.setQuery('response:404'); await savedQueryManagementComponent.updateCurrentlyLoadedQuery('OkResponse', false, false); await savedQueryManagementComponent.savedQueryExistOrFail('OkResponse'); await savedQueryManagementComponent.clearCurrentlyLoadedQuery(); expect(await queryBar.getQueryString()).to.eql(''); await savedQueryManagementComponent.loadSavedQuery('OkResponse'); expect(await queryBar.getQueryString()).to.eql('response:404'); }); it('allows saving the currently loaded query as a new query', async () => { await savedQueryManagementComponent.saveCurrentlyLoadedAsNewQuery( 'OkResponseCopy', '200 responses', false, false ); await savedQueryManagementComponent.savedQueryExistOrFail('OkResponseCopy'); }); it('allows deleting the currently loaded saved query in the saved query management component and clears the query', async () => { await savedQueryManagementComponent.deleteSavedQuery('OkResponseCopy'); await savedQueryManagementComponent.savedQueryMissingOrFail('OkResponseCopy'); expect(await queryBar.getQueryString()).to.eql(''); }); it('resets any changes to a loaded query on reloading the same saved query', async () => { await savedQueryManagementComponent.loadSavedQuery('OkResponse'); await queryBar.setQuery('response:503'); await savedQueryManagementComponent.loadSavedQuery('OkResponse'); expect(await queryBar.getQueryString()).to.eql('response:404'); }); it('allows clearing the currently loaded saved query', async () => { await savedQueryManagementComponent.loadSavedQuery('OkResponse'); await savedQueryManagementComponent.clearCurrentlyLoadedQuery(); expect(await queryBar.getQueryString()).to.eql(''); }); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/dashboard_snapshots.ts b/test/functional/apps/dashboard/dashboard_snapshots.ts index c93636aeb63c6..bf4fc1a8b6425 100644 --- a/test/functional/apps/dashboard/dashboard_snapshots.ts +++ b/test/functional/apps/dashboard/dashboard_snapshots.ts @@ -1,87 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ - getService, - getPageObjects, - updateBaselines, -}: FtrProviderContext & { updateBaselines: boolean }) { - const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'common', 'timePicker']); - const screenshot = getService('screenshots'); - const browser = getService('browser'); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const dashboardPanelActions = getService('dashboardPanelActions'); - const dashboardAddPanel = getService('dashboardAddPanel'); - - describe('dashboard snapshots', function describeIndexTests() { - before(async function () { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - // We use a really small window to minimize differences across os's and browsers. - await browser.setScreenshotSize(1000, 500); - // adding this navigate adds the timestamp hash to the url which invalidates previous - // session. If we don't do this, the colors on the visualizations are different and the screenshots won't match. - await PageObjects.common.navigateToApp('dashboard'); - }); - - after(async function () { - await browser.setWindowSize(1300, 900); - }); - - it('compare TSVB snapshot', async () => { - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.dashboard.clickNewDashboard(); - await PageObjects.timePicker.setLogstashDataRange(); - await dashboardAddPanel.addVisualization('Rendering Test: tsvb-ts'); - await PageObjects.common.closeToastIfExists(); - - await PageObjects.dashboard.saveDashboard('tsvb'); - await PageObjects.dashboard.clickFullScreenMode(); - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickExpandPanelToggle(); - - await PageObjects.dashboard.waitForRenderComplete(); - const percentDifference = await screenshot.compareAgainstBaseline( - 'tsvb_dashboard', - updateBaselines - ); - - await PageObjects.dashboard.clickExitFullScreenLogoButton(); - expect(percentDifference).to.be.lessThan(0.02); - }); - - it('compare area chart snapshot', async () => { - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.dashboard.clickNewDashboard(); - await PageObjects.timePicker.setLogstashDataRange(); - await dashboardAddPanel.addVisualization('Rendering Test: area with not filter'); - await PageObjects.common.closeToastIfExists(); - - await PageObjects.dashboard.saveDashboard('area'); - await PageObjects.dashboard.clickFullScreenMode(); - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickExpandPanelToggle(); - - await PageObjects.dashboard.waitForRenderComplete(); - const percentDifference = await screenshot.compareAgainstBaseline( - 'area_chart', - updateBaselines - ); - - await PageObjects.dashboard.clickExitFullScreenLogoButton(); - expect(percentDifference).to.be.lessThan(0.02); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects, updateBaselines, }: FtrProviderContext & { updateBaselines: boolean }) { const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'common', 'timePicker']); const screenshot = getService('screenshots'); const browser = getService('browser'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const dashboardPanelActions = getService('dashboardPanelActions'); const dashboardAddPanel = getService('dashboardAddPanel'); describe('dashboard snapshots', function describeIndexTests() { before(async function () { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); // We use a really small window to minimize differences across os's and browsers. await browser.setScreenshotSize(1000, 500); // adding this navigate adds the timestamp hash to the url which invalidates previous // session. If we don't do this, the colors on the visualizations are different and the screenshots won't match. await PageObjects.common.navigateToApp('dashboard'); }); after(async function () { await browser.setWindowSize(1300, 900); }); it('compare TSVB snapshot', async () => { await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.clickNewDashboard(); await PageObjects.timePicker.setLogstashDataRange(); await dashboardAddPanel.addVisualization('Rendering Test: tsvb-ts'); await PageObjects.common.closeToastIfExists(); await PageObjects.dashboard.saveDashboard('tsvb'); await PageObjects.dashboard.clickFullScreenMode(); await dashboardPanelActions.openContextMenu(); await dashboardPanelActions.clickExpandPanelToggle(); await PageObjects.dashboard.waitForRenderComplete(); const percentDifference = await screenshot.compareAgainstBaseline( 'tsvb_dashboard', updateBaselines ); await PageObjects.dashboard.clickExitFullScreenLogoButton(); expect(percentDifference).to.be.lessThan(0.02); }); it('compare area chart snapshot', async () => { await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.clickNewDashboard(); await PageObjects.timePicker.setLogstashDataRange(); await dashboardAddPanel.addVisualization('Rendering Test: area with not filter'); await PageObjects.common.closeToastIfExists(); await PageObjects.dashboard.saveDashboard('area'); await PageObjects.dashboard.clickFullScreenMode(); await dashboardPanelActions.openContextMenu(); await dashboardPanelActions.clickExpandPanelToggle(); await PageObjects.dashboard.waitForRenderComplete(); const percentDifference = await screenshot.compareAgainstBaseline( 'area_chart', updateBaselines ); await PageObjects.dashboard.clickExitFullScreenLogoButton(); expect(percentDifference).to.be.lessThan(0.02); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/dashboard_unsaved_listing.ts b/test/functional/apps/dashboard/dashboard_unsaved_listing.ts index 233d2e91467fe..0a32f869df8ff 100644 --- a/test/functional/apps/dashboard/dashboard_unsaved_listing.ts +++ b/test/functional/apps/dashboard/dashboard_unsaved_listing.ts @@ -1,160 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const dashboardAddPanel = getService('dashboardAddPanel'); - const dashboardPanelActions = getService('dashboardPanelActions'); - - let existingDashboardPanelCount = 0; - const dashboardTitle = 'few panels'; - const unsavedDashboardTitle = 'New Dashboard'; - const newDashboartTitle = 'A Wild Dashboard'; - - describe('dashboard unsaved listing', () => { - const addSomePanels = async () => { - // add an area chart by value - await dashboardAddPanel.clickCreateNewLink(); - await PageObjects.visualize.clickAggBasedVisualizations(); - await PageObjects.visualize.clickAreaChart(); - await PageObjects.visualize.clickNewSearch(); - await PageObjects.visualize.saveVisualizationAndReturn(); - - // add a metric by reference - await dashboardAddPanel.addVisualization('Rendering-Test: metric'); - }; - - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - }); - - it('lists unsaved changes to existing dashboards', async () => { - await PageObjects.dashboard.loadSavedDashboard(dashboardTitle); - await PageObjects.dashboard.switchToEditMode(); - await addSomePanels(); - existingDashboardPanelCount = await PageObjects.dashboard.getPanelCount(); - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.expectUnsavedChangesListingExists(dashboardTitle); - }); - - it('restores unsaved changes to existing dashboards', async () => { - await PageObjects.dashboard.clickUnsavedChangesContinueEditing(dashboardTitle); - await PageObjects.header.waitUntilLoadingHasFinished(); - const currentPanelCount = await PageObjects.dashboard.getPanelCount(); - expect(currentPanelCount).to.eql(existingDashboardPanelCount); - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.header.waitUntilLoadingHasFinished(); - }); - - it('lists unsaved changes to new dashboards', async () => { - await PageObjects.dashboard.clickNewDashboard(); - await addSomePanels(); - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.expectUnsavedChangesListingExists(unsavedDashboardTitle); - }); - - it('restores unsaved changes to new dashboards', async () => { - await PageObjects.dashboard.clickUnsavedChangesContinueEditing(unsavedDashboardTitle); - await PageObjects.header.waitUntilLoadingHasFinished(); - expect(await PageObjects.dashboard.getPanelCount()).to.eql(2); - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.header.waitUntilLoadingHasFinished(); - }); - - it('shows a warning on create new, and restores panels if continue is selected', async () => { - await PageObjects.dashboard.clickNewDashboardExpectWarning(true); - await PageObjects.header.waitUntilLoadingHasFinished(); - expect(await PageObjects.dashboard.getPanelCount()).to.eql(2); - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.header.waitUntilLoadingHasFinished(); - }); - - it('shows a warning on create new, and clears unsaved panels if discard is selected', async () => { - await PageObjects.dashboard.clickNewDashboardExpectWarning(); - await PageObjects.header.waitUntilLoadingHasFinished(); - expect(await PageObjects.dashboard.getPanelCount()).to.eql(0); - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.header.waitUntilLoadingHasFinished(); - }); - - it('does not show unsaved changes on new dashboard when no panels have been added', async () => { - await PageObjects.dashboard.expectUnsavedChangesDoesNotExist(unsavedDashboardTitle); - }); - - it('can discard unsaved changes using the discard link', async () => { - await PageObjects.dashboard.clickUnsavedChangesDiscard(dashboardTitle); - await PageObjects.dashboard.expectUnsavedChangesDoesNotExist(dashboardTitle); - await PageObjects.dashboard.loadSavedDashboard(dashboardTitle); - await PageObjects.dashboard.switchToEditMode(); - const currentPanelCount = await PageObjects.dashboard.getPanelCount(); - expect(currentPanelCount).to.eql(existingDashboardPanelCount - 2); - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.header.waitUntilLoadingHasFinished(); - }); - - it('loses unsaved changes to new dashboard upon saving', async () => { - await PageObjects.dashboard.clickNewDashboard(); - await addSomePanels(); - - // ensure that the unsaved listing exists first - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.clickUnsavedChangesContinueEditing(unsavedDashboardTitle); - await PageObjects.header.waitUntilLoadingHasFinished(); - - // Save the dashboard, and check that it now does not exist - await PageObjects.dashboard.saveDashboard(newDashboartTitle); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.dashboard.expectUnsavedChangesDoesNotExist(unsavedDashboardTitle); - }); - - it('does not list unsaved changes when unsaved version of the dashboard is the same', async () => { - await PageObjects.dashboard.loadSavedDashboard(newDashboartTitle); - await PageObjects.dashboard.switchToEditMode(); - - // add another panel so we can delete it later - await dashboardAddPanel.clickCreateNewLink(); - await PageObjects.visualize.clickAggBasedVisualizations(); - await PageObjects.visualize.clickAreaChart(); - await PageObjects.visualize.clickNewSearch(); - await PageObjects.visualize.saveVisualizationExpectSuccess('Wildvis', { - redirectToOrigin: true, - }); - - // ensure that the unsaved listing exists - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.expectUnsavedChangesListingExists(newDashboartTitle); - await PageObjects.dashboard.clickUnsavedChangesContinueEditing(newDashboartTitle); - await PageObjects.header.waitUntilLoadingHasFinished(); - - // Remove the panel that was just added - await dashboardPanelActions.removePanelByTitle('Wildvis'); - await PageObjects.header.waitUntilLoadingHasFinished(); - - // Check that it now does not exist - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.expectUnsavedChangesDoesNotExist(newDashboartTitle); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const dashboardAddPanel = getService('dashboardAddPanel'); const dashboardPanelActions = getService('dashboardPanelActions'); let existingDashboardPanelCount = 0; const dashboardTitle = 'few panels'; const unsavedDashboardTitle = 'New Dashboard'; const newDashboartTitle = 'A Wild Dashboard'; describe('dashboard unsaved listing', () => { const addSomePanels = async () => { // add an area chart by value await dashboardAddPanel.clickCreateNewLink(); await PageObjects.visualize.clickAggBasedVisualizations(); await PageObjects.visualize.clickAreaChart(); await PageObjects.visualize.clickNewSearch(); await PageObjects.visualize.saveVisualizationAndReturn(); // add a metric by reference await dashboardAddPanel.addVisualization('Rendering-Test: metric'); }; before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); }); it('lists unsaved changes to existing dashboards', async () => { await PageObjects.dashboard.loadSavedDashboard(dashboardTitle); await PageObjects.dashboard.switchToEditMode(); await addSomePanels(); existingDashboardPanelCount = await PageObjects.dashboard.getPanelCount(); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.expectUnsavedChangesListingExists(dashboardTitle); }); it('restores unsaved changes to existing dashboards', async () => { await PageObjects.dashboard.clickUnsavedChangesContinueEditing(dashboardTitle); await PageObjects.header.waitUntilLoadingHasFinished(); const currentPanelCount = await PageObjects.dashboard.getPanelCount(); expect(currentPanelCount).to.eql(existingDashboardPanelCount); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.header.waitUntilLoadingHasFinished(); }); it('lists unsaved changes to new dashboards', async () => { await PageObjects.dashboard.clickNewDashboard(); await addSomePanels(); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.expectUnsavedChangesListingExists(unsavedDashboardTitle); }); it('restores unsaved changes to new dashboards', async () => { await PageObjects.dashboard.clickUnsavedChangesContinueEditing(unsavedDashboardTitle); await PageObjects.header.waitUntilLoadingHasFinished(); expect(await PageObjects.dashboard.getPanelCount()).to.eql(2); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.header.waitUntilLoadingHasFinished(); }); it('shows a warning on create new, and restores panels if continue is selected', async () => { await PageObjects.dashboard.clickNewDashboardExpectWarning(true); await PageObjects.header.waitUntilLoadingHasFinished(); expect(await PageObjects.dashboard.getPanelCount()).to.eql(2); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.header.waitUntilLoadingHasFinished(); }); it('shows a warning on create new, and clears unsaved panels if discard is selected', async () => { await PageObjects.dashboard.clickNewDashboardExpectWarning(); await PageObjects.header.waitUntilLoadingHasFinished(); expect(await PageObjects.dashboard.getPanelCount()).to.eql(0); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.header.waitUntilLoadingHasFinished(); }); it('does not show unsaved changes on new dashboard when no panels have been added', async () => { await PageObjects.dashboard.expectUnsavedChangesDoesNotExist(unsavedDashboardTitle); }); it('can discard unsaved changes using the discard link', async () => { await PageObjects.dashboard.clickUnsavedChangesDiscard(dashboardTitle); await PageObjects.dashboard.expectUnsavedChangesDoesNotExist(dashboardTitle); await PageObjects.dashboard.loadSavedDashboard(dashboardTitle); await PageObjects.dashboard.switchToEditMode(); const currentPanelCount = await PageObjects.dashboard.getPanelCount(); expect(currentPanelCount).to.eql(existingDashboardPanelCount - 2); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.header.waitUntilLoadingHasFinished(); }); it('loses unsaved changes to new dashboard upon saving', async () => { await PageObjects.dashboard.clickNewDashboard(); await addSomePanels(); // ensure that the unsaved listing exists first await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.clickUnsavedChangesContinueEditing(unsavedDashboardTitle); await PageObjects.header.waitUntilLoadingHasFinished(); // Save the dashboard, and check that it now does not exist await PageObjects.dashboard.saveDashboard(newDashboartTitle); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.expectUnsavedChangesDoesNotExist(unsavedDashboardTitle); }); it('does not list unsaved changes when unsaved version of the dashboard is the same', async () => { await PageObjects.dashboard.loadSavedDashboard(newDashboartTitle); await PageObjects.dashboard.switchToEditMode(); // add another panel so we can delete it later await dashboardAddPanel.clickCreateNewLink(); await PageObjects.visualize.clickAggBasedVisualizations(); await PageObjects.visualize.clickAreaChart(); await PageObjects.visualize.clickNewSearch(); await PageObjects.visualize.saveVisualizationExpectSuccess('Wildvis', { redirectToOrigin: true, }); // ensure that the unsaved listing exists await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.expectUnsavedChangesListingExists(newDashboartTitle); await PageObjects.dashboard.clickUnsavedChangesContinueEditing(newDashboartTitle); await PageObjects.header.waitUntilLoadingHasFinished(); // Remove the panel that was just added await dashboardPanelActions.removePanelByTitle('Wildvis'); await PageObjects.header.waitUntilLoadingHasFinished(); // Check that it now does not exist await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.expectUnsavedChangesDoesNotExist(newDashboartTitle); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/dashboard_unsaved_state.ts b/test/functional/apps/dashboard/dashboard_unsaved_state.ts index e6cc91880010a..1df77348972da 100644 --- a/test/functional/apps/dashboard/dashboard_unsaved_state.ts +++ b/test/functional/apps/dashboard/dashboard_unsaved_state.ts @@ -1,109 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']); - const esArchiver = getService('esArchiver'); - const testSubjects = getService('testSubjects'); - const kibanaServer = getService('kibanaServer'); - const dashboardAddPanel = getService('dashboardAddPanel'); - - let originalPanelCount = 0; - let unsavedPanelCount = 0; - - // FLAKY: https://github.com/elastic/kibana/issues/91191 - describe.skip('dashboard unsaved panels', () => { - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.loadSavedDashboard('few panels'); - await PageObjects.header.waitUntilLoadingHasFinished(); - originalPanelCount = await PageObjects.dashboard.getPanelCount(); - }); - - it('does not show unsaved changes badge when there are no unsaved changes', async () => { - await testSubjects.missingOrFail('dashboardUnsavedChangesBadge'); - }); - - it('shows the unsaved changes badge after adding panels', async () => { - await PageObjects.dashboard.switchToEditMode(); - // add an area chart by value - await dashboardAddPanel.clickCreateNewLink(); - await PageObjects.visualize.clickAggBasedVisualizations(); - await PageObjects.visualize.clickAreaChart(); - await PageObjects.visualize.clickNewSearch(); - await PageObjects.visualize.saveVisualizationAndReturn(); - - // add a metric by reference - await dashboardAddPanel.addVisualization('Rendering-Test: metric'); - - await PageObjects.header.waitUntilLoadingHasFinished(); - await testSubjects.existOrFail('dashboardUnsavedChangesBadge'); - }); - - it('has correct number of panels', async () => { - unsavedPanelCount = await PageObjects.dashboard.getPanelCount(); - expect(unsavedPanelCount).to.eql(originalPanelCount + 2); - }); - - it('retains unsaved panel count after navigating to listing page and back', async () => { - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.loadSavedDashboard('few panels'); - await PageObjects.dashboard.switchToEditMode(); - const currentPanelCount = await PageObjects.dashboard.getPanelCount(); - expect(currentPanelCount).to.eql(unsavedPanelCount); - }); - - it('retains unsaved panel count after navigating to another app and back', async () => { - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.visualize.gotoVisualizationLandingPage(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.common.navigateToApp('dashboards'); - await PageObjects.dashboard.loadSavedDashboard('few panels'); - await PageObjects.dashboard.switchToEditMode(); - const currentPanelCount = await PageObjects.dashboard.getPanelCount(); - expect(currentPanelCount).to.eql(unsavedPanelCount); - }); - - it('resets to original panel count upon entering view mode', async () => { - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.clickCancelOutOfEditMode(); - await PageObjects.header.waitUntilLoadingHasFinished(); - const currentPanelCount = await PageObjects.dashboard.getPanelCount(); - expect(currentPanelCount).to.eql(originalPanelCount); - }); - - it('shows unsaved changes badge in view mode if changes have not been discarded', async () => { - await testSubjects.existOrFail('dashboardUnsavedChangesBadge'); - }); - - it('retains unsaved panel count after returning to edit mode', async () => { - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.switchToEditMode(); - await PageObjects.header.waitUntilLoadingHasFinished(); - const currentPanelCount = await PageObjects.dashboard.getPanelCount(); - expect(currentPanelCount).to.eql(unsavedPanelCount); - }); - - it('does not show unsaved changes badge after saving', async () => { - await PageObjects.dashboard.saveDashboard('Unsaved State Test'); - await PageObjects.header.waitUntilLoadingHasFinished(); - await testSubjects.missingOrFail('dashboardUnsavedChangesBadge'); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']); const esArchiver = getService('esArchiver'); const testSubjects = getService('testSubjects'); const kibanaServer = getService('kibanaServer'); const dashboardAddPanel = getService('dashboardAddPanel'); let originalPanelCount = 0; let unsavedPanelCount = 0; // FLAKY: https://github.com/elastic/kibana/issues/91191 describe.skip('dashboard unsaved panels', () => { before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.loadSavedDashboard('few panels'); await PageObjects.header.waitUntilLoadingHasFinished(); originalPanelCount = await PageObjects.dashboard.getPanelCount(); }); it('does not show unsaved changes badge when there are no unsaved changes', async () => { await testSubjects.missingOrFail('dashboardUnsavedChangesBadge'); }); it('shows the unsaved changes badge after adding panels', async () => { await PageObjects.dashboard.switchToEditMode(); // add an area chart by value await dashboardAddPanel.clickCreateNewLink(); await PageObjects.visualize.clickAggBasedVisualizations(); await PageObjects.visualize.clickAreaChart(); await PageObjects.visualize.clickNewSearch(); await PageObjects.visualize.saveVisualizationAndReturn(); // add a metric by reference await dashboardAddPanel.addVisualization('Rendering-Test: metric'); await PageObjects.header.waitUntilLoadingHasFinished(); await testSubjects.existOrFail('dashboardUnsavedChangesBadge'); }); it('has correct number of panels', async () => { unsavedPanelCount = await PageObjects.dashboard.getPanelCount(); expect(unsavedPanelCount).to.eql(originalPanelCount + 2); }); it('retains unsaved panel count after navigating to listing page and back', async () => { await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.loadSavedDashboard('few panels'); await PageObjects.dashboard.switchToEditMode(); const currentPanelCount = await PageObjects.dashboard.getPanelCount(); expect(currentPanelCount).to.eql(unsavedPanelCount); }); it('retains unsaved panel count after navigating to another app and back', async () => { await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.visualize.gotoVisualizationLandingPage(); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.common.navigateToApp('dashboards'); await PageObjects.dashboard.loadSavedDashboard('few panels'); await PageObjects.dashboard.switchToEditMode(); const currentPanelCount = await PageObjects.dashboard.getPanelCount(); expect(currentPanelCount).to.eql(unsavedPanelCount); }); it('resets to original panel count upon entering view mode', async () => { await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.clickCancelOutOfEditMode(); await PageObjects.header.waitUntilLoadingHasFinished(); const currentPanelCount = await PageObjects.dashboard.getPanelCount(); expect(currentPanelCount).to.eql(originalPanelCount); }); it('shows unsaved changes badge in view mode if changes have not been discarded', async () => { await testSubjects.existOrFail('dashboardUnsavedChangesBadge'); }); it('retains unsaved panel count after returning to edit mode', async () => { await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.switchToEditMode(); await PageObjects.header.waitUntilLoadingHasFinished(); const currentPanelCount = await PageObjects.dashboard.getPanelCount(); expect(currentPanelCount).to.eql(unsavedPanelCount); }); it('does not show unsaved changes badge after saving', async () => { await PageObjects.dashboard.saveDashboard('Unsaved State Test'); await PageObjects.header.waitUntilLoadingHasFinished(); await testSubjects.missingOrFail('dashboardUnsavedChangesBadge'); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/data_shared_attributes.ts b/test/functional/apps/dashboard/data_shared_attributes.ts index 2d6396be80f46..e873f9fa8be4e 100644 --- a/test/functional/apps/dashboard/data_shared_attributes.ts +++ b/test/functional/apps/dashboard/data_shared_attributes.ts @@ -1,116 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const retry = getService('retry'); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const dashboardPanelActions = getService('dashboardPanelActions'); - const PageObjects = getPageObjects(['common', 'dashboard', 'timePicker']); - - describe('dashboard data-shared attributes', function describeIndexTests() { - let originalPanelTitles: string[]; - - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.loadSavedDashboard('dashboard with everything'); - await PageObjects.dashboard.waitForRenderComplete(); - }); - - it('should have time picker with data-shared-timefilter-duration', async () => { - await retry.try(async () => { - const sharedData = await PageObjects.timePicker.getTimeDurationForSharing(); - expect(sharedData).to.not.be(null); - }); - }); - - it('should have data-shared-items-count set to the number of embeddables on the dashboard', async () => { - await retry.try(async () => { - const sharedItemsCount = await PageObjects.dashboard.getSharedItemsCount(); - const panelCount = await PageObjects.dashboard.getPanelCount(); - expect(sharedItemsCount).to.eql(panelCount); - }); - }); - - it('should have panels with expected data-shared-item title', async () => { - await retry.try(async () => { - const sharedData = await PageObjects.dashboard.getPanelSharedItemData(); - originalPanelTitles = await PageObjects.dashboard.getPanelTitles(); - expect(sharedData.map((item) => item.title)).to.eql(originalPanelTitles); - }); - }); - - it('data shared item container data has description and title set', async () => { - const sharedContainerData = await PageObjects.dashboard.getSharedContainerData(); - expect(sharedContainerData.title).to.be('dashboard with everything'); - expect(sharedContainerData.description).to.be( - 'I have one of every visualization type since the last time I was created!' - ); - }); - - it('data-shared-item title should update a viz when using a custom panel title', async () => { - await PageObjects.dashboard.switchToEditMode(); - const CUSTOM_VIS_TITLE = 'ima custom title for a vis!'; - await dashboardPanelActions.setCustomPanelTitle(CUSTOM_VIS_TITLE); - await retry.try(async () => { - const sharedData = await PageObjects.dashboard.getPanelSharedItemData(); - const foundSharedItemTitle = !!sharedData.find((item) => { - return item.title === CUSTOM_VIS_TITLE; - }); - expect(foundSharedItemTitle).to.be(true); - }); - }); - - it('data-shared-item title is cleared with an empty panel title string', async () => { - await dashboardPanelActions.toggleHidePanelTitle(); - await retry.try(async () => { - const sharedData = await PageObjects.dashboard.getPanelSharedItemData(); - const foundSharedItemTitle = !!sharedData.find((item) => { - return item.title === ''; - }); - expect(foundSharedItemTitle).to.be(true); - }); - await dashboardPanelActions.toggleHidePanelTitle(); - }); - - it('data-shared-item title can be reset', async () => { - await dashboardPanelActions.resetCustomPanelTitle(); - await retry.try(async () => { - const sharedData = await PageObjects.dashboard.getPanelSharedItemData(); - const foundOriginalSharedItemTitle = !!sharedData.find((item) => { - return item.title === originalPanelTitles[0]; - }); - expect(foundOriginalSharedItemTitle).to.be(true); - }); - }); - - it('data-shared-item title should update a saved search when using a custom panel title', async () => { - const CUSTOM_SEARCH_TITLE = 'ima custom title for a search!'; - await dashboardPanelActions.setCustomPanelTitle( - CUSTOM_SEARCH_TITLE, - 'Rendering Test: saved search' - ); - await retry.try(async () => { - const sharedData = await PageObjects.dashboard.getPanelSharedItemData(); - const foundSharedItemTitle = !!sharedData.find((item) => { - return item.title === CUSTOM_SEARCH_TITLE; - }); - expect(foundSharedItemTitle).to.be(true); - }); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const retry = getService('retry'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const dashboardPanelActions = getService('dashboardPanelActions'); const PageObjects = getPageObjects(['common', 'dashboard', 'timePicker']); describe('dashboard data-shared attributes', function describeIndexTests() { let originalPanelTitles: string[]; before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.loadSavedDashboard('dashboard with everything'); await PageObjects.dashboard.waitForRenderComplete(); }); it('should have time picker with data-shared-timefilter-duration', async () => { await retry.try(async () => { const sharedData = await PageObjects.timePicker.getTimeDurationForSharing(); expect(sharedData).to.not.be(null); }); }); it('should have data-shared-items-count set to the number of embeddables on the dashboard', async () => { await retry.try(async () => { const sharedItemsCount = await PageObjects.dashboard.getSharedItemsCount(); const panelCount = await PageObjects.dashboard.getPanelCount(); expect(sharedItemsCount).to.eql(panelCount); }); }); it('should have panels with expected data-shared-item title', async () => { await retry.try(async () => { const sharedData = await PageObjects.dashboard.getPanelSharedItemData(); originalPanelTitles = await PageObjects.dashboard.getPanelTitles(); expect(sharedData.map((item) => item.title)).to.eql(originalPanelTitles); }); }); it('data shared item container data has description and title set', async () => { const sharedContainerData = await PageObjects.dashboard.getSharedContainerData(); expect(sharedContainerData.title).to.be('dashboard with everything'); expect(sharedContainerData.description).to.be( 'I have one of every visualization type since the last time I was created!' ); }); it('data-shared-item title should update a viz when using a custom panel title', async () => { await PageObjects.dashboard.switchToEditMode(); const CUSTOM_VIS_TITLE = 'ima custom title for a vis!'; await dashboardPanelActions.setCustomPanelTitle(CUSTOM_VIS_TITLE); await retry.try(async () => { const sharedData = await PageObjects.dashboard.getPanelSharedItemData(); const foundSharedItemTitle = !!sharedData.find((item) => { return item.title === CUSTOM_VIS_TITLE; }); expect(foundSharedItemTitle).to.be(true); }); }); it('data-shared-item title is cleared with an empty panel title string', async () => { await dashboardPanelActions.toggleHidePanelTitle(); await retry.try(async () => { const sharedData = await PageObjects.dashboard.getPanelSharedItemData(); const foundSharedItemTitle = !!sharedData.find((item) => { return item.title === ''; }); expect(foundSharedItemTitle).to.be(true); }); await dashboardPanelActions.toggleHidePanelTitle(); }); it('data-shared-item title can be reset', async () => { await dashboardPanelActions.resetCustomPanelTitle(); await retry.try(async () => { const sharedData = await PageObjects.dashboard.getPanelSharedItemData(); const foundOriginalSharedItemTitle = !!sharedData.find((item) => { return item.title === originalPanelTitles[0]; }); expect(foundOriginalSharedItemTitle).to.be(true); }); }); it('data-shared-item title should update a saved search when using a custom panel title', async () => { const CUSTOM_SEARCH_TITLE = 'ima custom title for a search!'; await dashboardPanelActions.setCustomPanelTitle( CUSTOM_SEARCH_TITLE, 'Rendering Test: saved search' ); await retry.try(async () => { const sharedData = await PageObjects.dashboard.getPanelSharedItemData(); const foundSharedItemTitle = !!sharedData.find((item) => { return item.title === CUSTOM_SEARCH_TITLE; }); expect(foundSharedItemTitle).to.be(true); }); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/edit_embeddable_redirects.ts b/test/functional/apps/dashboard/edit_embeddable_redirects.ts index 8b7b98a59aa12..affc3e0c87549 100644 --- a/test/functional/apps/dashboard/edit_embeddable_redirects.ts +++ b/test/functional/apps/dashboard/edit_embeddable_redirects.ts @@ -1,102 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']); - const esArchiver = getService('esArchiver'); - const testSubjects = getService('testSubjects'); - const kibanaServer = getService('kibanaServer'); - const dashboardPanelActions = getService('dashboardPanelActions'); - const dashboardVisualizations = getService('dashboardVisualizations'); - - describe('edit embeddable redirects', () => { - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.loadSavedDashboard('few panels'); - await PageObjects.dashboard.switchToEditMode(); - }); - - it('redirects via save and return button after edit', async () => { - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickEdit(); - await PageObjects.visualize.saveVisualizationAndReturn(); - }); - - it('redirects via save as button after edit, renaming itself', async () => { - const newTitle = 'wowee, looks like I have a new title'; - const originalPanelCount = await PageObjects.dashboard.getPanelCount(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickEdit(); - await PageObjects.visualize.saveVisualizationExpectSuccess(newTitle, { - saveAsNew: false, - redirectToOrigin: true, - }); - await PageObjects.header.waitUntilLoadingHasFinished(); - const newPanelCount = await PageObjects.dashboard.getPanelCount(); - expect(newPanelCount).to.eql(originalPanelCount); - const titles = await PageObjects.dashboard.getPanelTitles(); - expect(titles.indexOf(newTitle)).to.not.be(-1); - }); - - it('redirects via save as button after edit, adding a new panel', async () => { - const newTitle = 'wowee, my title just got cooler'; - const originalPanelCount = await PageObjects.dashboard.getPanelCount(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickEdit(); - await PageObjects.visualize.saveVisualizationExpectSuccess(newTitle, { - saveAsNew: true, - redirectToOrigin: true, - }); - await PageObjects.header.waitUntilLoadingHasFinished(); - const newPanelCount = await PageObjects.dashboard.getPanelCount(); - expect(newPanelCount).to.eql(originalPanelCount + 1); - const titles = await PageObjects.dashboard.getPanelTitles(); - expect(titles.indexOf(newTitle)).to.not.be(-1); - }); - - it('loses originatingApp connection after save as when redirectToOrigin is false', async () => { - const newTitle = 'wowee, my title just got cooler again'; - await PageObjects.header.waitUntilLoadingHasFinished(); - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickEdit(); - await PageObjects.visualize.linkedToOriginatingApp(); - await PageObjects.visualize.saveVisualizationExpectSuccess(newTitle, { - saveAsNew: true, - redirectToOrigin: false, - }); - await PageObjects.visualize.notLinkedToOriginatingApp(); - await PageObjects.common.navigateToApp('dashboard'); - }); - - it('loses originatingApp connection after first save when redirectToOrigin is false', async () => { - const newTitle = 'test create panel originatingApp'; - await PageObjects.dashboard.loadSavedDashboard('few panels'); - await PageObjects.dashboard.switchToEditMode(); - await testSubjects.exists('dashboardAddNewPanelButton'); - await testSubjects.click('dashboardAddNewPanelButton'); - await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); - await PageObjects.visualize.clickMarkdownWidget(); - await PageObjects.visualize.saveVisualizationExpectSuccess(newTitle, { - saveAsNew: true, - redirectToOrigin: false, - }); - await PageObjects.visualize.notLinkedToOriginatingApp(); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']); const esArchiver = getService('esArchiver'); const testSubjects = getService('testSubjects'); const kibanaServer = getService('kibanaServer'); const dashboardPanelActions = getService('dashboardPanelActions'); const dashboardVisualizations = getService('dashboardVisualizations'); describe('edit embeddable redirects', () => { before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.loadSavedDashboard('few panels'); await PageObjects.dashboard.switchToEditMode(); }); it('redirects via save and return button after edit', async () => { await dashboardPanelActions.openContextMenu(); await dashboardPanelActions.clickEdit(); await PageObjects.visualize.saveVisualizationAndReturn(); }); it('redirects via save as button after edit, renaming itself', async () => { const newTitle = 'wowee, looks like I have a new title'; const originalPanelCount = await PageObjects.dashboard.getPanelCount(); await PageObjects.header.waitUntilLoadingHasFinished(); await dashboardPanelActions.openContextMenu(); await dashboardPanelActions.clickEdit(); await PageObjects.visualize.saveVisualizationExpectSuccess(newTitle, { saveAsNew: false, redirectToOrigin: true, }); await PageObjects.header.waitUntilLoadingHasFinished(); const newPanelCount = await PageObjects.dashboard.getPanelCount(); expect(newPanelCount).to.eql(originalPanelCount); const titles = await PageObjects.dashboard.getPanelTitles(); expect(titles.indexOf(newTitle)).to.not.be(-1); }); it('redirects via save as button after edit, adding a new panel', async () => { const newTitle = 'wowee, my title just got cooler'; const originalPanelCount = await PageObjects.dashboard.getPanelCount(); await PageObjects.header.waitUntilLoadingHasFinished(); await dashboardPanelActions.openContextMenu(); await dashboardPanelActions.clickEdit(); await PageObjects.visualize.saveVisualizationExpectSuccess(newTitle, { saveAsNew: true, redirectToOrigin: true, }); await PageObjects.header.waitUntilLoadingHasFinished(); const newPanelCount = await PageObjects.dashboard.getPanelCount(); expect(newPanelCount).to.eql(originalPanelCount + 1); const titles = await PageObjects.dashboard.getPanelTitles(); expect(titles.indexOf(newTitle)).to.not.be(-1); }); it('loses originatingApp connection after save as when redirectToOrigin is false', async () => { const newTitle = 'wowee, my title just got cooler again'; await PageObjects.header.waitUntilLoadingHasFinished(); await dashboardPanelActions.openContextMenu(); await dashboardPanelActions.clickEdit(); await PageObjects.visualize.linkedToOriginatingApp(); await PageObjects.visualize.saveVisualizationExpectSuccess(newTitle, { saveAsNew: true, redirectToOrigin: false, }); await PageObjects.visualize.notLinkedToOriginatingApp(); await PageObjects.common.navigateToApp('dashboard'); }); it('loses originatingApp connection after first save when redirectToOrigin is false', async () => { const newTitle = 'test create panel originatingApp'; await PageObjects.dashboard.loadSavedDashboard('few panels'); await PageObjects.dashboard.switchToEditMode(); await testSubjects.exists('dashboardAddNewPanelButton'); await testSubjects.click('dashboardAddNewPanelButton'); await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); await PageObjects.visualize.clickMarkdownWidget(); await PageObjects.visualize.saveVisualizationExpectSuccess(newTitle, { saveAsNew: true, redirectToOrigin: false, }); await PageObjects.visualize.notLinkedToOriginatingApp(); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/embed_mode.ts b/test/functional/apps/dashboard/embed_mode.ts index b96e957262573..370327b720fb5 100644 --- a/test/functional/apps/dashboard/embed_mode.ts +++ b/test/functional/apps/dashboard/embed_mode.ts @@ -1,86 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - const retry = getService('retry'); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const PageObjects = getPageObjects(['dashboard', 'common']); - const browser = getService('browser'); - const globalNav = getService('globalNav'); - - describe('embed mode', () => { - const urlParamExtensions = [ - 'show-top-menu=true', - 'show-query-input=true', - 'show-time-filter=true', - 'hide-filter-bar=true', - ]; - - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.loadSavedDashboard('few panels'); - }); - - it('hides the chrome', async () => { - const globalNavShown = await globalNav.exists(); - expect(globalNavShown).to.be(true); - - const currentUrl = await browser.getCurrentUrl(); - const newUrl = currentUrl + '&embed=true'; - // Embed parameter only works on a hard refresh. - const useTimeStamp = true; - await browser.get(newUrl.toString(), useTimeStamp); - - await retry.try(async () => { - const globalNavHidden = !(await globalNav.exists()); - expect(globalNavHidden).to.be(true); - }); - }); - - it('shows or hides elements based on URL params', async () => { - await testSubjects.missingOrFail('top-nav'); - await testSubjects.missingOrFail('queryInput'); - await testSubjects.missingOrFail('superDatePickerToggleQuickMenuButton'); - await testSubjects.existOrFail('showFilterActions'); - - const currentUrl = await browser.getCurrentUrl(); - const newUrl = [currentUrl].concat(urlParamExtensions).join('&'); - // Embed parameter only works on a hard refresh. - const useTimeStamp = true; - await browser.get(newUrl.toString(), useTimeStamp); - - await testSubjects.existOrFail('top-nav'); - await testSubjects.existOrFail('queryInput'); - await testSubjects.existOrFail('superDatePickerToggleQuickMenuButton'); - await testSubjects.missingOrFail('showFilterActions'); - }); - - after(async function () { - const currentUrl = await browser.getCurrentUrl(); - const replaceParams = ['', 'embed=true'].concat(urlParamExtensions).join('&'); - const newUrl = currentUrl.replace(replaceParams, ''); - // First use the timestamp to cause a hard refresh so the new embed parameter works correctly. - let useTimeStamp = true; - await browser.get(newUrl.toString(), useTimeStamp); - // Then get rid of the timestamp so the rest of the tests work with state and app switching. - useTimeStamp = false; - await browser.get(newUrl.toString(), useTimeStamp); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const retry = getService('retry'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const PageObjects = getPageObjects(['dashboard', 'common']); const browser = getService('browser'); const globalNav = getService('globalNav'); describe('embed mode', () => { const urlParamExtensions = [ 'show-top-menu=true', 'show-query-input=true', 'show-time-filter=true', 'hide-filter-bar=true', ]; before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.loadSavedDashboard('few panels'); }); it('hides the chrome', async () => { const globalNavShown = await globalNav.exists(); expect(globalNavShown).to.be(true); const currentUrl = await browser.getCurrentUrl(); const newUrl = currentUrl + '&embed=true'; // Embed parameter only works on a hard refresh. const useTimeStamp = true; await browser.get(newUrl.toString(), useTimeStamp); await retry.try(async () => { const globalNavHidden = !(await globalNav.exists()); expect(globalNavHidden).to.be(true); }); }); it('shows or hides elements based on URL params', async () => { await testSubjects.missingOrFail('top-nav'); await testSubjects.missingOrFail('queryInput'); await testSubjects.missingOrFail('superDatePickerToggleQuickMenuButton'); await testSubjects.existOrFail('showFilterActions'); const currentUrl = await browser.getCurrentUrl(); const newUrl = [currentUrl].concat(urlParamExtensions).join('&'); // Embed parameter only works on a hard refresh. const useTimeStamp = true; await browser.get(newUrl.toString(), useTimeStamp); await testSubjects.existOrFail('top-nav'); await testSubjects.existOrFail('queryInput'); await testSubjects.existOrFail('superDatePickerToggleQuickMenuButton'); await testSubjects.missingOrFail('showFilterActions'); }); after(async function () { const currentUrl = await browser.getCurrentUrl(); const replaceParams = ['', 'embed=true'].concat(urlParamExtensions).join('&'); const newUrl = currentUrl.replace(replaceParams, ''); // First use the timestamp to cause a hard refresh so the new embed parameter works correctly. let useTimeStamp = true; await browser.get(newUrl.toString(), useTimeStamp); // Then get rid of the timestamp so the rest of the tests work with state and app switching. useTimeStamp = false; await browser.get(newUrl.toString(), useTimeStamp); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/embeddable_library.ts b/test/functional/apps/dashboard/embeddable_library.ts index 20fe9aeb1387a..646401107e73c 100644 --- a/test/functional/apps/dashboard/embeddable_library.ts +++ b/test/functional/apps/dashboard/embeddable_library.ts @@ -1,111 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']); - const esArchiver = getService('esArchiver'); - const find = getService('find'); - const kibanaServer = getService('kibanaServer'); - const testSubjects = getService('testSubjects'); - const dashboardAddPanel = getService('dashboardAddPanel'); - const panelActions = getService('dashboardPanelActions'); - - describe('embeddable library', () => { - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.clickNewDashboard(); - }); - - it('unlink visualize panel from embeddable library', async () => { - // add heatmap panel from library - await dashboardAddPanel.clickOpenAddPanel(); - await dashboardAddPanel.filterEmbeddableNames('Rendering Test: heatmap'); - await find.clickByButtonText('Rendering Test: heatmap'); - await dashboardAddPanel.closeAddPanel(); - - const originalPanel = await testSubjects.find('embeddablePanelHeading-RenderingTest:heatmap'); - await panelActions.unlinkFromLibary(originalPanel); - await testSubjects.existOrFail('unlinkPanelSuccess'); - - const updatedPanel = await testSubjects.find('embeddablePanelHeading-RenderingTest:heatmap'); - const libraryActionExists = await testSubjects.descendantExists( - 'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION', - updatedPanel - ); - expect(libraryActionExists).to.be(false); - - await dashboardAddPanel.clickOpenAddPanel(); - await dashboardAddPanel.filterEmbeddableNames('Rendering Test: heatmap'); - await find.existsByLinkText('Rendering Test: heatmap'); - await dashboardAddPanel.closeAddPanel(); - }); - - it('save visualize panel to embeddable library', async () => { - const originalPanel = await testSubjects.find('embeddablePanelHeading-RenderingTest:heatmap'); - await panelActions.saveToLibrary('Rendering Test: heatmap - copy', originalPanel); - await testSubjects.existOrFail('addPanelToLibrarySuccess'); - - const updatedPanel = await testSubjects.find( - 'embeddablePanelHeading-RenderingTest:heatmap-copy' - ); - const libraryActionExists = await testSubjects.descendantExists( - 'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION', - updatedPanel - ); - expect(libraryActionExists).to.be(true); - }); - - it('unlink map panel from embeddable library', async () => { - // add map panel from library - await dashboardAddPanel.clickOpenAddPanel(); - await dashboardAddPanel.filterEmbeddableNames('Rendering Test: geo map'); - await find.clickByButtonText('Rendering Test: geo map'); - await dashboardAddPanel.closeAddPanel(); - - const originalPanel = await testSubjects.find('embeddablePanelHeading-RenderingTest:geomap'); - await panelActions.unlinkFromLibary(originalPanel); - await testSubjects.existOrFail('unlinkPanelSuccess'); - - const updatedPanel = await testSubjects.find('embeddablePanelHeading-RenderingTest:geomap'); - const libraryActionExists = await testSubjects.descendantExists( - 'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION', - updatedPanel - ); - expect(libraryActionExists).to.be(false); - - await dashboardAddPanel.clickOpenAddPanel(); - await dashboardAddPanel.filterEmbeddableNames('Rendering Test: geo map'); - await find.existsByLinkText('Rendering Test: geo map'); - await dashboardAddPanel.closeAddPanel(); - }); - - it('save map panel to embeddable library', async () => { - const originalPanel = await testSubjects.find('embeddablePanelHeading-RenderingTest:geomap'); - await panelActions.saveToLibrary('Rendering Test: geo map - copy', originalPanel); - await testSubjects.existOrFail('addPanelToLibrarySuccess'); - - const updatedPanel = await testSubjects.find( - 'embeddablePanelHeading-RenderingTest:geomap-copy' - ); - const libraryActionExists = await testSubjects.descendantExists( - 'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION', - updatedPanel - ); - expect(libraryActionExists).to.be(true); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'settings', 'common']); const esArchiver = getService('esArchiver'); const find = getService('find'); const kibanaServer = getService('kibanaServer'); const testSubjects = getService('testSubjects'); const dashboardAddPanel = getService('dashboardAddPanel'); const panelActions = getService('dashboardPanelActions'); describe('embeddable library', () => { before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.clickNewDashboard(); }); it('unlink visualize panel from embeddable library', async () => { // add heatmap panel from library await dashboardAddPanel.clickOpenAddPanel(); await dashboardAddPanel.filterEmbeddableNames('Rendering Test: heatmap'); await find.clickByButtonText('Rendering Test: heatmap'); await dashboardAddPanel.closeAddPanel(); const originalPanel = await testSubjects.find('embeddablePanelHeading-RenderingTest:heatmap'); await panelActions.unlinkFromLibary(originalPanel); await testSubjects.existOrFail('unlinkPanelSuccess'); const updatedPanel = await testSubjects.find('embeddablePanelHeading-RenderingTest:heatmap'); const libraryActionExists = await testSubjects.descendantExists( 'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION', updatedPanel ); expect(libraryActionExists).to.be(false); await dashboardAddPanel.clickOpenAddPanel(); await dashboardAddPanel.filterEmbeddableNames('Rendering Test: heatmap'); await find.existsByLinkText('Rendering Test: heatmap'); await dashboardAddPanel.closeAddPanel(); }); it('save visualize panel to embeddable library', async () => { const originalPanel = await testSubjects.find('embeddablePanelHeading-RenderingTest:heatmap'); await panelActions.saveToLibrary('Rendering Test: heatmap - copy', originalPanel); await testSubjects.existOrFail('addPanelToLibrarySuccess'); const updatedPanel = await testSubjects.find( 'embeddablePanelHeading-RenderingTest:heatmap-copy' ); const libraryActionExists = await testSubjects.descendantExists( 'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION', updatedPanel ); expect(libraryActionExists).to.be(true); }); it('unlink map panel from embeddable library', async () => { // add map panel from library await dashboardAddPanel.clickOpenAddPanel(); await dashboardAddPanel.filterEmbeddableNames('Rendering Test: geo map'); await find.clickByButtonText('Rendering Test: geo map'); await dashboardAddPanel.closeAddPanel(); const originalPanel = await testSubjects.find('embeddablePanelHeading-RenderingTest:geomap'); await panelActions.unlinkFromLibary(originalPanel); await testSubjects.existOrFail('unlinkPanelSuccess'); const updatedPanel = await testSubjects.find('embeddablePanelHeading-RenderingTest:geomap'); const libraryActionExists = await testSubjects.descendantExists( 'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION', updatedPanel ); expect(libraryActionExists).to.be(false); await dashboardAddPanel.clickOpenAddPanel(); await dashboardAddPanel.filterEmbeddableNames('Rendering Test: geo map'); await find.existsByLinkText('Rendering Test: geo map'); await dashboardAddPanel.closeAddPanel(); }); it('save map panel to embeddable library', async () => { const originalPanel = await testSubjects.find('embeddablePanelHeading-RenderingTest:geomap'); await panelActions.saveToLibrary('Rendering Test: geo map - copy', originalPanel); await testSubjects.existOrFail('addPanelToLibrarySuccess'); const updatedPanel = await testSubjects.find( 'embeddablePanelHeading-RenderingTest:geomap-copy' ); const libraryActionExists = await testSubjects.descendantExists( 'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION', updatedPanel ); expect(libraryActionExists).to.be(true); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/embeddable_rendering.ts b/test/functional/apps/dashboard/embeddable_rendering.ts index 2a9551786de6e..fab38bbfa3ed5 100644 --- a/test/functional/apps/dashboard/embeddable_rendering.ts +++ b/test/functional/apps/dashboard/embeddable_rendering.ts @@ -1,185 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -/** - * This tests both that one of each visualization can be added to a dashboard (as opposed to opening an existing - * dashboard with the visualizations already on it), as well as conducts a rough type of snapshot testing by checking - * for various ui components. The downside is these tests are a bit fragile to css changes (though not as fragile as - * actual screenshot snapshot regression testing), and can be difficult to diagnose failures (which visualization - * broke?). The upside is that this offers very good coverage with a minimal time investment. - */ - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const find = getService('find'); - const browser = getService('browser'); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const pieChart = getService('pieChart'); - const security = getService('security'); - const dashboardExpect = getService('dashboardExpect'); - const dashboardAddPanel = getService('dashboardAddPanel'); - const PageObjects = getPageObjects([ - 'common', - 'dashboard', - 'header', - 'visualize', - 'discover', - 'timePicker', - ]); - let visNames: string[] = []; - - const expectAllDataRenders = async () => { - await pieChart.expectPieSliceCount(16); - await dashboardExpect.metricValuesExist(['7,544']); - await dashboardExpect.seriesElementCount(19); - const tsvbGuageExists = await find.existsByCssSelector('.tvbVisHalfGauge'); - expect(tsvbGuageExists).to.be(true); - await dashboardExpect.timelionLegendCount(0); - await dashboardExpect.markdownWithValuesExists(["I'm a markdown!"]); - await dashboardExpect.vegaTextsExist(['5,000']); - await dashboardExpect.goalAndGuageLabelsExist(['62.925%', '55.625%', '11.915 GB']); - await dashboardExpect.dataTableRowCount(5); - await dashboardExpect.tagCloudWithValuesFound(['CN', 'IN', 'US', 'BR', 'ID']); - // TODO add test for 'region map viz' - // TODO add test for 'tsvb gauge' viz - // TODO add test for 'geo map' viz - // This tests the presence of the two input control embeddables - await dashboardExpect.inputControlItemCount(5); - await dashboardExpect.tsvbTableCellCount(20); - await dashboardExpect.tsvbMarkdownWithValuesExists(['Hi Avg last bytes: 6286.674715909091']); - await dashboardExpect.tsvbTopNValuesExist(['5,734.79', '6,286.675']); - await dashboardExpect.tsvbMetricValuesExist(['210,007,889,606']); - // TODO add test for 'animal sound pie' viz - // This tests the area chart and non timebased line chart points - await dashboardExpect.lineChartPointsCount(5); - // TODO add test for 'scripted filter and query' viz - // TODO add test for 'animal weight linked to search' viz - // TODO add test for the last vega viz - await dashboardExpect.savedSearchRowCount(50); - }; - - const expectNoDataRenders = async () => { - await pieChart.expectPieSliceCount(0); - await dashboardExpect.seriesElementCount(0); - await dashboardExpect.dataTableNoResult(); - await dashboardExpect.savedSearchRowCount(0); - await dashboardExpect.inputControlItemCount(5); - await dashboardExpect.metricValuesExist(['0']); - await dashboardExpect.markdownWithValuesExists(["I'm a markdown!"]); - - // Three instead of 0 because there is a visualization based off a non time based index that - // should still show data. - await dashboardExpect.lineChartPointsCount(3); - - await dashboardExpect.timelionLegendCount(0); - const tsvbGuageExists = await find.existsByCssSelector('.tvbVisHalfGauge'); - expect(tsvbGuageExists).to.be(true); - await dashboardExpect.tsvbMetricValuesExist(['0']); - await dashboardExpect.tsvbMarkdownWithValuesExists(['Hi Avg last bytes: 0']); - await dashboardExpect.tsvbTableCellCount(0); - await dashboardExpect.tsvbTopNValuesExist(['0']); - await dashboardExpect.vegaTextsDoNotExist(['5,000']); - }; - - // Failing: See https://github.com/elastic/kibana/issues/76245 - describe.skip('dashboard embeddable rendering', function describeIndexTests() { - before(async () => { - await security.testUser.setRoles(['kibana_admin', 'animals', 'test_logstash_reader']); - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.clickNewDashboard(); - - const fromTime = 'Jan 1, 2018 @ 00:00:00.000'; - const toTime = 'Apr 13, 2018 @ 00:00:00.000'; - await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime); - }); - - after(async () => { - // Get rid of the timestamp added in this test, as well any global or app state. - const currentUrl = await browser.getCurrentUrl(); - const newUrl = currentUrl.replace(/\?.*$/, ''); - await browser.get(newUrl, false); - await security.testUser.restoreDefaults(); - }); - - it('adding visualizations', async () => { - visNames = await dashboardAddPanel.addEveryVisualization('"Rendering Test"'); - await dashboardExpect.visualizationsArePresent(visNames); - - // This one is rendered via svg which lets us do better testing of what is being rendered. - visNames.push(await dashboardAddPanel.addVisualization('Filter Bytes Test: vega')); - await PageObjects.header.waitUntilLoadingHasFinished(); - await dashboardExpect.visualizationsArePresent(visNames); - expect(visNames.length).to.be.equal(27); - await PageObjects.dashboard.waitForRenderComplete(); - }); - - it('adding saved searches', async () => { - const visAndSearchNames = visNames.concat( - await dashboardAddPanel.addEverySavedSearch('"Rendering Test"') - ); - await dashboardAddPanel.closeAddPanel(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await dashboardExpect.visualizationsArePresent(visAndSearchNames); - expect(visAndSearchNames.length).to.be.equal(28); - await PageObjects.dashboard.waitForRenderComplete(); - - await PageObjects.dashboard.saveDashboard('embeddable rendering test', { - storeTimeWithDashboard: true, - }); - }); - - it('initial render test', async () => { - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.waitForRenderComplete(); - await expectAllDataRenders(); - }); - - it('data rendered correctly when dashboard is opened from listing page', async () => { - // Change the time to make sure that it's updated when re-opened from the listing page. - const fromTime = 'May 10, 2018 @ 00:00:00.000'; - const toTime = 'May 11, 2018 @ 00:00:00.000'; - await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime); - await PageObjects.dashboard.loadSavedDashboard('embeddable rendering test'); - await PageObjects.dashboard.waitForRenderComplete(); - await expectAllDataRenders(); - }); - - it('data rendered correctly when dashboard is hard refreshed', async () => { - const currentUrl = await browser.getCurrentUrl(); - await browser.get(currentUrl, true); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.dashboard.waitForRenderComplete(); - await expectAllDataRenders(); - }); - - it('panels are updated when time changes outside of data', async () => { - const fromTime = 'May 11, 2018 @ 00:00:00.000'; - const toTime = 'May 12, 2018 @ 00:00:00.000'; - await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime); - await PageObjects.dashboard.waitForRenderComplete(); - await expectNoDataRenders(); - }); - - it('panels are updated when time changes inside of data', async () => { - const fromTime = 'Jan 1, 2018 @ 00:00:00.000'; - const toTime = 'Apr 13, 2018 @ 00:00:00.000'; - await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime); - await PageObjects.dashboard.waitForRenderComplete(); - await expectAllDataRenders(); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; /** * This tests both that one of each visualization can be added to a dashboard (as opposed to opening an existing * dashboard with the visualizations already on it), as well as conducts a rough type of snapshot testing by checking * for various ui components. The downside is these tests are a bit fragile to css changes (though not as fragile as * actual screenshot snapshot regression testing), and can be difficult to diagnose failures (which visualization * broke?). The upside is that this offers very good coverage with a minimal time investment. */ export default function ({ getService, getPageObjects }: FtrProviderContext) { const find = getService('find'); const browser = getService('browser'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const pieChart = getService('pieChart'); const security = getService('security'); const dashboardExpect = getService('dashboardExpect'); const dashboardAddPanel = getService('dashboardAddPanel'); const PageObjects = getPageObjects([ 'common', 'dashboard', 'header', 'visualize', 'discover', 'timePicker', ]); let visNames: string[] = []; const expectAllDataRenders = async () => { await pieChart.expectPieSliceCount(16); await dashboardExpect.metricValuesExist(['7,544']); await dashboardExpect.seriesElementCount(19); const tsvbGuageExists = await find.existsByCssSelector('.tvbVisHalfGauge'); expect(tsvbGuageExists).to.be(true); await dashboardExpect.timelionLegendCount(0); await dashboardExpect.markdownWithValuesExists(["I'm a markdown!"]); await dashboardExpect.vegaTextsExist(['5,000']); await dashboardExpect.goalAndGuageLabelsExist(['62.925%', '55.625%', '11.915 GB']); await dashboardExpect.dataTableRowCount(5); await dashboardExpect.tagCloudWithValuesFound(['CN', 'IN', 'US', 'BR', 'ID']); // TODO add test for 'region map viz' // TODO add test for 'tsvb gauge' viz // TODO add test for 'geo map' viz // This tests the presence of the two input control embeddables await dashboardExpect.inputControlItemCount(5); await dashboardExpect.tsvbTableCellCount(20); await dashboardExpect.tsvbMarkdownWithValuesExists(['Hi Avg last bytes: 6286.674715909091']); await dashboardExpect.tsvbTopNValuesExist(['5,734.79', '6,286.675']); await dashboardExpect.tsvbMetricValuesExist(['210,007,889,606']); // TODO add test for 'animal sound pie' viz // This tests the area chart and non timebased line chart points await dashboardExpect.lineChartPointsCount(5); // TODO add test for 'scripted filter and query' viz // TODO add test for 'animal weight linked to search' viz // TODO add test for the last vega viz await dashboardExpect.savedSearchRowCount(50); }; const expectNoDataRenders = async () => { await pieChart.expectPieSliceCount(0); await dashboardExpect.seriesElementCount(0); await dashboardExpect.dataTableNoResult(); await dashboardExpect.savedSearchRowCount(0); await dashboardExpect.inputControlItemCount(5); await dashboardExpect.metricValuesExist(['0']); await dashboardExpect.markdownWithValuesExists(["I'm a markdown!"]); // Three instead of 0 because there is a visualization based off a non time based index that // should still show data. await dashboardExpect.lineChartPointsCount(3); await dashboardExpect.timelionLegendCount(0); const tsvbGuageExists = await find.existsByCssSelector('.tvbVisHalfGauge'); expect(tsvbGuageExists).to.be(true); await dashboardExpect.tsvbMetricValuesExist(['0']); await dashboardExpect.tsvbMarkdownWithValuesExists(['Hi Avg last bytes: 0']); await dashboardExpect.tsvbTableCellCount(0); await dashboardExpect.tsvbTopNValuesExist(['0']); await dashboardExpect.vegaTextsDoNotExist(['5,000']); }; // Failing: See https://github.com/elastic/kibana/issues/76245 describe.skip('dashboard embeddable rendering', function describeIndexTests() { before(async () => { await security.testUser.setRoles(['kibana_admin', 'animals', 'test_logstash_reader']); await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.clickNewDashboard(); const fromTime = 'Jan 1, 2018 @ 00:00:00.000'; const toTime = 'Apr 13, 2018 @ 00:00:00.000'; await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime); }); after(async () => { // Get rid of the timestamp added in this test, as well any global or app state. const currentUrl = await browser.getCurrentUrl(); const newUrl = currentUrl.replace(/\?.*$/, ''); await browser.get(newUrl, false); await security.testUser.restoreDefaults(); }); it('adding visualizations', async () => { visNames = await dashboardAddPanel.addEveryVisualization('"Rendering Test"'); await dashboardExpect.visualizationsArePresent(visNames); // This one is rendered via svg which lets us do better testing of what is being rendered. visNames.push(await dashboardAddPanel.addVisualization('Filter Bytes Test: vega')); await PageObjects.header.waitUntilLoadingHasFinished(); await dashboardExpect.visualizationsArePresent(visNames); expect(visNames.length).to.be.equal(27); await PageObjects.dashboard.waitForRenderComplete(); }); it('adding saved searches', async () => { const visAndSearchNames = visNames.concat( await dashboardAddPanel.addEverySavedSearch('"Rendering Test"') ); await dashboardAddPanel.closeAddPanel(); await PageObjects.header.waitUntilLoadingHasFinished(); await dashboardExpect.visualizationsArePresent(visAndSearchNames); expect(visAndSearchNames.length).to.be.equal(28); await PageObjects.dashboard.waitForRenderComplete(); await PageObjects.dashboard.saveDashboard('embeddable rendering test', { storeTimeWithDashboard: true, }); }); it('initial render test', async () => { await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.waitForRenderComplete(); await expectAllDataRenders(); }); it('data rendered correctly when dashboard is opened from listing page', async () => { // Change the time to make sure that it's updated when re-opened from the listing page. const fromTime = 'May 10, 2018 @ 00:00:00.000'; const toTime = 'May 11, 2018 @ 00:00:00.000'; await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime); await PageObjects.dashboard.loadSavedDashboard('embeddable rendering test'); await PageObjects.dashboard.waitForRenderComplete(); await expectAllDataRenders(); }); it('data rendered correctly when dashboard is hard refreshed', async () => { const currentUrl = await browser.getCurrentUrl(); await browser.get(currentUrl, true); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.dashboard.waitForRenderComplete(); await expectAllDataRenders(); }); it('panels are updated when time changes outside of data', async () => { const fromTime = 'May 11, 2018 @ 00:00:00.000'; const toTime = 'May 12, 2018 @ 00:00:00.000'; await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime); await PageObjects.dashboard.waitForRenderComplete(); await expectNoDataRenders(); }); it('panels are updated when time changes inside of data', async () => { const fromTime = 'Jan 1, 2018 @ 00:00:00.000'; const toTime = 'Apr 13, 2018 @ 00:00:00.000'; await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime); await PageObjects.dashboard.waitForRenderComplete(); await expectAllDataRenders(); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/empty_dashboard.ts b/test/functional/apps/dashboard/empty_dashboard.ts index c096d90aa3595..b7aa97e851710 100644 --- a/test/functional/apps/dashboard/empty_dashboard.ts +++ b/test/functional/apps/dashboard/empty_dashboard.ts @@ -1,61 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const dashboardAddPanel = getService('dashboardAddPanel'); - const dashboardVisualizations = getService('dashboardVisualizations'); - const dashboardExpect = getService('dashboardExpect'); - const PageObjects = getPageObjects(['common', 'dashboard']); - - describe('empty dashboard', () => { - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.clickNewDashboard(); - }); - - after(async () => { - await dashboardAddPanel.closeAddPanel(); - await PageObjects.dashboard.gotoDashboardLandingPage(); - }); - - it('should display empty widget', async () => { - const emptyWidgetExists = await testSubjects.exists('emptyDashboardWidget'); - expect(emptyWidgetExists).to.be(true); - }); - - it('should open add panel when add button is clicked', async () => { - await testSubjects.click('dashboardAddPanelButton'); - const isAddPanelOpen = await dashboardAddPanel.isAddPanelOpen(); - expect(isAddPanelOpen).to.be(true); - await testSubjects.click('euiFlyoutCloseButton'); - }); - - it('should add new visualization from dashboard', async () => { - await testSubjects.exists('dashboardAddNewPanelButton'); - await testSubjects.click('dashboardAddNewPanelButton'); - await dashboardVisualizations.createAndAddMarkdown({ - name: 'Dashboard Test Markdown', - markdown: 'Markdown text', - }); - await PageObjects.dashboard.waitForRenderComplete(); - await dashboardExpect.markdownWithValuesExists(['Markdown text']); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const dashboardAddPanel = getService('dashboardAddPanel'); const dashboardVisualizations = getService('dashboardVisualizations'); const dashboardExpect = getService('dashboardExpect'); const PageObjects = getPageObjects(['common', 'dashboard']); describe('empty dashboard', () => { before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.clickNewDashboard(); }); after(async () => { await dashboardAddPanel.closeAddPanel(); await PageObjects.dashboard.gotoDashboardLandingPage(); }); it('should display empty widget', async () => { const emptyWidgetExists = await testSubjects.exists('emptyDashboardWidget'); expect(emptyWidgetExists).to.be(true); }); it('should open add panel when add button is clicked', async () => { await testSubjects.click('dashboardAddPanelButton'); const isAddPanelOpen = await dashboardAddPanel.isAddPanelOpen(); expect(isAddPanelOpen).to.be(true); await testSubjects.click('euiFlyoutCloseButton'); }); it('should add new visualization from dashboard', async () => { await testSubjects.exists('dashboardAddNewPanelButton'); await testSubjects.click('dashboardAddNewPanelButton'); await dashboardVisualizations.createAndAddMarkdown({ name: 'Dashboard Test Markdown', markdown: 'Markdown text', }); await PageObjects.dashboard.waitForRenderComplete(); await dashboardExpect.markdownWithValuesExists(['Markdown text']); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/full_screen_mode.ts b/test/functional/apps/dashboard/full_screen_mode.ts index 1f63dcdafdcce..67bb5a714f1c5 100644 --- a/test/functional/apps/dashboard/full_screen_mode.ts +++ b/test/functional/apps/dashboard/full_screen_mode.ts @@ -1,97 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const retry = getService('retry'); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const dashboardPanelActions = getService('dashboardPanelActions'); - const PageObjects = getPageObjects(['dashboard', 'common']); - const filterBar = getService('filterBar'); - - describe('full screen mode', () => { - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.loadSavedDashboard('few panels'); - }); - - it('option not available in edit mode', async () => { - await PageObjects.dashboard.switchToEditMode(); - const exists = await PageObjects.dashboard.fullScreenModeMenuItemExists(); - expect(exists).to.be(false); - }); - - it('available in view mode', async () => { - await PageObjects.dashboard.saveDashboard('full screen test', { - saveAsNew: true, - exitFromEditMode: true, - }); - const exists = await PageObjects.dashboard.fullScreenModeMenuItemExists(); - expect(exists).to.be(true); - }); - - it('hides the chrome', async () => { - const isChromeVisible = await PageObjects.common.isChromeVisible(); - expect(isChromeVisible).to.be(true); - - await PageObjects.dashboard.clickFullScreenMode(); - - await retry.try(async () => { - const isChromeHidden = await PageObjects.common.isChromeHidden(); - expect(isChromeHidden).to.be(true); - }); - }); - - it('displays exit full screen logo button', async () => { - const exists = await PageObjects.dashboard.exitFullScreenLogoButtonExists(); - expect(exists).to.be(true); - }); - - it('displays exit full screen logo button when panel is expanded', async () => { - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickExpandPanelToggle(); - - const exists = await PageObjects.dashboard.exitFullScreenTextButtonExists(); - expect(exists).to.be(true); - }); - - it('exits when the text button is clicked on', async () => { - await PageObjects.dashboard.exitFullScreenMode(); - await retry.try(async () => { - const isChromeVisible = await PageObjects.common.isChromeVisible(); - expect(isChromeVisible).to.be(true); - }); - }); - - it('shows filter bar in fullscreen mode', async () => { - await filterBar.addFilter('bytes', 'is', '12345678'); - await PageObjects.dashboard.waitForRenderComplete(); - await PageObjects.dashboard.clickFullScreenMode(); - await retry.try(async () => { - const isChromeHidden = await PageObjects.common.isChromeHidden(); - expect(isChromeHidden).to.be(true); - }); - expect(await filterBar.getFilterCount()).to.be(1); - await PageObjects.dashboard.clickExitFullScreenLogoButton(); - await retry.try(async () => { - const isChromeVisible = await PageObjects.common.isChromeVisible(); - expect(isChromeVisible).to.be(true); - }); - await filterBar.removeFilter('bytes'); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const retry = getService('retry'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const dashboardPanelActions = getService('dashboardPanelActions'); const PageObjects = getPageObjects(['dashboard', 'common']); const filterBar = getService('filterBar'); describe('full screen mode', () => { before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.loadSavedDashboard('few panels'); }); it('option not available in edit mode', async () => { await PageObjects.dashboard.switchToEditMode(); const exists = await PageObjects.dashboard.fullScreenModeMenuItemExists(); expect(exists).to.be(false); }); it('available in view mode', async () => { await PageObjects.dashboard.saveDashboard('full screen test', { saveAsNew: true, exitFromEditMode: true, }); const exists = await PageObjects.dashboard.fullScreenModeMenuItemExists(); expect(exists).to.be(true); }); it('hides the chrome', async () => { const isChromeVisible = await PageObjects.common.isChromeVisible(); expect(isChromeVisible).to.be(true); await PageObjects.dashboard.clickFullScreenMode(); await retry.try(async () => { const isChromeHidden = await PageObjects.common.isChromeHidden(); expect(isChromeHidden).to.be(true); }); }); it('displays exit full screen logo button', async () => { const exists = await PageObjects.dashboard.exitFullScreenLogoButtonExists(); expect(exists).to.be(true); }); it('displays exit full screen logo button when panel is expanded', async () => { await dashboardPanelActions.openContextMenu(); await dashboardPanelActions.clickExpandPanelToggle(); const exists = await PageObjects.dashboard.exitFullScreenTextButtonExists(); expect(exists).to.be(true); }); it('exits when the text button is clicked on', async () => { await PageObjects.dashboard.exitFullScreenMode(); await retry.try(async () => { const isChromeVisible = await PageObjects.common.isChromeVisible(); expect(isChromeVisible).to.be(true); }); }); it('shows filter bar in fullscreen mode', async () => { await filterBar.addFilter('bytes', 'is', '12345678'); await PageObjects.dashboard.waitForRenderComplete(); await PageObjects.dashboard.clickFullScreenMode(); await retry.try(async () => { const isChromeHidden = await PageObjects.common.isChromeHidden(); expect(isChromeHidden).to.be(true); }); expect(await filterBar.getFilterCount()).to.be(1); await PageObjects.dashboard.clickExitFullScreenLogoButton(); await retry.try(async () => { const isChromeVisible = await PageObjects.common.isChromeVisible(); expect(isChromeVisible).to.be(true); }); await filterBar.removeFilter('bytes'); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/legacy_urls.ts b/test/functional/apps/dashboard/legacy_urls.ts index 9c7f472b287a7..9c576c1315dee 100644 --- a/test/functional/apps/dashboard/legacy_urls.ts +++ b/test/functional/apps/dashboard/legacy_urls.ts @@ -1,118 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const PageObjects = getPageObjects([ - 'dashboard', - 'header', - 'common', - 'timePicker', - 'visualize', - 'visEditor', - ]); - const pieChart = getService('pieChart'); - const browser = getService('browser'); - const find = getService('find'); - const log = getService('log'); - const dashboardAddPanel = getService('dashboardAddPanel'); - const listingTable = getService('listingTable'); - const esArchiver = getService('esArchiver'); - const security = getService('security'); - - let kibanaLegacyBaseUrl: string; - let kibanaVisualizeBaseUrl: string; - let testDashboardId: string; - - describe('legacy urls', function describeIndexTests() { - before(async function () { - await security.testUser.setRoles(['kibana_admin', 'animals']); - await esArchiver.load('dashboard/current/kibana'); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.clickNewDashboard(); - await dashboardAddPanel.addVisualization('Rendering-Test:-animal-sounds-pie'); - await PageObjects.dashboard.saveDashboard('legacyTest', { waitDialogIsClosed: true }); - await PageObjects.header.waitUntilLoadingHasFinished(); - const currentUrl = await browser.getCurrentUrl(); - await log.debug(`Current url is ${currentUrl}`); - testDashboardId = /#\/view\/(.+)\?/.exec(currentUrl)![1]; - kibanaLegacyBaseUrl = - currentUrl.substring(0, currentUrl.indexOf('/app/dashboards')) + '/app/kibana'; - kibanaVisualizeBaseUrl = - currentUrl.substring(0, currentUrl.indexOf('/app/dashboards')) + '/app/visualize'; - await log.debug(`id is ${testDashboardId}`); - }); - - after(async function () { - await PageObjects.dashboard.gotoDashboardLandingPage(); - await listingTable.deleteItem('legacyTest', testDashboardId); - await security.testUser.restoreDefaults(); - }); - - describe('kibana link redirect', () => { - it('redirects from old kibana app URL', async () => { - const url = `${kibanaLegacyBaseUrl}#/dashboard/${testDashboardId}`; - await browser.get(url, true); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.timePicker.setDefaultDataRange(); - - await PageObjects.dashboard.waitForRenderComplete(); - await pieChart.expectPieSliceCount(5); - }); - - it('redirects from legacy hash in wrong app', async () => { - const url = `${kibanaVisualizeBaseUrl}#/dashboard/${testDashboardId}`; - await browser.get(url, true); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.timePicker.setDefaultDataRange(); - - await PageObjects.dashboard.waitForRenderComplete(); - await pieChart.expectPieSliceCount(5); - }); - - it('resolves markdown link', async () => { - await PageObjects.visualize.navigateToNewVisualization(); - await PageObjects.visualize.clickMarkdownWidget(); - await PageObjects.visEditor.setMarkdownTxt(`[abc](#/dashboard/${testDashboardId})`); - await PageObjects.visEditor.clickGo(); - - await PageObjects.visualize.saveVisualizationExpectSuccess('legacy url markdown'); - - (await find.byLinkText('abc')).click(); - - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.timePicker.setDefaultDataRange(); - - await PageObjects.dashboard.waitForRenderComplete(); - await pieChart.expectPieSliceCount(5); - }); - - it('back button works', async () => { - // back to default time range - await browser.goBack(); - // back to last app - await browser.goBack(); - await PageObjects.visEditor.expectMarkdownTextArea(); - await browser.goForward(); - }); - - it('resolves markdown link from dashboard', async () => { - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.clickNewDashboard(); - await dashboardAddPanel.addVisualization('legacy url markdown'); - (await find.byLinkText('abc')).click(); - await PageObjects.header.waitUntilLoadingHasFinished(); - await PageObjects.timePicker.setDefaultDataRange(); - - await PageObjects.dashboard.waitForRenderComplete(); - await pieChart.expectPieSliceCount(5); - }); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const PageObjects = getPageObjects([ 'dashboard', 'header', 'common', 'timePicker', 'visualize', 'visEditor', ]); const pieChart = getService('pieChart'); const browser = getService('browser'); const find = getService('find'); const log = getService('log'); const dashboardAddPanel = getService('dashboardAddPanel'); const listingTable = getService('listingTable'); const esArchiver = getService('esArchiver'); const security = getService('security'); let kibanaLegacyBaseUrl: string; let kibanaVisualizeBaseUrl: string; let testDashboardId: string; describe('legacy urls', function describeIndexTests() { before(async function () { await security.testUser.setRoles(['kibana_admin', 'animals']); await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.clickNewDashboard(); await dashboardAddPanel.addVisualization('Rendering-Test:-animal-sounds-pie'); await PageObjects.dashboard.saveDashboard('legacyTest', { waitDialogIsClosed: true }); await PageObjects.header.waitUntilLoadingHasFinished(); const currentUrl = await browser.getCurrentUrl(); await log.debug(`Current url is ${currentUrl}`); testDashboardId = /#\/view\/(.+)\?/.exec(currentUrl)![1]; kibanaLegacyBaseUrl = currentUrl.substring(0, currentUrl.indexOf('/app/dashboards')) + '/app/kibana'; kibanaVisualizeBaseUrl = currentUrl.substring(0, currentUrl.indexOf('/app/dashboards')) + '/app/visualize'; await log.debug(`id is ${testDashboardId}`); }); after(async function () { await PageObjects.dashboard.gotoDashboardLandingPage(); await listingTable.deleteItem('legacyTest', testDashboardId); await security.testUser.restoreDefaults(); }); describe('kibana link redirect', () => { it('redirects from old kibana app URL', async () => { const url = `${kibanaLegacyBaseUrl}#/dashboard/${testDashboardId}`; await browser.get(url, true); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.timePicker.setDefaultDataRange(); await PageObjects.dashboard.waitForRenderComplete(); await pieChart.expectPieSliceCount(5); }); it('redirects from legacy hash in wrong app', async () => { const url = `${kibanaVisualizeBaseUrl}#/dashboard/${testDashboardId}`; await browser.get(url, true); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.timePicker.setDefaultDataRange(); await PageObjects.dashboard.waitForRenderComplete(); await pieChart.expectPieSliceCount(5); }); it('resolves markdown link', async () => { await PageObjects.visualize.navigateToNewVisualization(); await PageObjects.visualize.clickMarkdownWidget(); await PageObjects.visEditor.setMarkdownTxt(`[abc](#/dashboard/${testDashboardId})`); await PageObjects.visEditor.clickGo(); await PageObjects.visualize.saveVisualizationExpectSuccess('legacy url markdown'); (await find.byLinkText('abc')).click(); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.timePicker.setDefaultDataRange(); await PageObjects.dashboard.waitForRenderComplete(); await pieChart.expectPieSliceCount(5); }); it('back button works', async () => { // back to default time range await browser.goBack(); // back to last app await browser.goBack(); await PageObjects.visEditor.expectMarkdownTextArea(); await browser.goForward(); }); it('resolves markdown link from dashboard', async () => { await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.clickNewDashboard(); await dashboardAddPanel.addVisualization('legacy url markdown'); (await find.byLinkText('abc')).click(); await PageObjects.header.waitUntilLoadingHasFinished(); await PageObjects.timePicker.setDefaultDataRange(); await PageObjects.dashboard.waitForRenderComplete(); await pieChart.expectPieSliceCount(5); }); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/panel_expand_toggle.ts b/test/functional/apps/dashboard/panel_expand_toggle.ts index 45642542cc0ac..d54a14a0077d2 100644 --- a/test/functional/apps/dashboard/panel_expand_toggle.ts +++ b/test/functional/apps/dashboard/panel_expand_toggle.ts @@ -1,70 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const retry = getService('retry'); - const browser = getService('browser'); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const dashboardPanelActions = getService('dashboardPanelActions'); - const PageObjects = getPageObjects(['dashboard', 'visualize', 'header', 'common']); - - describe('expanding a panel', () => { - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.loadSavedDashboard('few panels'); - }); - - it('hides other panels', async () => { - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickExpandPanelToggle(); - await retry.try(async () => { - const panelCount = await PageObjects.dashboard.getPanelCount(); - expect(panelCount).to.eql(1); - }); - }); - - it('shows other panels after being minimized', async () => { - const panelCount = await PageObjects.dashboard.getPanelCount(); - // Panels are all minimized on a fresh open of a dashboard, so we need to re-expand in order to then minimize. - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickExpandPanelToggle(); - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickExpandPanelToggle(); - - // Add a retry to fix https://github.com/elastic/kibana/issues/14574. Perhaps the recent changes to this - // being a CSS update is causing the UI to change slower than grabbing the panels? - await retry.try(async () => { - const panelCountAfterMaxThenMinimize = await PageObjects.dashboard.getPanelCount(); - expect(panelCountAfterMaxThenMinimize).to.be(panelCount); - }); - }); - - it('minimizes using the browser back button', async () => { - const panelCount = await PageObjects.dashboard.getPanelCount(); - - await dashboardPanelActions.openContextMenu(); - await dashboardPanelActions.clickExpandPanelToggle(); - - await browser.goBack(); - await retry.try(async () => { - const panelCountAfterMaxThenMinimize = await PageObjects.dashboard.getPanelCount(); - expect(panelCountAfterMaxThenMinimize).to.be(panelCount); - }); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const retry = getService('retry'); const browser = getService('browser'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const dashboardPanelActions = getService('dashboardPanelActions'); const PageObjects = getPageObjects(['dashboard', 'visualize', 'header', 'common']); describe('expanding a panel', () => { before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.loadSavedDashboard('few panels'); }); it('hides other panels', async () => { await dashboardPanelActions.openContextMenu(); await dashboardPanelActions.clickExpandPanelToggle(); await retry.try(async () => { const panelCount = await PageObjects.dashboard.getPanelCount(); expect(panelCount).to.eql(1); }); }); it('shows other panels after being minimized', async () => { const panelCount = await PageObjects.dashboard.getPanelCount(); // Panels are all minimized on a fresh open of a dashboard, so we need to re-expand in order to then minimize. await dashboardPanelActions.openContextMenu(); await dashboardPanelActions.clickExpandPanelToggle(); await dashboardPanelActions.openContextMenu(); await dashboardPanelActions.clickExpandPanelToggle(); // Add a retry to fix https://github.com/elastic/kibana/issues/14574. Perhaps the recent changes to this // being a CSS update is causing the UI to change slower than grabbing the panels? await retry.try(async () => { const panelCountAfterMaxThenMinimize = await PageObjects.dashboard.getPanelCount(); expect(panelCountAfterMaxThenMinimize).to.be(panelCount); }); }); it('minimizes using the browser back button', async () => { const panelCount = await PageObjects.dashboard.getPanelCount(); await dashboardPanelActions.openContextMenu(); await dashboardPanelActions.clickExpandPanelToggle(); await browser.goBack(); await retry.try(async () => { const panelCountAfterMaxThenMinimize = await PageObjects.dashboard.getPanelCount(); expect(panelCountAfterMaxThenMinimize).to.be(panelCount); }); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/share.ts b/test/functional/apps/dashboard/share.ts index 8191b5efb51f6..0a0ac306b272b 100644 --- a/test/functional/apps/dashboard/share.ts +++ b/test/functional/apps/dashboard/share.ts @@ -1,34 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const PageObjects = getPageObjects(['dashboard', 'common', 'share']); - - describe('share dashboard', () => { - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.loadSavedDashboard('few panels'); - }); - - it('has "panels" state when sharing a snapshot', async () => { - await PageObjects.share.clickShareTopNavButton(); - const sharedUrl = await PageObjects.share.getSharedUrl(); - expect(sharedUrl).to.contain('panels'); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const PageObjects = getPageObjects(['dashboard', 'common', 'share']); describe('share dashboard', () => { before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.loadSavedDashboard('few panels'); }); it('has "panels" state when sharing a snapshot', async () => { await PageObjects.share.clickShareTopNavButton(); const sharedUrl = await PageObjects.share.getSharedUrl(); expect(sharedUrl).to.contain('panels'); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/time_zones.ts b/test/functional/apps/dashboard/time_zones.ts index a4a586cb635d5..1d4283c36b895 100644 --- a/test/functional/apps/dashboard/time_zones.ts +++ b/test/functional/apps/dashboard/time_zones.ts @@ -1,68 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import path from 'path'; -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const pieChart = getService('pieChart'); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const PageObjects = getPageObjects([ - 'dashboard', - 'timePicker', - 'settings', - 'common', - 'savedObjects', - ]); - - describe('dashboard time zones', function () { - this.tags('includeFirefox'); - - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.settings.navigateTo(); - await PageObjects.settings.clickKibanaSavedObjects(); - await PageObjects.savedObjects.importFile( - path.join(__dirname, 'exports', 'timezonetest_6_2_4.json') - ); - await PageObjects.savedObjects.checkImportSucceeded(); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - await PageObjects.dashboard.loadSavedDashboard('time zone test'); - }); - - after(async () => { - await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC' }); - }); - - it('Exported dashboard adjusts EST time to UTC', async () => { - const time = await PageObjects.timePicker.getTimeConfigAsAbsoluteTimes(); - expect(time.start).to.be('Apr 10, 2018 @ 03:00:00.000'); - expect(time.end).to.be('Apr 10, 2018 @ 04:00:00.000'); - await pieChart.expectPieSliceCount(4); - }); - - it('Changing timezone changes dashboard timestamp and shows the same data', async () => { - await PageObjects.settings.navigateTo(); - await PageObjects.settings.clickKibanaSettings(); - await PageObjects.settings.setAdvancedSettingsSelect('dateFormat:tz', 'Etc/GMT+5'); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.loadSavedDashboard('time zone test'); - const time = await PageObjects.timePicker.getTimeConfigAsAbsoluteTimes(); - expect(time.start).to.be('Apr 9, 2018 @ 22:00:00.000'); - expect(time.end).to.be('Apr 9, 2018 @ 23:00:00.000'); - await pieChart.expectPieSliceCount(4); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import path from 'path'; import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const pieChart = getService('pieChart'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const PageObjects = getPageObjects([ 'dashboard', 'timePicker', 'settings', 'common', 'savedObjects', ]); describe('dashboard time zones', function () { this.tags('includeFirefox'); before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.settings.navigateTo(); await PageObjects.settings.clickKibanaSavedObjects(); await PageObjects.savedObjects.importFile( path.join(__dirname, 'exports', 'timezonetest_6_2_4.json') ); await PageObjects.savedObjects.checkImportSucceeded(); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); await PageObjects.dashboard.loadSavedDashboard('time zone test'); }); after(async () => { await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC' }); }); it('Exported dashboard adjusts EST time to UTC', async () => { const time = await PageObjects.timePicker.getTimeConfigAsAbsoluteTimes(); expect(time.start).to.be('Apr 10, 2018 @ 03:00:00.000'); expect(time.end).to.be('Apr 10, 2018 @ 04:00:00.000'); await pieChart.expectPieSliceCount(4); }); it('Changing timezone changes dashboard timestamp and shows the same data', async () => { await PageObjects.settings.navigateTo(); await PageObjects.settings.clickKibanaSettings(); await PageObjects.settings.setAdvancedSettingsSelect('dateFormat:tz', 'Etc/GMT+5'); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.loadSavedDashboard('time zone test'); const time = await PageObjects.timePicker.getTimeConfigAsAbsoluteTimes(); expect(time.start).to.be('Apr 9, 2018 @ 22:00:00.000'); expect(time.end).to.be('Apr 9, 2018 @ 23:00:00.000'); await pieChart.expectPieSliceCount(4); }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/url_field_formatter.ts b/test/functional/apps/dashboard/url_field_formatter.ts index f930987f16d5f..1bb7ae69bbed2 100644 --- a/test/functional/apps/dashboard/url_field_formatter.ts +++ b/test/functional/apps/dashboard/url_field_formatter.ts @@ -1,82 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; -import { WebElementWrapper } from 'test/functional/services/lib/web_element_wrapper'; -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const { common, dashboard, settings, timePicker, visChart } = getPageObjects([ - 'common', - 'dashboard', - 'settings', - 'timePicker', - 'visChart', - ]); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const testSubjects = getService('testSubjects'); - const browser = getService('browser'); - const fieldName = 'clientip'; - const deployment = getService('deployment'); - - const clickFieldAndCheckUrl = async (fieldLink: WebElementWrapper) => { - const fieldValue = await fieldLink.getVisibleText(); - await fieldLink.click(); - const windowHandlers = await browser.getAllWindowHandles(); - expect(windowHandlers.length).to.equal(2); - await browser.switchToWindow(windowHandlers[1]); - const currentUrl = await browser.getCurrentUrl(); - const fieldUrl = deployment.getHostPort() + '/app/' + fieldValue; - expect(currentUrl).to.equal(fieldUrl); - }; - - // FLAKY: https://github.com/elastic/kibana/issues/79463 - describe.skip('Changing field formatter to Url', () => { - before(async function () { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await common.navigateToApp('settings'); - await settings.clickKibanaIndexPatterns(); - await settings.clickIndexPatternLogstash(); - await settings.filterField(fieldName); - await settings.openControlsByName(fieldName); - await settings.setFieldFormat('url'); - await settings.controlChangeSave(); - }); - - it('applied on dashboard', async () => { - await common.navigateToApp('dashboard'); - await dashboard.loadSavedDashboard('dashboard with everything'); - await dashboard.waitForRenderComplete(); - const fieldLink = await visChart.getFieldLinkInVisTable(`${fieldName}: Descending`, 1); - await clickFieldAndCheckUrl(fieldLink); - }); - - it('applied on discover', async () => { - await common.navigateToApp('discover'); - await timePicker.setAbsoluteRange( - 'Sep 19, 2017 @ 06:31:44.000', - 'Sep 23, 2018 @ 18:31:44.000' - ); - await testSubjects.click('docTableExpandToggleColumn'); - const fieldLink = await testSubjects.find(`tableDocViewRow-${fieldName}-value`); - await clickFieldAndCheckUrl(fieldLink); - }); - - afterEach(async function () { - const windowHandlers = await browser.getAllWindowHandles(); - if (windowHandlers.length > 1) { - await browser.closeCurrentWindow(); - await browser.switchToWindow(windowHandlers[0]); - } - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { WebElementWrapper } from 'test/functional/services/lib/web_element_wrapper'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const { common, dashboard, settings, timePicker, visChart } = getPageObjects([ 'common', 'dashboard', 'settings', 'timePicker', 'visChart', ]); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const testSubjects = getService('testSubjects'); const browser = getService('browser'); const fieldName = 'clientip'; const deployment = getService('deployment'); const clickFieldAndCheckUrl = async (fieldLink: WebElementWrapper) => { const fieldValue = await fieldLink.getVisibleText(); await fieldLink.click(); const windowHandlers = await browser.getAllWindowHandles(); expect(windowHandlers.length).to.equal(2); await browser.switchToWindow(windowHandlers[1]); const currentUrl = await browser.getCurrentUrl(); const fieldUrl = deployment.getHostPort() + '/app/' + fieldValue; expect(currentUrl).to.equal(fieldUrl); }; // FLAKY: https://github.com/elastic/kibana/issues/79463 describe.skip('Changing field formatter to Url', () => { before(async function () { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await common.navigateToApp('settings'); await settings.clickKibanaIndexPatterns(); await settings.clickIndexPatternLogstash(); await settings.filterField(fieldName); await settings.openControlsByName(fieldName); await settings.setFieldFormat('url'); await settings.controlChangeSave(); }); it('applied on dashboard', async () => { await common.navigateToApp('dashboard'); await dashboard.loadSavedDashboard('dashboard with everything'); await dashboard.waitForRenderComplete(); const fieldLink = await visChart.getFieldLinkInVisTable(`${fieldName}: Descending`, 1); await clickFieldAndCheckUrl(fieldLink); }); it('applied on discover', async () => { await common.navigateToApp('discover'); await timePicker.setAbsoluteRange( 'Sep 19, 2017 @ 06:31:44.000', 'Sep 23, 2018 @ 18:31:44.000' ); await testSubjects.click('docTableExpandToggleColumn'); const fieldLink = await testSubjects.find(`tableDocViewRow-${fieldName}-value`); await clickFieldAndCheckUrl(fieldLink); }); afterEach(async function () { const windowHandlers = await browser.getAllWindowHandles(); if (windowHandlers.length > 1) { await browser.closeCurrentWindow(); await browser.switchToWindow(windowHandlers[0]); } }); }); } \ No newline at end of file diff --git a/test/functional/apps/dashboard/view_edit.ts b/test/functional/apps/dashboard/view_edit.ts index c5c7daab27ff1..6854827fd3ec2 100644 --- a/test/functional/apps/dashboard/view_edit.ts +++ b/test/functional/apps/dashboard/view_edit.ts @@ -1,238 +1 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const queryBar = getService('queryBar'); - const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); - const dashboardAddPanel = getService('dashboardAddPanel'); - const testSubjects = getService('testSubjects'); - const PageObjects = getPageObjects(['dashboard', 'header', 'common', 'visualize', 'timePicker']); - const dashboardName = 'dashboard with filter'; - const filterBar = getService('filterBar'); - - describe('dashboard view edit mode', function viewEditModeTests() { - before(async () => { - await esArchiver.load('dashboard/current/kibana'); - await kibanaServer.uiSettings.replace({ - defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', - }); - await PageObjects.common.navigateToApp('dashboard'); - await PageObjects.dashboard.preserveCrossAppState(); - }); - - it('create new dashboard opens in edit mode', async function () { - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.dashboard.clickNewDashboard(); - await PageObjects.dashboard.clickCancelOutOfEditMode(); - }); - - it('existing dashboard opens in view mode', async function () { - await PageObjects.dashboard.gotoDashboardLandingPage(); - await PageObjects.dashboard.loadSavedDashboard(dashboardName); - const inViewMode = await PageObjects.dashboard.getIsInViewMode(); - - expect(inViewMode).to.equal(true); - }); - - describe('save', function () { - it('auto exits out of edit mode', async function () { - await PageObjects.dashboard.gotoDashboardEditMode(dashboardName); - await PageObjects.dashboard.saveDashboard(dashboardName); - const isViewMode = await PageObjects.dashboard.getIsInViewMode(); - expect(isViewMode).to.equal(true); - }); - }); - - describe('shows lose changes warning', function () { - describe('and loses changes on confirmation', function () { - beforeEach(async function () { - await PageObjects.dashboard.gotoDashboardEditMode(dashboardName); - }); - - it('when time changed is stored with dashboard', async function () { - await PageObjects.timePicker.setDefaultDataRange(); - - const originalTime = await PageObjects.timePicker.getTimeConfig(); - - await PageObjects.dashboard.saveDashboard(dashboardName, { - storeTimeWithDashboard: true, - }); - - await PageObjects.timePicker.setAbsoluteRange( - 'Sep 19, 2013 @ 06:31:44.000', - 'Sep 19, 2013 @ 06:31:44.000' - ); - await PageObjects.dashboard.clickDiscardChanges(); - - const newTime = await PageObjects.timePicker.getTimeConfig(); - - expect(newTime.start).to.equal(originalTime.start); - expect(newTime.end).to.equal(originalTime.end); - }); - - it('when the query is edited and applied', async function () { - const originalQuery = await queryBar.getQueryString(); - await queryBar.setQuery(`${originalQuery}and extra stuff`); - await queryBar.submitQuery(); - - await PageObjects.dashboard.clickDiscardChanges(); - - const query = await queryBar.getQueryString(); - expect(query).to.equal(originalQuery); - }); - - it('when a filter is deleted', async function () { - // This may seem like a pointless line but there was a bug that only arose when the dashboard - // was loaded initially - await PageObjects.dashboard.loadSavedDashboard(dashboardName); - await PageObjects.dashboard.switchToEditMode(); - - let hasFilter = await filterBar.hasFilter('animal', 'dog'); - expect(hasFilter).to.be(true); - - await filterBar.removeFilter('animal'); - - hasFilter = await filterBar.hasFilter('animal', 'dog'); - expect(hasFilter).to.be(false); - - await PageObjects.dashboard.clickDiscardChanges(); - - hasFilter = await filterBar.hasFilter('animal', 'dog'); - expect(hasFilter).to.be(true); - }); - - it('when a new vis is added', async function () { - const originalPanelCount = await PageObjects.dashboard.getPanelCount(); - - await dashboardAddPanel.ensureAddPanelIsShowing(); - await dashboardAddPanel.clickAddNewEmbeddableLink('visualization'); - await PageObjects.visualize.clickAggBasedVisualizations(); - await PageObjects.visualize.clickAreaChart(); - await PageObjects.visualize.clickNewSearch(); - await PageObjects.visualize.saveVisualizationExpectSuccess('new viz panel', { - saveAsNew: false, - redirectToOrigin: true, - }); - - await PageObjects.dashboard.clickDiscardChanges(false); - // for this sleep see https://github.com/elastic/kibana/issues/22299 - await PageObjects.common.sleep(500); - - // confirm lose changes - await testSubjects.exists('dashboardDiscardConfirmDiscard'); - await testSubjects.click('dashboardDiscardConfirmDiscard'); - - const panelCount = await PageObjects.dashboard.getPanelCount(); - expect(panelCount).to.eql(originalPanelCount); - }); - - it('when an existing vis is added', async function () { - const originalPanelCount = await PageObjects.dashboard.getPanelCount(); - - await dashboardAddPanel.addVisualization('new viz panel'); - await PageObjects.dashboard.clickDiscardChanges(); - - const panelCount = await PageObjects.dashboard.getPanelCount(); - expect(panelCount).to.eql(originalPanelCount); - }); - }); - - describe('and preserves edits on cancel', function () { - it('when time changed is stored with dashboard', async function () { - await PageObjects.dashboard.gotoDashboardEditMode(dashboardName); - await PageObjects.timePicker.setAbsoluteRange( - 'Sep 19, 2013 @ 06:31:44.000', - 'Sep 19, 2013 @ 06:31:44.000' - ); - await PageObjects.dashboard.saveDashboard(dashboardName); - await PageObjects.dashboard.switchToEditMode(); - await PageObjects.timePicker.setAbsoluteRange( - 'Sep 19, 2015 @ 06:31:44.000', - 'Sep 19, 2015 @ 06:31:44.000' - ); - await PageObjects.dashboard.clickDiscardChanges(false); - - await testSubjects.exists('dashboardDiscardConfirmCancel'); - await testSubjects.click('dashboardDiscardConfirmCancel'); - await PageObjects.dashboard.saveDashboard(dashboardName, { - storeTimeWithDashboard: true, - }); - - await PageObjects.dashboard.loadSavedDashboard(dashboardName); - - const time = await PageObjects.timePicker.getTimeConfig(); - - expect(time.start).to.equal('Sep 19, 2015 @ 06:31:44.000'); - expect(time.end).to.equal('Sep 19, 2015 @ 06:31:44.000'); - }); - }); - }); - - describe('and preserves edits on cancel', function () { - it('when time changed is stored with dashboard', async function () { - await PageObjects.dashboard.gotoDashboardEditMode(dashboardName); - await PageObjects.timePicker.setDefaultDataRange(); - await PageObjects.dashboard.saveDashboard(dashboardName); - await PageObjects.dashboard.switchToEditMode(); - await PageObjects.timePicker.setAbsoluteRange( - 'Sep 19, 2013 @ 06:31:44.000', - 'Sep 19, 2013 @ 06:31:44.000' - ); - const newTime = await PageObjects.timePicker.getTimeConfig(); - - await PageObjects.dashboard.clickDiscardChanges(false); - - await testSubjects.exists('dashboardDiscardConfirmCancel'); - await testSubjects.click('dashboardDiscardConfirmCancel'); - await PageObjects.dashboard.saveDashboard(dashboardName, { storeTimeWithDashboard: true }); - - await PageObjects.dashboard.loadSavedDashboard(dashboardName); - - const time = await PageObjects.timePicker.getTimeConfig(); - - expect(time.start).to.equal(newTime.start); - expect(time.end).to.equal(newTime.end); - }); - }); - - describe('Does not show lose changes warning', function () { - it('when time changed is not stored with dashboard', async function () { - await PageObjects.dashboard.gotoDashboardEditMode(dashboardName); - await PageObjects.dashboard.saveDashboard(dashboardName, { storeTimeWithDashboard: false }); - await PageObjects.timePicker.setAbsoluteRange( - 'Oct 19, 2014 @ 06:31:44.000', - 'Dec 19, 2014 @ 06:31:44.000' - ); - await PageObjects.dashboard.clickCancelOutOfEditMode(false); - - await PageObjects.common.expectConfirmModalOpenState(false); - }); - - // See https://github.com/elastic/kibana/issues/10110 - this is intentional. - it('when the query is edited but not applied', async function () { - await PageObjects.dashboard.gotoDashboardEditMode(dashboardName); - - const originalQuery = await queryBar.getQueryString(); - await queryBar.setQuery(`${originalQuery}extra stuff`); - - await PageObjects.dashboard.clickCancelOutOfEditMode(false); - - await PageObjects.common.expectConfirmModalOpenState(false); - - await PageObjects.dashboard.loadSavedDashboard(dashboardName); - const query = await queryBar.getQueryString(); - expect(query).to.equal(originalQuery); - }); - }); - }); -} +/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const queryBar = getService('queryBar'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const dashboardAddPanel = getService('dashboardAddPanel'); const testSubjects = getService('testSubjects'); const PageObjects = getPageObjects(['dashboard', 'header', 'common', 'visualize', 'timePicker']); const dashboardName = 'dashboard with filter'; const filterBar = getService('filterBar'); describe('dashboard view edit mode', function viewEditModeTests() { before(async () => { await kibanaServer.savedObjects.clean({ types: ['search'] }); await kibanaServer.importExport.load('dashboard/current/kibana'); await kibanaServer.uiSettings.replace({ defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c', }); await PageObjects.common.navigateToApp('dashboard'); await PageObjects.dashboard.preserveCrossAppState(); }); it('create new dashboard opens in edit mode', async function () { await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.clickNewDashboard(); await PageObjects.dashboard.clickCancelOutOfEditMode(); }); it('existing dashboard opens in view mode', async function () { await PageObjects.dashboard.gotoDashboardLandingPage(); await PageObjects.dashboard.loadSavedDashboard(dashboardName); const inViewMode = await PageObjects.dashboard.getIsInViewMode(); expect(inViewMode).to.equal(true); }); describe('save', function () { it('auto exits out of edit mode', async function () { await PageObjects.dashboard.gotoDashboardEditMode(dashboardName); await PageObjects.dashboard.saveDashboard(dashboardName); const isViewMode = await PageObjects.dashboard.getIsInViewMode(); expect(isViewMode).to.equal(true); }); }); describe('shows lose changes warning', function () { describe('and loses changes on confirmation', function () { beforeEach(async function () { await PageObjects.dashboard.gotoDashboardEditMode(dashboardName); }); it('when time changed is stored with dashboard', async function () { await PageObjects.timePicker.setDefaultDataRange(); const originalTime = await PageObjects.timePicker.getTimeConfig(); await PageObjects.dashboard.saveDashboard(dashboardName, { storeTimeWithDashboard: true, }); await PageObjects.timePicker.setAbsoluteRange( 'Sep 19, 2013 @ 06:31:44.000', 'Sep 19, 2013 @ 06:31:44.000' ); await PageObjects.dashboard.clickDiscardChanges(); const newTime = await PageObjects.timePicker.getTimeConfig(); expect(newTime.start).to.equal(originalTime.start); expect(newTime.end).to.equal(originalTime.end); }); it('when the query is edited and applied', async function () { const originalQuery = await queryBar.getQueryString(); await queryBar.setQuery(`${originalQuery}and extra stuff`); await queryBar.submitQuery(); await PageObjects.dashboard.clickDiscardChanges(); const query = await queryBar.getQueryString(); expect(query).to.equal(originalQuery); }); it('when a filter is deleted', async function () { // This may seem like a pointless line but there was a bug that only arose when the dashboard // was loaded initially await PageObjects.dashboard.loadSavedDashboard(dashboardName); await PageObjects.dashboard.switchToEditMode(); let hasFilter = await filterBar.hasFilter('animal', 'dog'); expect(hasFilter).to.be(true); await filterBar.removeFilter('animal'); hasFilter = await filterBar.hasFilter('animal', 'dog'); expect(hasFilter).to.be(false); await PageObjects.dashboard.clickDiscardChanges(); hasFilter = await filterBar.hasFilter('animal', 'dog'); expect(hasFilter).to.be(true); }); it('when a new vis is added', async function () { const originalPanelCount = await PageObjects.dashboard.getPanelCount(); await dashboardAddPanel.ensureAddPanelIsShowing(); await dashboardAddPanel.clickAddNewEmbeddableLink('visualization'); await PageObjects.visualize.clickAggBasedVisualizations(); await PageObjects.visualize.clickAreaChart(); await PageObjects.visualize.clickNewSearch(); await PageObjects.visualize.saveVisualizationExpectSuccess('new viz panel', { saveAsNew: false, redirectToOrigin: true, }); await PageObjects.dashboard.clickDiscardChanges(false); // for this sleep see https://github.com/elastic/kibana/issues/22299 await PageObjects.common.sleep(500); // confirm lose changes await testSubjects.exists('dashboardDiscardConfirmDiscard'); await testSubjects.click('dashboardDiscardConfirmDiscard'); const panelCount = await PageObjects.dashboard.getPanelCount(); expect(panelCount).to.eql(originalPanelCount); }); it('when an existing vis is added', async function () { const originalPanelCount = await PageObjects.dashboard.getPanelCount(); await dashboardAddPanel.addVisualization('new viz panel'); await PageObjects.dashboard.clickDiscardChanges(); const panelCount = await PageObjects.dashboard.getPanelCount(); expect(panelCount).to.eql(originalPanelCount); }); }); describe('and preserves edits on cancel', function () { it('when time changed is stored with dashboard', async function () { await PageObjects.dashboard.gotoDashboardEditMode(dashboardName); await PageObjects.timePicker.setAbsoluteRange( 'Sep 19, 2013 @ 06:31:44.000', 'Sep 19, 2013 @ 06:31:44.000' ); await PageObjects.dashboard.saveDashboard(dashboardName); await PageObjects.dashboard.switchToEditMode(); await PageObjects.timePicker.setAbsoluteRange( 'Sep 19, 2015 @ 06:31:44.000', 'Sep 19, 2015 @ 06:31:44.000' ); await PageObjects.dashboard.clickDiscardChanges(false); await testSubjects.exists('dashboardDiscardConfirmCancel'); await testSubjects.click('dashboardDiscardConfirmCancel'); await PageObjects.dashboard.saveDashboard(dashboardName, { storeTimeWithDashboard: true, }); await PageObjects.dashboard.loadSavedDashboard(dashboardName); const time = await PageObjects.timePicker.getTimeConfig(); expect(time.start).to.equal('Sep 19, 2015 @ 06:31:44.000'); expect(time.end).to.equal('Sep 19, 2015 @ 06:31:44.000'); }); }); }); describe('and preserves edits on cancel', function () { it('when time changed is stored with dashboard', async function () { await PageObjects.dashboard.gotoDashboardEditMode(dashboardName); await PageObjects.timePicker.setDefaultDataRange(); await PageObjects.dashboard.saveDashboard(dashboardName); await PageObjects.dashboard.switchToEditMode(); await PageObjects.timePicker.setAbsoluteRange( 'Sep 19, 2013 @ 06:31:44.000', 'Sep 19, 2013 @ 06:31:44.000' ); const newTime = await PageObjects.timePicker.getTimeConfig(); await PageObjects.dashboard.clickDiscardChanges(false); await testSubjects.exists('dashboardDiscardConfirmCancel'); await testSubjects.click('dashboardDiscardConfirmCancel'); await PageObjects.dashboard.saveDashboard(dashboardName, { storeTimeWithDashboard: true }); await PageObjects.dashboard.loadSavedDashboard(dashboardName); const time = await PageObjects.timePicker.getTimeConfig(); expect(time.start).to.equal(newTime.start); expect(time.end).to.equal(newTime.end); }); }); describe('Does not show lose changes warning', function () { it('when time changed is not stored with dashboard', async function () { await PageObjects.dashboard.gotoDashboardEditMode(dashboardName); await PageObjects.dashboard.saveDashboard(dashboardName, { storeTimeWithDashboard: false }); await PageObjects.timePicker.setAbsoluteRange( 'Oct 19, 2014 @ 06:31:44.000', 'Dec 19, 2014 @ 06:31:44.000' ); await PageObjects.dashboard.clickCancelOutOfEditMode(false); await PageObjects.common.expectConfirmModalOpenState(false); }); // See https://github.com/elastic/kibana/issues/10110 - this is intentional. it('when the query is edited but not applied', async function () { await PageObjects.dashboard.gotoDashboardEditMode(dashboardName); const originalQuery = await queryBar.getQueryString(); await queryBar.setQuery(`${originalQuery}extra stuff`); await PageObjects.dashboard.clickCancelOutOfEditMode(false); await PageObjects.common.expectConfirmModalOpenState(false); await PageObjects.dashboard.loadSavedDashboard(dashboardName); const query = await queryBar.getQueryString(); expect(query).to.equal(originalQuery); }); }); }); } \ No newline at end of file diff --git a/test/functional/fixtures/es_archiver/dashboard/current/data/data.json.gz b/test/functional/fixtures/kbn_archiver/dashboard/current/data/data.json.gz similarity index 100% rename from test/functional/fixtures/es_archiver/dashboard/current/data/data.json.gz rename to test/functional/fixtures/kbn_archiver/dashboard/current/data/data.json.gz diff --git a/test/functional/fixtures/es_archiver/dashboard/current/data/mappings.json b/test/functional/fixtures/kbn_archiver/dashboard/current/data/mappings.json similarity index 100% rename from test/functional/fixtures/es_archiver/dashboard/current/data/mappings.json rename to test/functional/fixtures/kbn_archiver/dashboard/current/data/mappings.json diff --git a/test/functional/fixtures/es_archiver/dashboard/current/kibana/data.json.gz b/test/functional/fixtures/kbn_archiver/dashboard/current/kibana/data.json.gz similarity index 100% rename from test/functional/fixtures/es_archiver/dashboard/current/kibana/data.json.gz rename to test/functional/fixtures/kbn_archiver/dashboard/current/kibana/data.json.gz diff --git a/test/functional/fixtures/es_archiver/dashboard/current/kibana/mappings.json b/test/functional/fixtures/kbn_archiver/dashboard/current/kibana/mappings.json similarity index 100% rename from test/functional/fixtures/es_archiver/dashboard/current/kibana/mappings.json rename to test/functional/fixtures/kbn_archiver/dashboard/current/kibana/mappings.json diff --git a/test/functional/fixtures/es_archiver/dashboard/legacy/data.json.gz b/test/functional/fixtures/kbn_archiver/dashboard/legacy/data.json.gz similarity index 100% rename from test/functional/fixtures/es_archiver/dashboard/legacy/data.json.gz rename to test/functional/fixtures/kbn_archiver/dashboard/legacy/data.json.gz diff --git a/test/functional/fixtures/es_archiver/dashboard/legacy/mappings.json b/test/functional/fixtures/kbn_archiver/dashboard/legacy/mappings.json similarity index 100% rename from test/functional/fixtures/es_archiver/dashboard/legacy/mappings.json rename to test/functional/fixtures/kbn_archiver/dashboard/legacy/mappings.json