mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Tests] Add test coverage for handling multiple data views (#184460)
## Summary Tests extracted from #180425. This adds some smoke tests coverage for supporting multiple data views and how dashboards/visualizations interact with the `courier:ignoreFieldIfNotInIndex` advanced setting in Dashboard, Controls, Lens, and Maps. Flaky test runner x 50: https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6160 ### Checklist Delete any items that are not applicable to this PR. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### Risk Matrix Delete this section if it is not applicable to this PR. Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release. When forming the risk matrix, consider some of the following examples and how they may potentially impact the change: | Risk | Probability | Severity | Mitigation/Notes | |---------------------------|-------------|----------|-------------------------| | Multiple Spaces—unexpected behavior in non-default Kibana Space. | Low | High | Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces. | | Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. | High | Low | Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure. | | Code should gracefully handle cases when feature X or plugin Y are disabled. | Medium | High | Unit tests will verify that any feature flag or plugin combination still results in our service operational. | | [See more potential risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) | ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
parent
4e8876d6a4
commit
aa109676fa
8 changed files with 477 additions and 0 deletions
|
@ -30,5 +30,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
|
|||
loadTestFile(require.resolve('./dashboard_filter_bar'));
|
||||
loadTestFile(require.resolve('./dashboard_filtering'));
|
||||
loadTestFile(require.resolve('./panel_expand_toggle'));
|
||||
loadTestFile(require.resolve('./multiple_data_views'));
|
||||
});
|
||||
}
|
||||
|
|
69
test/functional/apps/dashboard/group2/multiple_data_views.ts
Normal file
69
test/functional/apps/dashboard/group2/multiple_data_views.ts
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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 filtering behavior of a dashboard with multiple data views
|
||||
*/
|
||||
export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const dashboardAddPanel = getService('dashboardAddPanel');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const filterBar = getService('filterBar');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const PageObjects = getPageObjects(['common', 'dashboard', 'timePicker', 'home']);
|
||||
|
||||
describe('dashboard multiple data views', () => {
|
||||
before(async () => {
|
||||
await kibanaServer.uiSettings.update({ 'courier:ignoreFilterIfFieldNotInIndex': true });
|
||||
await PageObjects.common.navigateToApp('home');
|
||||
await PageObjects.home.goToSampleDataPage();
|
||||
await PageObjects.home.addSampleDataSet('flights');
|
||||
await PageObjects.home.addSampleDataSet('logs');
|
||||
await PageObjects.dashboard.navigateToApp();
|
||||
await PageObjects.dashboard.gotoDashboardLandingPage();
|
||||
await PageObjects.dashboard.clickNewDashboard();
|
||||
await dashboardAddPanel.addSavedSearches(['[Flights] Flight Log', '[Logs] Visits']);
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
await PageObjects.timePicker.setCommonlyUsedTime('This_week');
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await PageObjects.common.navigateToApp('home');
|
||||
await PageObjects.home.goToSampleDataPage();
|
||||
await PageObjects.home.removeSampleDataSet('flights');
|
||||
await PageObjects.home.removeSampleDataSet('logs');
|
||||
await kibanaServer.uiSettings.unset('courier:ignoreFilterIfFieldNotInIndex');
|
||||
});
|
||||
|
||||
it('ignores filters on panels using a data view without the filter field', async () => {
|
||||
await filterBar.addFilter({ field: 'Carrier', operation: 'exists' });
|
||||
const logsSavedSearchPanel = (await testSubjects.findAll('embeddedSavedSearchDocTable'))[1];
|
||||
expect(
|
||||
await (
|
||||
await logsSavedSearchPanel.findByCssSelector('[data-document-number]')
|
||||
).getAttribute('data-document-number')
|
||||
).to.not.be('0');
|
||||
});
|
||||
|
||||
it('applies filters on panels using a data view without the filter field', async () => {
|
||||
await kibanaServer.uiSettings.update({ 'courier:ignoreFilterIfFieldNotInIndex': false });
|
||||
await PageObjects.dashboard.navigateToApp();
|
||||
await testSubjects.click('edit-unsaved-New-Dashboard');
|
||||
await PageObjects.dashboard.waitForRenderComplete();
|
||||
const logsSavedSearchPanel = (await testSubjects.findAll('embeddedSavedSearchDocTable'))[1];
|
||||
expect(
|
||||
await (
|
||||
await logsSavedSearchPanel.findByCssSelector('[data-document-number]')
|
||||
).getAttribute('data-document-number')
|
||||
).to.be('0');
|
||||
});
|
||||
});
|
||||
}
|
|
@ -46,5 +46,6 @@ export default function ({ loadTestFile, getService, getPageObjects }: FtrProvid
|
|||
loadTestFile(require.resolve('./control_group_chaining'));
|
||||
loadTestFile(require.resolve('./control_group_apply_button'));
|
||||
loadTestFile(require.resolve('./replace_controls'));
|
||||
loadTestFile(require.resolve('./multiple_data_views'));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,188 @@
|
|||
/*
|
||||
* 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 { OPTIONS_LIST_CONTROL, RANGE_SLIDER_CONTROL } from '@kbn/controls-plugin/common';
|
||||
import expect from '@kbn/expect';
|
||||
|
||||
import { FtrProviderContext } from '../../../../ftr_provider_context';
|
||||
|
||||
export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const security = getService('security');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const filterBar = getService('filterBar');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const dashboardAddPanel = getService('dashboardAddPanel');
|
||||
const { common, dashboard, dashboardControls } = getPageObjects([
|
||||
'dashboardControls',
|
||||
'dashboard',
|
||||
'console',
|
||||
'common',
|
||||
'header',
|
||||
]);
|
||||
|
||||
describe('Dashboard control group with multiple data views', () => {
|
||||
let controlIds: string[];
|
||||
|
||||
before(async () => {
|
||||
await security.testUser.setRoles(['kibana_admin', 'kibana_sample_admin']);
|
||||
|
||||
await kibanaServer.importExport.load(
|
||||
'test/functional/fixtures/kbn_archiver/dashboard/current/kibana'
|
||||
);
|
||||
await esArchiver.load('test/functional/fixtures/es_archiver/kibana_sample_data_flights');
|
||||
await kibanaServer.importExport.load(
|
||||
'test/functional/fixtures/kbn_archiver/kibana_sample_data_flights_index_pattern'
|
||||
);
|
||||
await kibanaServer.uiSettings.replace({
|
||||
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
|
||||
'courier:ignoreFilterIfFieldNotInIndex': true,
|
||||
});
|
||||
|
||||
await common.setTime({
|
||||
from: 'Apr 10, 2018 @ 00:00:00.000',
|
||||
to: 'Nov 15, 2018 @ 00:00:00.000',
|
||||
});
|
||||
|
||||
await dashboard.navigateToApp();
|
||||
await dashboard.clickNewDashboard();
|
||||
|
||||
await dashboardControls.createControl({
|
||||
controlType: OPTIONS_LIST_CONTROL,
|
||||
dataViewTitle: 'kibana_sample_data_flights',
|
||||
fieldName: 'Carrier',
|
||||
title: 'Carrier',
|
||||
});
|
||||
|
||||
await dashboardControls.createControl({
|
||||
controlType: RANGE_SLIDER_CONTROL,
|
||||
dataViewTitle: 'kibana_sample_data_flights',
|
||||
fieldName: 'AvgTicketPrice',
|
||||
title: 'Average Ticket Price',
|
||||
});
|
||||
|
||||
await dashboardControls.createControl({
|
||||
controlType: OPTIONS_LIST_CONTROL,
|
||||
dataViewTitle: 'logstash-*',
|
||||
fieldName: 'machine.os.raw',
|
||||
title: 'Operating System',
|
||||
});
|
||||
|
||||
await dashboardControls.createControl({
|
||||
controlType: RANGE_SLIDER_CONTROL,
|
||||
dataViewTitle: 'logstash-*',
|
||||
fieldName: 'bytes',
|
||||
title: 'Bytes',
|
||||
});
|
||||
|
||||
await dashboardAddPanel.addSavedSearch('logstash hits');
|
||||
|
||||
controlIds = await dashboardControls.getAllControlIds();
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await kibanaServer.importExport.unload(
|
||||
'test/functional/fixtures/kbn_archiver/dashboard/current/kibana'
|
||||
);
|
||||
await esArchiver.unload('test/functional/fixtures/es_archiver/kibana_sample_data_flights');
|
||||
await kibanaServer.importExport.unload(
|
||||
'test/functional/fixtures/kbn_archiver/kibana_sample_data_flights_index_pattern'
|
||||
);
|
||||
await security.testUser.restoreDefaults();
|
||||
await kibanaServer.uiSettings.unset('courier:ignoreFilterIfFieldNotInIndex');
|
||||
await kibanaServer.uiSettings.unset('defaultIndex');
|
||||
});
|
||||
|
||||
it('ignores global filters on controls using a data view without the filter field', async () => {
|
||||
await filterBar.addFilter({ field: 'Carrier', operation: 'exists' });
|
||||
|
||||
await dashboardControls.optionsListOpenPopover(controlIds[0]);
|
||||
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('4');
|
||||
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[0]);
|
||||
|
||||
dashboardControls.validateRange('placeholder', controlIds[1], '100', '1200');
|
||||
|
||||
await dashboardControls.optionsListOpenPopover(controlIds[2]);
|
||||
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('5');
|
||||
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[2]);
|
||||
|
||||
dashboardControls.validateRange('placeholder', controlIds[3], '0', '19979');
|
||||
});
|
||||
|
||||
it('ignores controls on other controls and panels using a data view without the control field by default', async () => {
|
||||
await filterBar.removeFilter('Carrier');
|
||||
await dashboardControls.optionsListOpenPopover(controlIds[0]);
|
||||
await dashboardControls.optionsListPopoverSelectOption('Kibana Airlines');
|
||||
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[0]);
|
||||
|
||||
dashboardControls.validateRange('placeholder', controlIds[1], '100', '1196');
|
||||
|
||||
await dashboardControls.optionsListOpenPopover(controlIds[2]);
|
||||
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('5');
|
||||
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[2]);
|
||||
|
||||
dashboardControls.validateRange('placeholder', controlIds[3], '0', '19979');
|
||||
|
||||
const logstashSavedSearchPanel = await testSubjects.find('embeddedSavedSearchDocTable');
|
||||
expect(
|
||||
await (
|
||||
await logstashSavedSearchPanel.findByCssSelector('[data-document-number]')
|
||||
).getAttribute('data-document-number')
|
||||
).to.not.be('0');
|
||||
});
|
||||
|
||||
it('applies global filters on controls using data view a without the filter field', async () => {
|
||||
await kibanaServer.uiSettings.update({ 'courier:ignoreFilterIfFieldNotInIndex': false });
|
||||
await common.navigateToApp('dashboard');
|
||||
await testSubjects.click('edit-unsaved-New-Dashboard');
|
||||
await filterBar.addFilter({ field: 'Carrier', operation: 'exists' });
|
||||
|
||||
await Promise.all([
|
||||
dashboardControls.optionsListWaitForLoading(controlIds[0]),
|
||||
dashboardControls.rangeSliderWaitForLoading(controlIds[1]),
|
||||
dashboardControls.optionsListWaitForLoading(controlIds[2]),
|
||||
dashboardControls.rangeSliderWaitForLoading(controlIds[3]),
|
||||
]);
|
||||
|
||||
await dashboardControls.clearControlSelections(controlIds[0]);
|
||||
await dashboardControls.optionsListOpenPopover(controlIds[0]);
|
||||
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('4');
|
||||
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[0]);
|
||||
|
||||
dashboardControls.validateRange('placeholder', controlIds[1], '100', '1200');
|
||||
|
||||
await dashboardControls.optionsListOpenPopover(controlIds[2]);
|
||||
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('0');
|
||||
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[2]);
|
||||
|
||||
dashboardControls.validateRange('placeholder', controlIds[3], '0', '0');
|
||||
});
|
||||
|
||||
it('applies global filters on controls using a data view without the filter field', async () => {
|
||||
await filterBar.removeFilter('Carrier');
|
||||
await dashboardControls.optionsListOpenPopover(controlIds[0]);
|
||||
await dashboardControls.optionsListPopoverSelectOption('Kibana Airlines');
|
||||
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[0]);
|
||||
|
||||
dashboardControls.validateRange('placeholder', controlIds[1], '100', '1196');
|
||||
|
||||
await dashboardControls.optionsListOpenPopover(controlIds[2]);
|
||||
expect(await dashboardControls.optionsListGetCardinalityValue()).to.be('0');
|
||||
await dashboardControls.optionsListEnsurePopoverIsClosed(controlIds[2]);
|
||||
|
||||
dashboardControls.validateRange('placeholder', controlIds[3], '0', '0');
|
||||
|
||||
const logstashSavedSearchPanel = await testSubjects.find('embeddedSavedSearchDocTable');
|
||||
expect(
|
||||
await (
|
||||
await logstashSavedSearchPanel.findByCssSelector('[data-document-number]')
|
||||
).getAttribute('data-document-number')
|
||||
).to.be('0');
|
||||
});
|
||||
});
|
||||
}
|
|
@ -77,6 +77,7 @@ export default ({ getService, loadTestFile, getPageObjects }: FtrProviderContext
|
|||
// total run time ~16 min
|
||||
loadTestFile(require.resolve('./smokescreen')); // 12m 12s
|
||||
loadTestFile(require.resolve('./ad_hoc_data_view')); // 3m 40s
|
||||
loadTestFile(require.resolve('./multiple_data_views'));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
116
x-pack/test/functional/apps/lens/group1/multiple_data_views.ts
Normal file
116
x-pack/test/functional/apps/lens/group1/multiple_data_views.ts
Normal file
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* 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 { DebugState } from '@elastic/charts';
|
||||
import expect from '@kbn/expect';
|
||||
import { FtrProviderContext } from '../../../ftr_provider_context';
|
||||
|
||||
export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const PageObjects = getPageObjects(['common', 'visualize', 'lens']);
|
||||
const filterBar = getService('filterBar');
|
||||
const elasticChart = getService('elasticChart');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const esArchiver = getService('esArchiver');
|
||||
|
||||
const expectedLogstashData = [
|
||||
{ x: 1540278360000, y: 4735 },
|
||||
{ x: 1540280820000, y: 2836 },
|
||||
];
|
||||
const expectedFlightsData = [
|
||||
{ x: 1540278720000, y: 12993.16 },
|
||||
{ x: 1540279080000, y: 7927.47 },
|
||||
{ x: 1540279500000, y: 7548.66 },
|
||||
{ x: 1540280400000, y: 8418.08 },
|
||||
{ x: 1540280580000, y: 11577.86 },
|
||||
{ x: 1540281060000, y: 8088.12 },
|
||||
{ x: 1540281240000, y: 6943.55 },
|
||||
];
|
||||
|
||||
function assertMatchesExpectedData(
|
||||
state: DebugState,
|
||||
expectedData: Array<Array<{ x: number; y: number }>>
|
||||
) {
|
||||
expect(
|
||||
state?.bars?.map(({ bars }) =>
|
||||
bars.map((bar) => ({
|
||||
x: bar.x,
|
||||
y: Math.floor(bar.y * 100) / 100,
|
||||
}))
|
||||
)
|
||||
).to.eql(expectedData);
|
||||
}
|
||||
|
||||
describe('lens with multiple data views', () => {
|
||||
const visTitle = 'xyChart with multiple data views';
|
||||
|
||||
before(async () => {
|
||||
await PageObjects.common.setTime({
|
||||
from: 'Oct 23, 2018 @ 07:00:00.000',
|
||||
to: 'Oct 23, 2018 @ 08:00:00.000',
|
||||
});
|
||||
|
||||
await kibanaServer.uiSettings.update({ 'courier:ignoreFilterIfFieldNotInIndex': true });
|
||||
|
||||
await esArchiver.load('test/functional/fixtures/es_archiver/kibana_sample_data_flights');
|
||||
await kibanaServer.importExport.load(
|
||||
'test/functional/fixtures/kbn_archiver/kibana_sample_data_flights_index_pattern'
|
||||
);
|
||||
|
||||
await esArchiver.load('test/functional/fixtures/es_archiver/long_window_logstash');
|
||||
await kibanaServer.importExport.load(
|
||||
'test/functional/fixtures/kbn_archiver/long_window_logstash_index_pattern'
|
||||
);
|
||||
await PageObjects.common.navigateToApp('lens');
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await kibanaServer.uiSettings.unset('courier:ignoreFilterIfFieldNotInIndex');
|
||||
await esArchiver.unload('test/functional/fixtures/es_archiver/kibana_sample_data_flights');
|
||||
await kibanaServer.importExport.unload(
|
||||
'test/functional/fixtures/kbn_archiver/kibana_sample_data_flights_index_pattern'
|
||||
);
|
||||
await esArchiver.unload('test/functional/fixtures/es_archiver/long_window_logstash');
|
||||
await kibanaServer.importExport.unload(
|
||||
'test/functional/fixtures/kbn_archiver/long_window_logstash_index_pattern'
|
||||
);
|
||||
});
|
||||
|
||||
it('should allow building a chart with multiple data views', async () => {
|
||||
await elasticChart.setNewChartUiDebugFlag(true);
|
||||
|
||||
// Logstash layer
|
||||
await PageObjects.lens.switchDataPanelIndexPattern('long-window-logstash-*');
|
||||
await testSubjects.click('fieldToggle-bytes');
|
||||
|
||||
// Flights layer
|
||||
await PageObjects.lens.switchDataPanelIndexPattern('kibana_sample_data_flights');
|
||||
await PageObjects.lens.createLayer('data');
|
||||
await testSubjects.click('fieldToggle-DistanceKilometers');
|
||||
|
||||
const data = await PageObjects.lens.getCurrentChartDebugState('xyVisChart');
|
||||
assertMatchesExpectedData(data, [expectedLogstashData, expectedFlightsData]);
|
||||
});
|
||||
|
||||
it('ignores global filters on layers using a data view without the filter field', async () => {
|
||||
await filterBar.addFilter({ field: 'Carrier', operation: 'exists' });
|
||||
const data = await PageObjects.lens.getCurrentChartDebugState('xyVisChart');
|
||||
assertMatchesExpectedData(data, [expectedLogstashData, expectedFlightsData]);
|
||||
await PageObjects.lens.save(visTitle);
|
||||
});
|
||||
|
||||
it('applies global filters on layers using data view a without the filter field', async () => {
|
||||
await kibanaServer.uiSettings.update({ 'courier:ignoreFilterIfFieldNotInIndex': false });
|
||||
await PageObjects.common.navigateToApp('visualize');
|
||||
await elasticChart.setNewChartUiDebugFlag(true);
|
||||
|
||||
await PageObjects.visualize.openSavedVisualization(visTitle);
|
||||
const data = await PageObjects.lens.getCurrentChartDebugState('xyVisChart');
|
||||
assertMatchesExpectedData(data, [expectedFlightsData]);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -61,5 +61,6 @@ export default function ({ loadTestFile, getService }) {
|
|||
loadTestFile(require.resolve('./es_geo_grid_source'));
|
||||
loadTestFile(require.resolve('./adhoc_data_view'));
|
||||
loadTestFile(require.resolve('./embeddable'));
|
||||
loadTestFile(require.resolve('./multiple_data_views'));
|
||||
});
|
||||
}
|
||||
|
|
100
x-pack/test/functional/apps/maps/group2/multiple_data_views.ts
Normal file
100
x-pack/test/functional/apps/maps/group2/multiple_data_views.ts
Normal file
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* 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';
|
||||
import { FtrProviderContext } from '../../../ftr_provider_context';
|
||||
|
||||
export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const filterBar = getService('filterBar');
|
||||
const testSubjects = getService('testSubjects');
|
||||
const PageObjects = getPageObjects(['common', 'maps']);
|
||||
|
||||
describe('maps with multiple data views', () => {
|
||||
const mapTitle = 'map with multiple data views';
|
||||
|
||||
const createLayerForDataView = async (dataView: string) => {
|
||||
await PageObjects.maps.clickAddLayer();
|
||||
await testSubjects.click('documents');
|
||||
await PageObjects.maps.selectGeoIndexPatternLayer(dataView);
|
||||
await testSubjects.click('importFileButton');
|
||||
await testSubjects.click('layerPanelCancelButton');
|
||||
};
|
||||
|
||||
before(async () => {
|
||||
await PageObjects.common.setTime({
|
||||
from: 'Oct 23, 2018 @ 07:00:00.000',
|
||||
to: 'Oct 23, 2018 @ 08:00:00.000',
|
||||
});
|
||||
|
||||
await esArchiver.load('test/functional/fixtures/es_archiver/kibana_sample_data_flights');
|
||||
await kibanaServer.importExport.load(
|
||||
'test/functional/fixtures/kbn_archiver/kibana_sample_data_flights_index_pattern'
|
||||
);
|
||||
|
||||
await esArchiver.load('test/functional/fixtures/es_archiver/long_window_logstash');
|
||||
await kibanaServer.importExport.load(
|
||||
'test/functional/fixtures/kbn_archiver/long_window_logstash_index_pattern'
|
||||
);
|
||||
await kibanaServer.uiSettings.update({ 'courier:ignoreFilterIfFieldNotInIndex': true });
|
||||
|
||||
await PageObjects.maps.openNewMap();
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await kibanaServer.uiSettings.unset('courier:ignoreFilterIfFieldNotInIndex');
|
||||
await esArchiver.unload('test/functional/fixtures/es_archiver/kibana_sample_data_flights');
|
||||
await kibanaServer.importExport.unload(
|
||||
'test/functional/fixtures/kbn_archiver/kibana_sample_data_flights_index_pattern'
|
||||
);
|
||||
await esArchiver.unload('test/functional/fixtures/es_archiver/long_window_logstash');
|
||||
await kibanaServer.importExport.unload(
|
||||
'test/functional/fixtures/kbn_archiver/long_window_logstash_index_pattern'
|
||||
);
|
||||
});
|
||||
|
||||
it('should allow building a map with multiple data views', async () => {
|
||||
// Logstash layer
|
||||
await createLayerForDataView('long-window-logstash-*');
|
||||
|
||||
// Flights layer
|
||||
await createLayerForDataView('kibana_sample_data_flights');
|
||||
|
||||
expect(await PageObjects.maps.getNumberOfLayers()).to.be(3);
|
||||
expect(await PageObjects.maps.getLayerTocTooltipMsg('kibana_sample_data_flights')).to.equal(
|
||||
'kibana_sample_data_flights\nFound 9 documents.\nResults narrowed by global time'
|
||||
);
|
||||
expect(await PageObjects.maps.getLayerTocTooltipMsg('long-window-logstash-*')).to.equal(
|
||||
'long-window-logstash-*\nFound 2 documents.\nResults narrowed by global time'
|
||||
);
|
||||
});
|
||||
|
||||
it('ignores global filters on layers using a data view without the filter field by default', async () => {
|
||||
await filterBar.addFilter({ field: '@message', operation: 'exists' });
|
||||
expect(await PageObjects.maps.getLayerTocTooltipMsg('kibana_sample_data_flights')).to.equal(
|
||||
'kibana_sample_data_flights\nFound 9 documents.\nResults narrowed by global search\nResults narrowed by global time'
|
||||
);
|
||||
expect(await PageObjects.maps.getLayerTocTooltipMsg('long-window-logstash-*')).to.equal(
|
||||
'long-window-logstash-*\nFound 2 documents.\nResults narrowed by global search\nResults narrowed by global time'
|
||||
);
|
||||
|
||||
await PageObjects.maps.saveMap(mapTitle);
|
||||
});
|
||||
|
||||
it('applies global filters on layers using data view a without the filter field', async () => {
|
||||
await kibanaServer.uiSettings.update({ 'courier:ignoreFilterIfFieldNotInIndex': false });
|
||||
await PageObjects.maps.loadSavedMap(mapTitle);
|
||||
expect(await PageObjects.maps.getLayerTocTooltipMsg('kibana_sample_data_flights')).to.equal(
|
||||
'kibana_sample_data_flights\nNo results found.\nResults narrowed by global search\nResults narrowed by global time'
|
||||
);
|
||||
expect(await PageObjects.maps.getLayerTocTooltipMsg('long-window-logstash-*')).to.equal(
|
||||
'long-window-logstash-*\nFound 2 documents.\nResults narrowed by global search\nResults narrowed by global time'
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue