-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Dashboard By Value Testing Lens #89581
Merged
ThomThomson
merged 5 commits into
elastic:master
from
ThomThomson:feature/timeToVisualizeFunctionalTests
Feb 2, 2021
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2c503ea
added lens by value tests, started maps by value
ThomThomson 1fa1918
rollback addition of maps tests
ThomThomson e062695
Merge branch 'master' into feature/timeToVisualizeFunctionalTests
kibanamachine 88d68d2
Merge branch 'master' of github.com:elastic/kibana into feature/timeT…
ThomThomson d669a8f
added createAndAddLensFromDashboard to the lens_page object
ThomThomson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
x-pack/test/functional/apps/dashboard/dashboard_lens_by_value.ts
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,101 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function ({ getPageObjects, getService }: FtrProviderContext) { | ||
const PageObjects = getPageObjects(['common', 'dashboard', 'visualize', 'lens']); | ||
|
||
const log = getService('log'); | ||
const find = getService('find'); | ||
const esArchiver = getService('esArchiver'); | ||
const dashboardPanelActions = getService('dashboardPanelActions'); | ||
const dashboardVisualizations = getService('dashboardVisualizations'); | ||
|
||
async function createAndAddLensByValue() { | ||
log.debug(`createAndAddLensByValue`); | ||
const inViewMode = await PageObjects.dashboard.getIsInViewMode(); | ||
if (inViewMode) { | ||
await PageObjects.dashboard.switchToEditMode(); | ||
} | ||
await PageObjects.visualize.clickLensWidget(); | ||
await PageObjects.lens.goToTimeRange(); | ||
await PageObjects.lens.configureDimension({ | ||
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension', | ||
operation: 'date_histogram', | ||
field: '@timestamp', | ||
}); | ||
|
||
await PageObjects.lens.configureDimension({ | ||
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension', | ||
operation: 'avg', | ||
field: 'bytes', | ||
}); | ||
|
||
await PageObjects.lens.configureDimension({ | ||
dimension: 'lnsXY_splitDimensionPanel > lns-empty-dimension', | ||
operation: 'terms', | ||
field: 'ip', | ||
}); | ||
await PageObjects.lens.saveAndReturn(); | ||
} | ||
|
||
describe('dashboard lens by value', function () { | ||
before(async () => { | ||
await esArchiver.loadIfNeeded('logstash_functional'); | ||
await esArchiver.loadIfNeeded('lens/basic'); | ||
await PageObjects.common.navigateToApp('dashboard'); | ||
await PageObjects.dashboard.preserveCrossAppState(); | ||
await PageObjects.dashboard.clickNewDashboard(); | ||
}); | ||
|
||
it('can add a lens panel by value', async () => { | ||
await dashboardVisualizations.ensureNewVisualizationDialogIsShowing(); | ||
await createAndAddLensByValue(); | ||
const newPanelCount = await PageObjects.dashboard.getPanelCount(); | ||
expect(newPanelCount).to.eql(1); | ||
}); | ||
|
||
it('edits to a by value lens panel are properly applied', async () => { | ||
await PageObjects.dashboard.waitForRenderComplete(); | ||
await dashboardPanelActions.openContextMenu(); | ||
await dashboardPanelActions.clickEdit(); | ||
await PageObjects.lens.switchToVisualization('donut'); | ||
await PageObjects.lens.saveAndReturn(); | ||
await PageObjects.dashboard.waitForRenderComplete(); | ||
|
||
const pieExists = await find.existsByCssSelector('.lnsPieExpression__container'); | ||
expect(pieExists).to.be(true); | ||
}); | ||
|
||
it('editing and saving a lens by value panel retains number of panels', async () => { | ||
const originalPanelCount = await PageObjects.dashboard.getPanelCount(); | ||
await PageObjects.dashboard.waitForRenderComplete(); | ||
await dashboardPanelActions.openContextMenu(); | ||
await dashboardPanelActions.clickEdit(); | ||
await PageObjects.lens.switchToVisualization('treemap'); | ||
await PageObjects.lens.saveAndReturn(); | ||
await PageObjects.dashboard.waitForRenderComplete(); | ||
const newPanelCount = await PageObjects.dashboard.getPanelCount(); | ||
expect(newPanelCount).to.eql(originalPanelCount); | ||
}); | ||
|
||
it('updates panel on dashboard when a by value panel is saved to library', async () => { | ||
const newTitle = 'look out library, here I come!'; | ||
const originalPanelCount = await PageObjects.dashboard.getPanelCount(); | ||
await PageObjects.dashboard.waitForRenderComplete(); | ||
await dashboardPanelActions.openContextMenu(); | ||
await dashboardPanelActions.clickEdit(); | ||
await PageObjects.lens.save(newTitle, false, true); | ||
await PageObjects.dashboard.waitForRenderComplete(); | ||
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); | ||
}); | ||
}); | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this function might be helpful to throw into a page objects somewhere for re-use
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.
Good call, I've added this to the lens page, and made it generic, to be used either by value or by reference.