-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Time to Visualize] Adds functional tests for linking/unlinking panel…
… from embeddable library (#89612)
- Loading branch information
Showing
8 changed files
with
258 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/* | ||
* 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); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
x-pack/test/functional/apps/maps/embeddable/embeddable_library.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
|
||
export default function ({ getPageObjects, getService }) { | ||
const find = getService('find'); | ||
const testSubjects = getService('testSubjects'); | ||
const PageObjects = getPageObjects(['common', 'dashboard', 'header', 'maps', 'visualize']); | ||
const kibanaServer = getService('kibanaServer'); | ||
const security = getService('security'); | ||
const dashboardAddPanel = getService('dashboardAddPanel'); | ||
const dashboardPanelActions = getService('dashboardPanelActions'); | ||
const dashboardVisualizations = getService('dashboardVisualizations'); | ||
|
||
describe('maps in embeddable library', () => { | ||
before(async () => { | ||
await security.testUser.setRoles( | ||
[ | ||
'test_logstash_reader', | ||
'global_maps_all', | ||
'geoshape_data_reader', | ||
'global_dashboard_all', | ||
'meta_for_geoshape_data_reader', | ||
], | ||
false | ||
); | ||
await kibanaServer.uiSettings.replace({ | ||
defaultIndex: 'c698b940-e149-11e8-a35a-370a8516603a', | ||
}); | ||
await PageObjects.common.navigateToApp('dashboard'); | ||
await PageObjects.dashboard.clickNewDashboard(); | ||
await dashboardAddPanel.clickCreateNewLink(); | ||
await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); | ||
await PageObjects.visualize.clickMapsApp(); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
await PageObjects.maps.waitForLayersToLoad(); | ||
await PageObjects.maps.clickSaveAndReturnButton(); | ||
await PageObjects.dashboard.waitForRenderComplete(); | ||
}); | ||
|
||
after(async () => { | ||
await security.testUser.restoreDefaults(); | ||
}); | ||
|
||
it('save map panel to embeddable library', async () => { | ||
await dashboardPanelActions.saveToLibrary('embeddable library map'); | ||
await testSubjects.existOrFail('addPanelToLibrarySuccess'); | ||
|
||
const mapPanel = await testSubjects.find('embeddablePanelHeading-embeddablelibrarymap'); | ||
const libraryActionExists = await testSubjects.descendantExists( | ||
'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION', | ||
mapPanel | ||
); | ||
expect(libraryActionExists).to.be(true); | ||
}); | ||
|
||
it('unlink map panel from embeddable library', async () => { | ||
const originalPanel = await testSubjects.find('embeddablePanelHeading-embeddablelibrarymap'); | ||
await dashboardPanelActions.unlinkFromLibary(originalPanel); | ||
await testSubjects.existOrFail('unlinkPanelSuccess'); | ||
|
||
const updatedPanel = await testSubjects.find('embeddablePanelHeading-embeddablelibrarymap'); | ||
const libraryActionExists = await testSubjects.descendantExists( | ||
'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION', | ||
updatedPanel | ||
); | ||
expect(libraryActionExists).to.be(false); | ||
|
||
await dashboardAddPanel.clickOpenAddPanel(); | ||
await dashboardAddPanel.filterEmbeddableNames('embeddable library map'); | ||
await find.existsByLinkText('embeddable library map'); | ||
await dashboardAddPanel.closeAddPanel(); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters