-
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.
[Lens] Add functional tests on chart transitions and pie chart (#74083)…
… (#74565)
- Loading branch information
Showing
10 changed files
with
255 additions
and
106 deletions.
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
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,64 @@ | ||
/* | ||
* 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 ({ getService, getPageObjects }: FtrProviderContext) { | ||
const PageObjects = getPageObjects(['header', 'common', 'dashboard', 'timePicker', 'lens']); | ||
|
||
const find = getService('find'); | ||
const dashboardAddPanel = getService('dashboardAddPanel'); | ||
const elasticChart = getService('elasticChart'); | ||
const browser = getService('browser'); | ||
const retry = getService('retry'); | ||
const testSubjects = getService('testSubjects'); | ||
const filterBar = getService('filterBar'); | ||
|
||
async function clickInChart(x: number, y: number) { | ||
const el = await elasticChart.getCanvas(); | ||
await browser.getActions().move({ x, y, origin: el._webElement }).click().perform(); | ||
} | ||
|
||
describe('lens dashboard tests', () => { | ||
it('metric should be embeddable', async () => { | ||
await PageObjects.common.navigateToApp('dashboard'); | ||
await PageObjects.dashboard.clickNewDashboard(); | ||
await dashboardAddPanel.clickOpenAddPanel(); | ||
await dashboardAddPanel.filterEmbeddableNames('Artistpreviouslyknownaslens'); | ||
await find.clickByButtonText('Artistpreviouslyknownaslens'); | ||
await dashboardAddPanel.closeAddPanel(); | ||
await PageObjects.lens.goToTimeRange(); | ||
await PageObjects.lens.assertMetric('Maximum of bytes', '19,986'); | ||
}); | ||
|
||
it('should be able to add filters/timerange by clicking in XYChart', async () => { | ||
await PageObjects.common.navigateToApp('dashboard'); | ||
await PageObjects.dashboard.clickNewDashboard(); | ||
await dashboardAddPanel.clickOpenAddPanel(); | ||
await dashboardAddPanel.filterEmbeddableNames('lnsXYvis'); | ||
await find.clickByButtonText('lnsXYvis'); | ||
await dashboardAddPanel.closeAddPanel(); | ||
await PageObjects.lens.goToTimeRange(); | ||
await clickInChart(5, 5); // hardcoded position of bar | ||
|
||
await retry.try(async () => { | ||
await testSubjects.click('applyFiltersPopoverButton'); | ||
await testSubjects.missingOrFail('applyFiltersPopoverButton'); | ||
}); | ||
|
||
await PageObjects.lens.assertExactText( | ||
'[data-test-subj="embeddablePanelHeading-lnsXYvis"]', | ||
'lnsXYvis' | ||
); | ||
const time = await PageObjects.timePicker.getTimeConfig(); | ||
expect(time.start).to.equal('Sep 21, 2015 @ 09:00:00.000'); | ||
expect(time.end).to.equal('Sep 21, 2015 @ 12:00:00.000'); | ||
const hasIpFilter = await filterBar.hasFilter('ip', '97.220.3.248'); | ||
expect(hasIpFilter).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
Oops, something went wrong.