[8.x] migrate discover session multiple data view test to discover (#213991) (#214020)

# Backport

This will backport the following commits from `main` to `8.x`:
- [migrate discover session multiple data view test to discover
(#213991)](https://github.com/elastic/kibana/pull/213991)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Nathan
Reese","email":"reese.nathan@elastic.co"},"sourceCommit":{"committedDate":"2025-03-11T21:27:47Z","message":"migrate
discover session multiple data view test to discover (#213991)\n\nCloses
https://github.com/elastic/kibana/issues/191880\n\nSkipped test had the
following problems\n* installed/uninstall sample data through the UI\n*
Generated new dashboard\n* Tested discover session embeddable specific
code.\n\nThis PR resolves these problems by\n* Using already installed
test data and avoiding UI flakiness of\ninstalling/uninstalling sample
data\n* Uses pre-built dashboard\n* moves test to discover app since its
testing the discover session\nembeddable and is not dashboard
specific.\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"b7ce4e4f24ced5477a9b0b724e2bb534569b0fd6","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","release_note:skip","backport:version","v9.1.0","v8.19.0"],"title":"migrate
discover session multiple data view test to
discover","number":213991,"url":"https://github.com/elastic/kibana/pull/213991","mergeCommit":{"message":"migrate
discover session multiple data view test to discover (#213991)\n\nCloses
https://github.com/elastic/kibana/issues/191880\n\nSkipped test had the
following problems\n* installed/uninstall sample data through the UI\n*
Generated new dashboard\n* Tested discover session embeddable specific
code.\n\nThis PR resolves these problems by\n* Using already installed
test data and avoiding UI flakiness of\ninstalling/uninstalling sample
data\n* Uses pre-built dashboard\n* moves test to discover app since its
testing the discover session\nembeddable and is not dashboard
specific.\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"b7ce4e4f24ced5477a9b0b724e2bb534569b0fd6"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/213991","number":213991,"mergeCommit":{"message":"migrate
discover session multiple data view test to discover (#213991)\n\nCloses
https://github.com/elastic/kibana/issues/191880\n\nSkipped test had the
following problems\n* installed/uninstall sample data through the UI\n*
Generated new dashboard\n* Tested discover session embeddable specific
code.\n\nThis PR resolves these problems by\n* Using already installed
test data and avoiding UI flakiness of\ninstalling/uninstalling sample
data\n* Uses pre-built dashboard\n* moves test to discover app since its
testing the discover session\nembeddable and is not dashboard
specific.\n\n---------\n\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"b7ce4e4f24ced5477a9b0b724e2bb534569b0fd6"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Nathan Reese <reese.nathan@elastic.co>
This commit is contained in:
Kibana Machine 2025-03-12 10:22:15 +11:00 committed by GitHub
parent e2c5829e9b
commit dbe31ef45a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 129 additions and 77 deletions

View file

@ -31,6 +31,5 @@ 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'));
});
}

View file

@ -1,76 +0,0 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
* License v3.0 only", 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 { common, dashboard, timePicker, home } = getPageObjects([
'common',
'dashboard',
'timePicker',
'home',
]);
// Failing: See https://github.com/elastic/kibana/issues/191880
describe.skip('dashboard multiple data views', () => {
before(async () => {
await kibanaServer.uiSettings.update({ 'courier:ignoreFilterIfFieldNotInIndex': true });
await common.navigateToApp('home');
await home.goToSampleDataPage();
await home.addSampleDataSet('flights');
await home.addSampleDataSet('logs');
await dashboard.navigateToApp();
await dashboard.gotoDashboardLandingPage();
await dashboard.clickNewDashboard();
await dashboardAddPanel.addSavedSearches(['[Flights] Flight Log', '[Logs] Visits']);
await dashboard.waitForRenderComplete();
await timePicker.setCommonlyUsedTime('This_week');
});
after(async () => {
await common.navigateToApp('home');
await home.goToSampleDataPage();
await home.removeSampleDataSet('flights');
await 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 dashboard.navigateToApp();
await testSubjects.click('edit-unsaved-New-Dashboard');
await dashboard.waitForRenderComplete();
const logsSavedSearchPanel = (await testSubjects.findAll('embeddedSavedSearchDocTable'))[1];
expect(
await (
await logsSavedSearchPanel.findByCssSelector('[data-document-number]')
).getAttribute('data-document-number')
).to.be('0');
});
});
}

View file

@ -23,5 +23,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
});
loadTestFile(require.resolve('./_saved_search_embeddable'));
loadTestFile(require.resolve('./multiple_data_views'));
});
}

View file

