-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Time to Visualize] Adds functional tests for linking/unlinking panel from embeddable library #89612
[Time to Visualize] Adds functional tests for linking/unlinking panel from embeddable library #89612
Changes from all commits
1f3d816
b0f0988
ddee22d
eb5fe4f
67c6249
20f7abc
d9fd188
396cd9f
14d4118
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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); | ||
}); | ||
}); | ||
} |
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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One concern I have about this test is that "document example" saved object is used in other maps tests. What happens if there is an error linking the saved object back to the library? Will down stream tests be effected? Seems like there is not a good way to clean up the "document example" saved object incase it gets left in a stranded state. How about creating a new map saved object in https://github.com/elastic/kibana/blob/master/x-pack/test/functional/es_archives/maps/kibana/data.json that is used only in this test to avoid an potential flaky tests if this test fails. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The 'unlink' feature doesn't delete any saved objects. It only affects the panel that it is applied against, and this panel looks to be created on a new dashboard so it shouldn't cause any downstream problems. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nreese I've updated the maps tests to create a new map. Can you take a look when you get a chance? |
||
}); | ||
|
||
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(); | ||
}); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!