@ -0,0 +1,73 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
* License v3.0 only", 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 dashboardExpect = getService('dashboardExpect');
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const testSubjects = getService('testSubjects');
const { dashboard } = getPageObjects(['dashboard']);
describe('discover session multiple data views', () => {
before(async () => {
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/dashboard/current/data');
await kibanaServer.savedObjects.cleanStandardList();
await kibanaServer.importExport.load(
'test/functional/fixtures/kbn_archiver/dashboard/current/kibana'
);
await kibanaServer.uiSettings.replace({
defaultIndex: '0bf35f60-3dc9-11e8-8660-4d65aa086b3c',
});
});
after(async () => {
await kibanaServer.savedObjects.cleanStandardList();
});
describe('courier:ignoreFilterIfFieldNotInIndex disabled', () => {
before(async () => {
await dashboard.navigateToApp();
await dashboard.loadSavedDashboard('discover session multiple data views');
await dashboard.waitForRenderComplete();
});
it('Should display no results from logstash-* when filtered by animals data view', async function () {
await dashboard.waitForRenderComplete();
await dashboardExpect.savedSearchNoResult();
});
});
describe('courier:ignoreFilterIfFieldNotInIndex enabled', () => {
before(async () => {
await kibanaServer.uiSettings.update({ 'courier:ignoreFilterIfFieldNotInIndex': true });
await dashboard.navigateToApp();
await dashboard.loadSavedDashboard('discover session multiple data views');
await dashboard.waitForRenderComplete();
});
after(async () => {
await kibanaServer.uiSettings.unset('courier:ignoreFilterIfFieldNotInIndex');
});
it('Should display results from logstash-* when filtered by animals data view', async function () {
const logstashSavedSearchPanel = await testSubjects.find('embeddedSavedSearchDocTable');
expect(
await (
await logstashSavedSearchPanel.findByCssSelector('[data-document-number]')
).getAttribute('data-document-number')
).to.be('500');
});
});
});
}

View file

@ -3329,4 +3329,59 @@
"managed": false,
"coreMigrationVersion": "8.8.0",
"typeMigrationVersion": "10.2.0"
}
{
"id": "ce023765-c6b8-4198-8d0b-318229c2294b",
"type": "dashboard",
"namespaces": [
"default"
],
"updated_at": "2025-03-11T18:18:29.712Z",
"created_at": "2025-03-11T18:18:23.099Z",
"version": "WzExNSwxXQ==",
"attributes": {
"version": 3,
"description": "",
"refreshInterval": {
"pause": true,
"value": 60000
},
"timeRestore": true,
"timeFrom": "now-15y",
"title": "discover session multiple data views",
"timeTo": "now",
"controlGroupInput": {
"chainingSystem": "HIERARCHICAL",
"controlStyle": "oneLine",
"ignoreParentSettingsJSON": "{\"ignoreFilters\":false,\"ignoreQuery\":false,\"ignoreTimerange\":false,\"ignoreValidations\":false}",
"panelsJSON": "{}",
"showApplySelections": false
},
"optionsJSON": "{\"useMargins\":true,\"syncColors\":false,\"syncCursor\":true,\"syncTooltips\":false,\"hidePanelTitles\":false}",
"panelsJSON": "[{\"type\":\"search\",\"title\":\"Rendering Test: saved search\",\"panelRefName\":\"panel_acc95967-6664-4922-b4e8-5cdeed30d5d8\",\"embeddableConfig\":{\"description\":\"\",\"enhancements\":{\"dynamicActions\":{\"events\":[]}},\"columns\":[\"bytes\",\"clientip\"],\"rowsPerPage\":10,\"grid\":{}},\"panelIndex\":\"acc95967-6664-4922-b4e8-5cdeed30d5d8\",\"gridData\":{\"x\":0,\"y\":0,\"w\":24,\"h\":15,\"i\":\"acc95967-6664-4922-b4e8-5cdeed30d5d8\"}}]",
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"filter\":[{\"meta\":{\"disabled\":false,\"negate\":false,\"alias\":null,\"key\":\"animal\",\"field\":\"animal\",\"type\":\"exists\",\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index\"},\"query\":{\"exists\":{\"field\":\"animal\"}},\"$state\":{\"store\":\"appState\"}}],\"query\":{\"query\":\"\",\"language\":\"kuery\"}}"
}
},
"references": [
{
"name": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index",
"type": "index-pattern",
"id": "a0f483a0-3dc9-11e8-8660-4d65aa086b3c"
},
{
"name": "acc95967-6664-4922-b4e8-5cdeed30d5d8:panel_acc95967-6664-4922-b4e8-5cdeed30d5d8",
"type": "search",
"id": "be5accf0-3dca-11e8-8660-4d65aa086b3c"
},
{
"name": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index",
"type": "index-pattern",
"id": "a0f483a0-3dc9-11e8-8660-4d65aa086b3c"
}
],
"managed": false,
"coreMigrationVersion": "8.8.0",
"typeMigrationVersion": "10.2.0"
}