From 3d4dd8e02143743e3ca8cc429a84ce5a803965e8 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Thu, 3 Aug 2023 15:28:25 +0200 Subject: [PATCH 01/23] test(discover-log-explorer): setup dataset selector mock data --- .../discover_log_explorer/dataset_selector.ts | 197 ++++++++ .../apps/discover_log_explorer/index.ts | 1 + .../data_streams/data.json.gz | Bin 0 -> 29526 bytes .../data_streams/mappings.json | 419 ++++++++++++++++++ .../discover_log_explorer/logs/data.json.gz | 0 .../discover_log_explorer/logs/mappings.json | 0 6 files changed, 617 insertions(+) create mode 100644 x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts create mode 100644 x-pack/test/functional/es_archives/discover_log_explorer/data_streams/data.json.gz create mode 100644 x-pack/test/functional/es_archives/discover_log_explorer/data_streams/mappings.json create mode 100644 x-pack/test/functional/es_archives/discover_log_explorer/logs/data.json.gz create mode 100644 x-pack/test/functional/es_archives/discover_log_explorer/logs/mappings.json diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts new file mode 100644 index 0000000000000..13e5b4393b21a --- /dev/null +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -0,0 +1,197 @@ +/* + * 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'; + +interface IntegrationPackage { + name: string; + version: string; +} + +const packages: IntegrationPackage[] = [ + { + name: '1password', + version: '1.18.0', + }, + { + name: 'activemq', + version: '0.13.0', + }, + { + name: 'airflow', + version: '0.2.0', + }, + { + name: 'akamai', + version: '2.14.0', + }, + { + name: 'apache', + version: '1.14.0', + }, + { + name: 'apache_spark', + version: '0.6.0', + }, + { + name: 'apache_tomcat', + version: '0.12.1', + }, + { + name: 'apm', + version: '8.10.0-preview-1689351101', + }, + { + name: 'arista_ngfw', + version: '0.2.0', + }, + { + name: 'atlassian_bitbucket', + version: '1.14.0', + }, + { + name: 'atlassian_confluence', + version: '1.15.0', + }, + { + name: 'atlassian_jira', + version: '1.15.0', + }, + { + name: 'auditd', + version: '3.12.0', + }, + { + name: 'auditd_manager', + version: '1.12.0', + }, + { + name: 'auth0', + version: '1.10.0', + }, + { + name: 'aws', + version: '1.51.0', + }, + { + name: 'aws_logs', + version: '0.5.0', + }, + { + name: 'awsfargate', + version: '0.3.0', + }, + { + name: 'azure', + version: '1.5.28', + }, + { + name: 'azure_app_service', + version: '0.0.1', + }, + { + name: 'azure_application_insights', + version: '1.0.6', + }, + { + name: 'azure_billing', + version: '1.1.3', + }, + { + name: 'azure_blob_storage', + version: '0.5.0', + }, + { + name: 'azure_frontdoor', + version: '1.1.0', + }, + { + name: 'azure_functions', + version: '0.0.1', + }, + { + name: 'azure_metrics', + version: '1.0.17', + }, + { + name: 'barracuda', + version: '1.5.0', + }, + { + name: 'barracuda_cloudgen_firewall', + version: '1.5.0', + }, + { + name: 'beat', + version: '0.1.3', + }, + { + name: 'bitdefender', + version: '1.2.0', + }, + { + name: 'bitwarden', + version: '1.2.0', + }, + { + name: 'bluecoat', + version: '0.17.0', + }, + { + name: 'box_events', + version: '1.7.0', + }, + { + name: 'carbon_black_cloud', + version: '1.13.0', + }, + { + name: 'system', + version: '1.38.1', + }, +]; + +export default function (providerContext: FtrProviderContext) { + const { getService, getPageObjects } = providerContext; + const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); + const logger = getService('log'); + + const supertest = getService('supertest'); + + const uninstallPackage = ({ name, version }: IntegrationPackage) => { + return supertest.delete(`/api/fleet/epm/packages/${name}/${version}`).set('kbn-xsrf', 'xxxx'); + }; + + const installPackage = ({ name, version }: IntegrationPackage) => { + return supertest + .post(`/api/fleet/epm/packages/${name}/${version}`) + .set('kbn-xsrf', 'xxxx') + .send({ force: true }); + }; + + describe('Dataset Selector', () => { + before('initialize tests', async () => { + await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); + await esArchiver.load( + 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + ); + logger.info(`Installing ${packages.length} integration packages.`); + await Promise.all(packages.map(installPackage)); + }); + + after('clean up archives', async () => { + await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); + await esArchiver.unload( + 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + ); + + logger.info(`Uninstalling ${packages.length} integration packages.`); + await Promise.all(packages.map(uninstallPackage)); + }); + }); +} diff --git a/x-pack/test/functional/apps/discover_log_explorer/index.ts b/x-pack/test/functional/apps/discover_log_explorer/index.ts index 719bd8a7fcb28..eb0bbf1a0f488 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/index.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/index.ts @@ -11,5 +11,6 @@ export default function ({ loadTestFile }: FtrProviderContext) { describe('Discover Log-Explorer profile', function () { loadTestFile(require.resolve('./customization')); loadTestFile(require.resolve('./dataset_selection_state')); + loadTestFile(require.resolve('./dataset_selector')); }); } diff --git a/x-pack/test/functional/es_archives/discover_log_explorer/data_streams/data.json.gz b/x-pack/test/functional/es_archives/discover_log_explorer/data_streams/data.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..4e72a78a4f8b9b5eb2f44aabfada690d091e5826 GIT binary patch literal 29526 zcma*Qd0f=x+CQ#Yq8U+9S&^X92|bi(rYJa!J1Ppt<%qZdDu(5PhR7xiieYL3h6;r+ zD&Ud`C@Lz;sJJg6D67i2At1}30s}M5%p6~1T{4uYK_kG>hecji7f9mv@ zZSB#8|M!-0UABwY_!^%jZ4GYyT9aJ={O;=Y0;iiJN921%TD@J>_Vc^pVYo@PyzVRpik@D7=kYh>XtG1nJX=~_xE?rkI4OV7K8iMTNbuVSw25G*jqpnTY)+}jU zyH2U9)jg31w@KPx=tkK#^fAkBiqDTwNHh`mMe}psn{O(2%ZToF`9OAUMr}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U&EGm%Ogdmx^|%2Mc_S^PO7NxQ2zsatp?*S7T3>SAOH=<2y=Ley-iLj_u(%%hPhp z%Ay_l^v_EgaV#eS-!BGU_N|!G<||%}I6;Levh@m5eFLhSSaRP8z@25+11e=oYUdwlG)b|50oGrS>jPjGV(i%{T^mtq#S8)_f2IJ z3a?IkGq2+4EPV^>gA L9tOW<-sS%T0U|_7 literal 0 HcmV?d00001 diff --git a/x-pack/test/functional/es_archives/discover_log_explorer/data_streams/mappings.json b/x-pack/test/functional/es_archives/discover_log_explorer/data_streams/mappings.json new file mode 100644 index 0000000000000..ed9e5982f576f --- /dev/null +++ b/x-pack/test/functional/es_archives/discover_log_explorer/data_streams/mappings.json @@ -0,0 +1,419 @@ +{ + "type": "data_stream", + "value": { + "data_stream": "logs-gaming-activity", + "template": { + "_meta": { + "description": "Template for my time series data", + "my-custom-meta-field": "More arbitrary metadata" + }, + "data_stream": { + "allow_custom_routing": false, + "hidden": false + }, + "index_patterns": [ + "logs-gaming-activity" + ], + "name": "logs-gaming-activity", + "priority": 500, + "template": { + "mappings": { + "properties": { + "@timestamp": { + "format": "date_optional_time||epoch_millis", + "type": "date" + }, + "data_stream": { + "properties": { + "namespace": { + "type": "constant_keyword" + } + } + }, + "message": { + "type": "wildcard" + } + } + } + } + } + } +} + +{ + "type": "data_stream", + "value": { + "data_stream": "logs-gaming-events", + "template": { + "_meta": { + "description": "Template for my time series data", + "my-custom-meta-field": "More arbitrary metadata" + }, + "data_stream": { + "allow_custom_routing": false, + "hidden": false + }, + "index_patterns": [ + "logs-gaming-events" + ], + "name": "logs-gaming-events", + "priority": 500, + "template": { + "mappings": { + "properties": { + "@timestamp": { + "format": "date_optional_time||epoch_millis", + "type": "date" + }, + "data_stream": { + "properties": { + "namespace": { + "type": "constant_keyword" + } + } + }, + "message": { + "type": "wildcard" + } + } + } + } + } + } +} + +{ + "type": "data_stream", + "value": { + "data_stream": "logs-gaming-scores", + "template": { + "_meta": { + "description": "Template for my time series data", + "my-custom-meta-field": "More arbitrary metadata" + }, + "data_stream": { + "allow_custom_routing": false, + "hidden": false + }, + "index_patterns": [ + "logs-gaming-scores" + ], + "name": "logs-gaming-scores", + "priority": 500, + "template": { + "mappings": { + "properties": { + "@timestamp": { + "format": "date_optional_time||epoch_millis", + "type": "date" + }, + "data_stream": { + "properties": { + "namespace": { + "type": "constant_keyword" + } + } + }, + "message": { + "type": "wildcard" + } + } + } + } + } + } +} + +{ + "type": "data_stream", + "value": { + "data_stream": "logs-manufacturing-downtime", + "template": { + "_meta": { + "description": "Template for my time series data", + "my-custom-meta-field": "More arbitrary metadata" + }, + "data_stream": { + "allow_custom_routing": false, + "hidden": false + }, + "index_patterns": [ + "logs-manufacturing-downtime" + ], + "name": "logs-manufacturing-downtime", + "priority": 500, + "template": { + "mappings": { + "properties": { + "@timestamp": { + "format": "date_optional_time||epoch_millis", + "type": "date" + }, + "data_stream": { + "properties": { + "namespace": { + "type": "constant_keyword" + } + } + }, + "message": { + "type": "wildcard" + } + } + } + } + } + } +} + +{ + "type": "data_stream", + "value": { + "data_stream": "logs-manufacturing-output", + "template": { + "_meta": { + "description": "Template for my time series data", + "my-custom-meta-field": "More arbitrary metadata" + }, + "data_stream": { + "allow_custom_routing": false, + "hidden": false + }, + "index_patterns": [ + "logs-manufacturing-output" + ], + "name": "logs-manufacturing-output", + "priority": 500, + "template": { + "mappings": { + "properties": { + "@timestamp": { + "format": "date_optional_time||epoch_millis", + "type": "date" + }, + "data_stream": { + "properties": { + "namespace": { + "type": "constant_keyword" + } + } + }, + "message": { + "type": "wildcard" + } + } + } + } + } + } +} + +{ + "type": "data_stream", + "value": { + "data_stream": "logs-manufacturing-quality", + "template": { + "_meta": { + "description": "Template for my time series data", + "my-custom-meta-field": "More arbitrary metadata" + }, + "data_stream": { + "allow_custom_routing": false, + "hidden": false + }, + "index_patterns": [ + "logs-manufacturing-quality" + ], + "name": "logs-manufacturing-quality", + "priority": 500, + "template": { + "mappings": { + "properties": { + "@timestamp": { + "format": "date_optional_time||epoch_millis", + "type": "date" + }, + "data_stream": { + "properties": { + "namespace": { + "type": "constant_keyword" + } + } + }, + "message": { + "type": "wildcard" + } + } + } + } + } + } +} + +{ + "type": "data_stream", + "value": { + "data_stream": "logs-retail-customers", + "template": { + "_meta": { + "description": "Template for my time series data", + "my-custom-meta-field": "More arbitrary metadata" + }, + "data_stream": { + "allow_custom_routing": false, + "hidden": false + }, + "index_patterns": [ + "logs-retail-customers" + ], + "name": "logs-retail-customers", + "priority": 500, + "template": { + "mappings": { + "properties": { + "@timestamp": { + "format": "date_optional_time||epoch_millis", + "type": "date" + }, + "data_stream": { + "properties": { + "namespace": { + "type": "constant_keyword" + } + } + }, + "message": { + "type": "wildcard" + } + } + } + } + } + } +} + +{ + "type": "data_stream", + "value": { + "data_stream": "logs-retail-inventory", + "template": { + "_meta": { + "description": "Template for my time series data", + "my-custom-meta-field": "More arbitrary metadata" + }, + "data_stream": { + "allow_custom_routing": false, + "hidden": false + }, + "index_patterns": [ + "logs-retail-inventory" + ], + "name": "logs-retail-inventory", + "priority": 500, + "template": { + "mappings": { + "properties": { + "@timestamp": { + "format": "date_optional_time||epoch_millis", + "type": "date" + }, + "data_stream": { + "properties": { + "namespace": { + "type": "constant_keyword" + } + } + }, + "message": { + "type": "wildcard" + } + } + } + } + } + } +} + +{ + "type": "data_stream", + "value": { + "data_stream": "logs-retail-promotions", + "template": { + "_meta": { + "description": "Template for my time series data", + "my-custom-meta-field": "More arbitrary metadata" + }, + "data_stream": { + "allow_custom_routing": false, + "hidden": false + }, + "index_patterns": [ + "logs-retail-promotions" + ], + "name": "logs-retail-promotions", + "priority": 500, + "template": { + "mappings": { + "properties": { + "@timestamp": { + "format": "date_optional_time||epoch_millis", + "type": "date" + }, + "data_stream": { + "properties": { + "namespace": { + "type": "constant_keyword" + } + } + }, + "message": { + "type": "wildcard" + } + } + } + } + } + } +} + +{ + "type": "data_stream", + "value": { + "data_stream": "logs-retail-sales", + "template": { + "_meta": { + "description": "Template for my time series data", + "my-custom-meta-field": "More arbitrary metadata" + }, + "data_stream": { + "allow_custom_routing": false, + "hidden": false + }, + "index_patterns": [ + "logs-retail-sales" + ], + "name": "logs-retail-sales", + "priority": 500, + "template": { + "mappings": { + "properties": { + "@timestamp": { + "format": "date_optional_time||epoch_millis", + "type": "date" + }, + "data_stream": { + "properties": { + "namespace": { + "type": "constant_keyword" + } + } + }, + "message": { + "type": "wildcard" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/x-pack/test/functional/es_archives/discover_log_explorer/logs/data.json.gz b/x-pack/test/functional/es_archives/discover_log_explorer/logs/data.json.gz new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/x-pack/test/functional/es_archives/discover_log_explorer/logs/mappings.json b/x-pack/test/functional/es_archives/discover_log_explorer/logs/mappings.json new file mode 100644 index 0000000000000..e69de29bb2d1d From 4468506e48a6e5172ab7bc34e0b15d6e56b36e80 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Thu, 3 Aug 2023 15:57:39 +0200 Subject: [PATCH 02/23] test(discover-log-explorer): add customization test for controls --- .../public/customizations/custom_dataset_filters.tsx | 4 +++- .../apps/discover_log_explorer/customization.ts | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/discover_log_explorer/public/customizations/custom_dataset_filters.tsx b/x-pack/plugins/discover_log_explorer/public/customizations/custom_dataset_filters.tsx index f2e1114eeefc7..a669ebea33942 100644 --- a/x-pack/plugins/discover_log_explorer/public/customizations/custom_dataset_filters.tsx +++ b/x-pack/plugins/discover_log_explorer/public/customizations/custom_dataset_filters.tsx @@ -12,6 +12,8 @@ import { DataPublicPluginStart } from '@kbn/data-plugin/public'; import { useControlPanels } from '../hooks/use_control_panels'; import { LogExplorerProfileStateService } from '../state_machines/log_explorer_profile'; +const DATASET_FILTERS_CUSTOMIZATION_ID = 'datasetFiltersCustomization'; + interface CustomDatasetFiltersProps { logExplorerProfileStateService: LogExplorerProfileStateService; data: DataPublicPluginStart; @@ -27,7 +29,7 @@ const CustomDatasetFilters = ({ ); return ( - + { + // Assert does not render on discover app + await PageObjects.common.navigateToApp('discover'); + await testSubjects.missingOrFail('datasetFiltersCustomization'); + + // Assert it renders on log-explorer profile + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await testSubjects.existOrFail('datasetFiltersCustomization'); + }); }); }); } From d1c194b3134f6f1750ba51ccad353ae5c720878b Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 3 Aug 2023 15:12:52 +0000 Subject: [PATCH 03/23] [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' --- .../functional/apps/discover_log_explorer/dataset_selector.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts index 13e5b4393b21a..089c55e4ad6c5 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -4,7 +4,6 @@ * 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'; interface IntegrationPackage { From c4a99dbb7c20aec9252ae8e69e207c0410babea6 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Fri, 4 Aug 2023 10:09:24 +0200 Subject: [PATCH 04/23] test(discover-log-explorer): remove unused files --- .../discover_log_explorer/dataset_selector.ts | 35 ++++++++++--------- .../discover_log_explorer/logs/data.json.gz | 0 .../discover_log_explorer/logs/mappings.json | 0 3 files changed, 19 insertions(+), 16 deletions(-) delete mode 100644 x-pack/test/functional/es_archives/discover_log_explorer/logs/data.json.gz delete mode 100644 x-pack/test/functional/es_archives/discover_log_explorer/logs/mappings.json diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts index 13e5b4393b21a..9970d0fa6a203 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -13,6 +13,18 @@ interface IntegrationPackage { } const packages: IntegrationPackage[] = [ + { + name: 'apache', + version: '1.14.0', + }, + { + name: 'aws', + version: '1.51.0', + }, + { + name: 'system', + version: '1.38.1', + }, { name: '1password', version: '1.18.0', @@ -29,10 +41,6 @@ const packages: IntegrationPackage[] = [ name: 'akamai', version: '2.14.0', }, - { - name: 'apache', - version: '1.14.0', - }, { name: 'apache_spark', version: '0.6.0', @@ -73,10 +81,6 @@ const packages: IntegrationPackage[] = [ name: 'auth0', version: '1.10.0', }, - { - name: 'aws', - version: '1.51.0', - }, { name: 'aws_logs', version: '0.5.0', @@ -149,12 +153,11 @@ const packages: IntegrationPackage[] = [ name: 'carbon_black_cloud', version: '1.13.0', }, - { - name: 'system', - version: '1.38.1', - }, ]; +const initialPackages = packages.slice(0, 3); +const additionalPackages = packages.slice(3); + export default function (providerContext: FtrProviderContext) { const { getService, getPageObjects } = providerContext; const esArchiver = getService('esArchiver'); @@ -180,8 +183,8 @@ export default function (providerContext: FtrProviderContext) { await esArchiver.load( 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' ); - logger.info(`Installing ${packages.length} integration packages.`); - await Promise.all(packages.map(installPackage)); + logger.info(`Installing ${initialPackages.length} integration packages.`); + await Promise.all(initialPackages.map(installPackage)); }); after('clean up archives', async () => { @@ -190,8 +193,8 @@ export default function (providerContext: FtrProviderContext) { 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' ); - logger.info(`Uninstalling ${packages.length} integration packages.`); - await Promise.all(packages.map(uninstallPackage)); + logger.info(`Uninstalling ${initialPackages.length} integration packages.`); + await Promise.all(initialPackages.map(uninstallPackage)); }); }); } diff --git a/x-pack/test/functional/es_archives/discover_log_explorer/logs/data.json.gz b/x-pack/test/functional/es_archives/discover_log_explorer/logs/data.json.gz deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/x-pack/test/functional/es_archives/discover_log_explorer/logs/mappings.json b/x-pack/test/functional/es_archives/discover_log_explorer/logs/mappings.json deleted file mode 100644 index e69de29bb2d1d..0000000000000 From 5c6446e6acd741dad20ac4a4dfde55f2e30657f8 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Fri, 4 Aug 2023 18:30:50 +0200 Subject: [PATCH 05/23] test(discover-log-explorer): wip on tests --- .../dataset_selector/dataset_selector.tsx | 1 + .../sub_components/datasets_popover.tsx | 11 +- .../sub_components/search_controls.tsx | 7 +- .../components/dataset_selector/utils.tsx | 4 + .../discover_log_explorer/dataset_selector.ts | 144 ++++++++++++++++++ .../page_objects/discover_log_explorer.ts | 96 +++++++++++- 6 files changed, 257 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/dataset_selector.tsx b/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/dataset_selector.tsx index aa1fb057bbd32..444ec69c9d266 100644 --- a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/dataset_selector.tsx +++ b/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/dataset_selector.tsx @@ -168,6 +168,7 @@ export function DatasetSelector({ onPanelChange={changePanel} className="eui-yScroll" css={contextMenuStyles} + data-test-subj="datasetSelectorContextMenu" size="s" /> diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_popover.tsx b/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_popover.tsx index d6c9771da019d..e98c7fe2d70e7 100644 --- a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_popover.tsx +++ b/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_popover.tsx @@ -45,7 +45,7 @@ export const DatasetsPopover = ({ return ( {iconType ? ( @@ -74,7 +74,12 @@ export const DatasetsPopover = ({ {...(isMobile && { display: 'block' })} {...props} > - + <span>{selectDatasetLabel}</span> diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/search_controls.tsx b/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/search_controls.tsx index 6a9d55bb2586e..5178b77e61bf8 100644 --- a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/search_controls.tsx +++ b/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/search_controls.tsx @@ -33,7 +33,12 @@ export const SearchControls = ({ search, onSearch, onSort, isLoading }: SearchCo }; return ( - + , + 'data-test-subj': integration.id, panel: integration.id, ...(isLastIntegration && { buttonRef: spyRef }), }); @@ -85,6 +86,7 @@ export const createAllLogDatasetsItem = ({ onClick }: { onClick(): void }) => { const allLogDataset = Dataset.createAllLogsDataset(); return { name: allLogDataset.title, + 'data-test-subj': 'allLogDatasets', icon: allLogDataset.iconType && , onClick, }; @@ -93,6 +95,7 @@ export const createAllLogDatasetsItem = ({ onClick }: { onClick(): void }) => { export const createUnmanagedDatasetsItem = ({ onClick }: { onClick: LoadDatasets }) => { return { name: uncategorizedLabel, + 'data-test-subj': 'unmanagedDatasets', icon: , onClick, panel: UNMANAGED_STREAMS_PANEL_ID, @@ -103,5 +106,6 @@ export const createIntegrationStatusItem = (props: IntegrationsListStatusProps) return { disabled: true, name: , + 'data-test-subj': 'integrationStatusItem', }; }; diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts index 9252b21457e7e..126416964d985 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -4,6 +4,7 @@ * 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'; interface IntegrationPackage { @@ -155,6 +156,13 @@ const packages: IntegrationPackage[] = [ ]; const initialPackages = packages.slice(0, 3); +const initialPackageMap = { + apache: 'Apache HTTP Server', + aws: 'AWS', + system: 'System', +}; +const initialPackagesTexts = Object.values(initialPackageMap); + const additionalPackages = packages.slice(3); export default function (providerContext: FtrProviderContext) { @@ -162,8 +170,11 @@ export default function (providerContext: FtrProviderContext) { const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const logger = getService('log'); + const retry = getService('retry'); + const PageObjects = getPageObjects(['common', 'discoverLogExplorer']); const supertest = getService('supertest'); + const browser = getService('browser'); const uninstallPackage = ({ name, version }: IntegrationPackage) => { return supertest.delete(`/api/fleet/epm/packages/${name}/${version}`).set('kbn-xsrf', 'xxxx'); @@ -184,6 +195,7 @@ export default function (providerContext: FtrProviderContext) { ); logger.info(`Installing ${initialPackages.length} integration packages.`); await Promise.all(initialPackages.map(installPackage)); + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); }); after('clean up archives', async () => { @@ -195,5 +207,137 @@ export default function (providerContext: FtrProviderContext) { logger.info(`Uninstalling ${initialPackages.length} integration packages.`); await Promise.all(initialPackages.map(uninstallPackage)); }); + + describe('when open on the first navigation level', () => { + beforeEach(async () => { + await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.discoverLogExplorer.clearSearchField(); + }); + + afterEach(async () => { + await PageObjects.discoverLogExplorer.clearSearchField(); + await PageObjects.discoverLogExplorer.closeDatasetSelector(); + }); + + it('should always display the all log datasets entry as first item', async () => { + const allLogDatasetButton = await PageObjects.discoverLogExplorer.getAllLogDatasetsButton(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + const allLogDatasetTitle = await allLogDatasetButton.getVisibleText(); + const firstEntryTitle = await menuEntries[0].getVisibleText(); + + expect(allLogDatasetTitle).to.be('All log datasets'); + expect(allLogDatasetTitle).to.be(firstEntryTitle); + }); + + it('should always display the unmanaged datasets entry as second item', async () => { + const unamanagedDatasetButton = + await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + const unmanagedDatasetTitle = await unamanagedDatasetButton.getVisibleText(); + const secondEntryTitle = await menuEntries[1].getVisibleText(); + + expect(unmanagedDatasetTitle).to.be('Uncategorized'); + expect(unmanagedDatasetTitle).to.be(secondEntryTitle); + }); + + it('should display a list of installed integrations', async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + + expect(integrations.length).to.be(3); + expect(integrations).to.eql(initialPackagesTexts); + }); + + it('should sort the integrations list by the clicked sorting option', async () => { + // Test ascending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql(initialPackagesTexts); + }); + + // Test descending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('desc'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql(initialPackagesTexts.slice().reverse()); + }); + + // Test back ascending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql(initialPackagesTexts); + }); + }); + + it('should filter the integrations list by the typed integration name', async () => { + await PageObjects.discoverLogExplorer.typeSearchFieldWith('system'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql([initialPackageMap.system]); + }); + + await PageObjects.discoverLogExplorer.typeSearchFieldWith('a'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql([initialPackageMap.apache, initialPackageMap.aws]); + }); + }); + + it('should display an empty prompt when the search does not match any result', async () => { + await PageObjects.discoverLogExplorer.typeSearchFieldWith('no result search text'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations.length).to.be(0); + }); + + await PageObjects.discoverLogExplorer.assertNoIntegrationsPromptExists(); + }); + }); + + // describe('when click on an integration and moves into the second navigation level', () => {}); + + describe('when open/close the selector', () => { + it('should remember the latest navigation panel and restore it', async () => { + await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.discoverLogExplorer.clearSearchField(); + + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + await nodes[0].click(); + }); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); + + await PageObjects.discoverLogExplorer.closeDatasetSelector(); + await PageObjects.discoverLogExplorer.openDatasetSelector(); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); + }); + }); }); } diff --git a/x-pack/test/functional/page_objects/discover_log_explorer.ts b/x-pack/test/functional/page_objects/discover_log_explorer.ts index 15c2dc8fbcc4e..cf47d17fe8e37 100644 --- a/x-pack/test/functional/page_objects/discover_log_explorer.ts +++ b/x-pack/test/functional/page_objects/discover_log_explorer.ts @@ -12,8 +12,28 @@ export function DiscoverLogExplorerPageObject({ getService }: FtrProviderContext const toasts = getService('toasts'); return { - async getDatasetSelectorButton() { - return testSubjects.find('dataset-selector-popover-button'); + getDatasetSelector() { + return testSubjects.find('datasetSelectorPopover'); + }, + + getDatasetSelectorButton() { + return testSubjects.find('datasetSelectorPopoverButton'); + }, + + getDatasetSelectorContent() { + return testSubjects.find('datasetSelectorContent'); + }, + + getDatasetSelectorSearchControls() { + return testSubjects.find('datasetSelectorSearchControls'); + }, + + getDatasetSelectorContextMenu() { + return testSubjects.find('datasetSelectorContextMenu'); + }, + + getDatasetSelectorContextMenuPanelTitle() { + return testSubjects.find('contextMenuPanelTitleButton'); }, async getDatasetSelectorButtonText() { @@ -21,11 +41,83 @@ export function DiscoverLogExplorerPageObject({ getService }: FtrProviderContext return button.getVisibleText(); }, + async getCurrentPanelEntries() { + const contextMenu = await this.getDatasetSelectorContextMenu(); + return contextMenu.findAllByTagName('button'); + }, + + getAllLogDatasetsButton() { + return testSubjects.find('allLogDatasets'); + }, + + getUnmanagedDatasetsButton() { + return testSubjects.find('unmanagedDatasets'); + }, + + async getIntegrations() { + const content = await this.getDatasetSelectorContent(); + + const nodes = await content.findAllByCssSelector('[data-test-subj*="integration-"]'); + const integrations = await Promise.all(nodes.map((node) => node.getVisibleText())); + + return { + nodes, + integrations, + }; + }, + + async openDatasetSelector() { + const button = await this.getDatasetSelectorButton(); + return button.click(); + }, + + async closeDatasetSelector() { + const button = await this.getDatasetSelectorButton(); + const content = await this.getDatasetSelectorContent(); + + if (await content.isDisplayed()) return button.click(); + }, + + async clickSortButtonBy(direction: 'asc' | 'desc') { + const titleMap = { + asc: 'Ascending', + desc: 'Descending', + }; + const searchControlsContainer = await this.getDatasetSelectorSearchControls(); + const sortingButton = await searchControlsContainer.findByCssSelector( + `[title=${titleMap[direction]}]` + ); + + return sortingButton.click(); + }, + + async typeSearchFieldWith(name: string) { + const searchControlsContainer = await this.getDatasetSelectorSearchControls(); + const searchField = await searchControlsContainer.findByCssSelector('input[type=search]'); + + await searchField.clearValueWithKeyboard(); + return searchField.type(name); + }, + + async clearSearchField() { + const searchControlsContainer = await this.getDatasetSelectorSearchControls(); + const searchField = await searchControlsContainer.findByCssSelector('input[type=search]'); + + return searchField.clearValueWithKeyboard(); + }, + async assertRestoreFailureToastExist() { const successToast = await toasts.getToastElement(1); expect(await successToast.getVisibleText()).to.contain( "We couldn't restore your datasets selection" ); }, + + async assertNoIntegrationsPromptExists() { + const integrationStatus = await testSubjects.find('integrationStatusItem'); + const promptTitle = await integrationStatus.findByTagName('h2'); + + expect(await promptTitle.getVisibleText()).to.be('No integrations found'); + }, }; } From a54c79b43d4c69b05bf1b1351f1953d9f9b72a23 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Mon, 7 Aug 2023 13:47:08 +0200 Subject: [PATCH 06/23] test(discover-log-explorer): add load more test --- .../sub_components/datasets_list.tsx | 1 + .../discover_log_explorer/dataset_selector.ts | 281 ++++++++++++------ .../page_objects/discover_log_explorer.ts | 11 +- 3 files changed, 192 insertions(+), 101 deletions(-) diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_list.tsx b/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_list.tsx index 9decd3732fda4..bda629607fc39 100644 --- a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_list.tsx +++ b/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_list.tsx @@ -70,6 +70,7 @@ export const DatasetsList = ({ if (isEmpty) { return ( {noDatasetsLabel}} diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts index 126416964d985..c1ccc2342becb 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -188,154 +188,237 @@ export default function (providerContext: FtrProviderContext) { }; describe('Dataset Selector', () => { - before('initialize tests', async () => { - await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); - await esArchiver.load( - 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' - ); - logger.info(`Installing ${initialPackages.length} integration packages.`); - await Promise.all(initialPackages.map(installPackage)); - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); - }); - - after('clean up archives', async () => { - await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); - await esArchiver.unload( - 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' - ); - - logger.info(`Uninstalling ${initialPackages.length} integration packages.`); - await Promise.all(initialPackages.map(uninstallPackage)); - }); + describe('without installed integrations or uncategorized data streams', () => { + before(async () => { + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + }); - describe('when open on the first navigation level', () => { beforeEach(async () => { await PageObjects.discoverLogExplorer.openDatasetSelector(); - await PageObjects.discoverLogExplorer.clearSearchField(); }); afterEach(async () => { - await PageObjects.discoverLogExplorer.clearSearchField(); await PageObjects.discoverLogExplorer.closeDatasetSelector(); }); - it('should always display the all log datasets entry as first item', async () => { - const allLogDatasetButton = await PageObjects.discoverLogExplorer.getAllLogDatasetsButton(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + describe('when open on the first navigation level', () => { + it('should always display the all log datasets entry as first item', async () => { + const allLogDatasetButton = + await PageObjects.discoverLogExplorer.getAllLogDatasetsButton(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + const allLogDatasetTitle = await allLogDatasetButton.getVisibleText(); + const firstEntryTitle = await menuEntries[0].getVisibleText(); - const allLogDatasetTitle = await allLogDatasetButton.getVisibleText(); - const firstEntryTitle = await menuEntries[0].getVisibleText(); + expect(allLogDatasetTitle).to.be('All log datasets'); + expect(allLogDatasetTitle).to.be(firstEntryTitle); + }); - expect(allLogDatasetTitle).to.be('All log datasets'); - expect(allLogDatasetTitle).to.be(firstEntryTitle); + it('should always display the unmanaged datasets entry as second item', async () => { + const unamanagedDatasetButton = + await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + const unmanagedDatasetTitle = await unamanagedDatasetButton.getVisibleText(); + const secondEntryTitle = await menuEntries[1].getVisibleText(); + + expect(unmanagedDatasetTitle).to.be('Uncategorized'); + expect(unmanagedDatasetTitle).to.be(secondEntryTitle); + }); + + it('should display an empty prompt for no integrations', async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations.length).to.be(0); + + await PageObjects.discoverLogExplorer.assertNoIntegrationsPromptExists(); + }); }); - it('should always display the unmanaged datasets entry as second item', async () => { - const unamanagedDatasetButton = - await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + describe('when navigating into Uncategorized data streams', () => { + it('should display an empty prompt for no data streams', async () => { + const unamanagedDatasetButton = + await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await unamanagedDatasetButton.click(); + + const unamanagedDatasetEntries = + await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(unamanagedDatasetEntries.length).to.be(0); - const unmanagedDatasetTitle = await unamanagedDatasetButton.getVisibleText(); - const secondEntryTitle = await menuEntries[1].getVisibleText(); + await PageObjects.discoverLogExplorer.assertNoDataStreamsPromptExists(); + }); + }); + }); - expect(unmanagedDatasetTitle).to.be('Uncategorized'); - expect(unmanagedDatasetTitle).to.be(secondEntryTitle); + describe('with installed integrations and uncategorized data streams', () => { + before(async () => { + await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); + await esArchiver.load( + 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + ); + logger.info(`Installing ${initialPackages.length} integration packages.`); + await Promise.all(initialPackages.map(installPackage)); + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); }); - it('should display a list of installed integrations', async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + after(async () => { + await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); + await esArchiver.unload( + 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + ); - expect(integrations.length).to.be(3); - expect(integrations).to.eql(initialPackagesTexts); + logger.info(`Uninstalling ${initialPackages.length} integration packages.`); + await Promise.all(initialPackages.map(uninstallPackage)); }); - it('should sort the integrations list by the clicked sorting option', async () => { - // Test ascending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + describe('when open on the first navigation level', () => { + beforeEach(async () => { + await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.discoverLogExplorer.clearSearchField(); + }); - await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); - expect(integrations).to.eql(initialPackagesTexts); + afterEach(async () => { + await PageObjects.discoverLogExplorer.clearSearchField(); + await PageObjects.discoverLogExplorer.closeDatasetSelector(); }); - // Test descending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('desc'); + it('should always display the all log datasets entry as first item', async () => { + const allLogDatasetButton = + await PageObjects.discoverLogExplorer.getAllLogDatasetsButton(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); - await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); - expect(integrations).to.eql(initialPackagesTexts.slice().reverse()); + const allLogDatasetTitle = await allLogDatasetButton.getVisibleText(); + const firstEntryTitle = await menuEntries[0].getVisibleText(); + + expect(allLogDatasetTitle).to.be('All log datasets'); + expect(allLogDatasetTitle).to.be(firstEntryTitle); }); - // Test back ascending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + it('should always display the unmanaged datasets entry as second item', async () => { + const unamanagedDatasetButton = + await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + const unmanagedDatasetTitle = await unamanagedDatasetButton.getVisibleText(); + const secondEntryTitle = await menuEntries[1].getVisibleText(); + + expect(unmanagedDatasetTitle).to.be('Uncategorized'); + expect(unmanagedDatasetTitle).to.be(secondEntryTitle); + }); - await retry.try(async () => { + it('should display a list of installed integrations', async () => { const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + + expect(integrations.length).to.be(3); expect(integrations).to.eql(initialPackagesTexts); }); - }); - it('should filter the integrations list by the typed integration name', async () => { - await PageObjects.discoverLogExplorer.typeSearchFieldWith('system'); + it('should sort the integrations list by the clicked sorting option', async () => { + // Test ascending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); - await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); - expect(integrations).to.eql([initialPackageMap.system]); + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql(initialPackagesTexts); + }); + + // Test descending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('desc'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql(initialPackagesTexts.slice().reverse()); + }); + + // Test back ascending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql(initialPackagesTexts); + }); }); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('a'); + it('should filter the integrations list by the typed integration name', async () => { + await PageObjects.discoverLogExplorer.typeSearchFieldWith('system'); - await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); - expect(integrations).to.eql([initialPackageMap.apache, initialPackageMap.aws]); + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql([initialPackageMap.system]); + }); + + await PageObjects.discoverLogExplorer.typeSearchFieldWith('a'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql([initialPackageMap.apache, initialPackageMap.aws]); + }); }); - }); - it('should display an empty prompt when the search does not match any result', async () => { - await PageObjects.discoverLogExplorer.typeSearchFieldWith('no result search text'); + it('should display an empty prompt when the search does not match any result', async () => { + await PageObjects.discoverLogExplorer.typeSearchFieldWith('no result search text'); - await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); - expect(integrations.length).to.be(0); + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations.length).to.be(0); + }); + + await PageObjects.discoverLogExplorer.assertNoIntegrationsPromptExists(); }); - await PageObjects.discoverLogExplorer.assertNoIntegrationsPromptExists(); - }); - }); + it('should load more integrations scrolling to the end of the list', async () => { + // Install more integrations and reload the page + logger.info(`Installing ${additionalPackages.length} integration packages.`); + await Promise.all(additionalPackages.map(installPackage)); + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); - // describe('when click on an integration and moves into the second navigation level', () => {}); + await PageObjects.discoverLogExplorer.openDatasetSelector(); - describe('when open/close the selector', () => { - it('should remember the latest navigation panel and restore it', async () => { - await PageObjects.discoverLogExplorer.openDatasetSelector(); - await PageObjects.discoverLogExplorer.clearSearchField(); + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(nodes.length).to.be(15); + await nodes.at(-1)?.scrollIntoViewIfNecessary(); + }); - await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); - await nodes[0].click(); + logger.info(`Uninstalling ${additionalPackages.length} integration packages.`); + await Promise.all(additionalPackages.map(uninstallPackage)); }); + }); - await retry.try(async () => { - const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + // describe('when click on an integration and moves into the second navigation level', () => {}); - expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); - expect(await menuEntries[0].getVisibleText()).to.be('access'); - expect(await menuEntries[1].getVisibleText()).to.be('error'); - }); + describe('when open/close the selector', () => { + it('should restore the latest navigation panel', async () => { + await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.discoverLogExplorer.clearSearchField(); - await PageObjects.discoverLogExplorer.closeDatasetSelector(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + await nodes[0].click(); + }); - await retry.try(async () => { - const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); + + await PageObjects.discoverLogExplorer.closeDatasetSelector(); + await PageObjects.discoverLogExplorer.openDatasetSelector(); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); - expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); - expect(await menuEntries[0].getVisibleText()).to.be('access'); - expect(await menuEntries[1].getVisibleText()).to.be('error'); + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); }); }); }); diff --git a/x-pack/test/functional/page_objects/discover_log_explorer.ts b/x-pack/test/functional/page_objects/discover_log_explorer.ts index cf47d17fe8e37..fe2cf4001f410 100644 --- a/x-pack/test/functional/page_objects/discover_log_explorer.ts +++ b/x-pack/test/functional/page_objects/discover_log_explorer.ts @@ -43,7 +43,7 @@ export function DiscoverLogExplorerPageObject({ getService }: FtrProviderContext async getCurrentPanelEntries() { const contextMenu = await this.getDatasetSelectorContextMenu(); - return contextMenu.findAllByTagName('button'); + return contextMenu.findAllByClassName('euiContextMenuItem', 2000); }, getAllLogDatasetsButton() { @@ -57,7 +57,7 @@ export function DiscoverLogExplorerPageObject({ getService }: FtrProviderContext async getIntegrations() { const content = await this.getDatasetSelectorContent(); - const nodes = await content.findAllByCssSelector('[data-test-subj*="integration-"]'); + const nodes = await content.findAllByCssSelector('[data-test-subj*="integration-"]', 2000); const integrations = await Promise.all(nodes.map((node) => node.getVisibleText())); return { @@ -119,5 +119,12 @@ export function DiscoverLogExplorerPageObject({ getService }: FtrProviderContext expect(await promptTitle.getVisibleText()).to.be('No integrations found'); }, + + async assertNoDataStreamsPromptExists() { + const integrationStatus = await testSubjects.find('emptyDatasetPrompt'); + const promptTitle = await integrationStatus.findByTagName('h2'); + + expect(await promptTitle.getVisibleText()).to.be('No data streams found'); + }, }; } From 0652fc13efb408fdabd4ef75a7ca56d1defbf392 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Mon, 7 Aug 2023 14:46:04 +0200 Subject: [PATCH 07/23] test(discover-log-explorer): update tests --- .../discover_log_explorer/customization.ts | 6 +++--- .../discover_log_explorer/dataset_selector.ts | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/x-pack/test/functional/apps/discover_log_explorer/customization.ts b/x-pack/test/functional/apps/discover_log_explorer/customization.ts index 67aa838e5b86f..df6ac8eeb8780 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/customization.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/customization.ts @@ -25,11 +25,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('DatasetSelector should replace the DataViewPicker', async () => { // Assert does not render on discover app await PageObjects.common.navigateToApp('discover'); - await testSubjects.missingOrFail('dataset-selector-popover'); + await testSubjects.missingOrFail('datasetSelectorPopover'); // Assert it renders on log-explorer profile await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); - await testSubjects.existOrFail('dataset-selector-popover'); + await testSubjects.existOrFail('datasetSelectorPopover'); }); it('the TopNav bar should hide New, Open and Save options', async () => { @@ -67,7 +67,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // Assert it renders on log-explorer profile await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); - await testSubjects.existOrFail('datasetFiltersCustomization'); + await testSubjects.existOrFail('datasetFiltersCustomization', { allowHidden: true }); }); }); }); diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts index c1ccc2342becb..024aab8e9b229 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -171,10 +171,8 @@ export default function (providerContext: FtrProviderContext) { const kibanaServer = getService('kibanaServer'); const logger = getService('log'); const retry = getService('retry'); - const PageObjects = getPageObjects(['common', 'discoverLogExplorer']); - const supertest = getService('supertest'); - const browser = getService('browser'); + const PageObjects = getPageObjects(['common', 'discoverLogExplorer']); const uninstallPackage = ({ name, version }: IntegrationPackage) => { return supertest.delete(`/api/fleet/epm/packages/${name}/${version}`).set('kbn-xsrf', 'xxxx'); @@ -374,12 +372,26 @@ export default function (providerContext: FtrProviderContext) { await PageObjects.discoverLogExplorer.openDatasetSelector(); + // Initially fetched integrations await retry.try(async () => { const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); expect(nodes.length).to.be(15); await nodes.at(-1)?.scrollIntoViewIfNecessary(); }); + // Load more integrations + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(nodes.length).to.be(28); + await nodes.at(-1)?.scrollIntoViewIfNecessary(); + }); + + // No other integrations to load after scrolling to last integration + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(nodes.length).to.be(28); + }); + logger.info(`Uninstalling ${additionalPackages.length} integration packages.`); await Promise.all(additionalPackages.map(uninstallPackage)); }); From fd9866699ba1f13abc936aacb2da54d71e4afebf Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Tue, 8 Aug 2023 14:51:28 +0200 Subject: [PATCH 08/23] test(discover-log-explorer): update tests load more --- .../discover_log_explorer/dataset_selector.ts | 71 +++---------------- 1 file changed, 8 insertions(+), 63 deletions(-) diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts index 024aab8e9b229..0d1fc0fc029ab 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -33,18 +33,10 @@ const packages: IntegrationPackage[] = [ name: 'activemq', version: '0.13.0', }, - { - name: 'airflow', - version: '0.2.0', - }, { name: 'akamai', version: '2.14.0', }, - { - name: 'apache_spark', - version: '0.6.0', - }, { name: 'apache_tomcat', version: '0.12.1', @@ -53,10 +45,6 @@ const packages: IntegrationPackage[] = [ name: 'apm', version: '8.10.0-preview-1689351101', }, - { - name: 'arista_ngfw', - version: '0.2.0', - }, { name: 'atlassian_bitbucket', version: '1.14.0', @@ -85,10 +73,6 @@ const packages: IntegrationPackage[] = [ name: 'aws_logs', version: '0.5.0', }, - { - name: 'awsfargate', - version: '0.3.0', - }, { name: 'azure', version: '1.5.28', @@ -97,14 +81,6 @@ const packages: IntegrationPackage[] = [ name: 'azure_app_service', version: '0.0.1', }, - { - name: 'azure_application_insights', - version: '1.0.6', - }, - { - name: 'azure_billing', - version: '1.1.3', - }, { name: 'azure_blob_storage', version: '0.5.0', @@ -117,42 +93,6 @@ const packages: IntegrationPackage[] = [ name: 'azure_functions', version: '0.0.1', }, - { - name: 'azure_metrics', - version: '1.0.17', - }, - { - name: 'barracuda', - version: '1.5.0', - }, - { - name: 'barracuda_cloudgen_firewall', - version: '1.5.0', - }, - { - name: 'beat', - version: '0.1.3', - }, - { - name: 'bitdefender', - version: '1.2.0', - }, - { - name: 'bitwarden', - version: '1.2.0', - }, - { - name: 'bluecoat', - version: '0.17.0', - }, - { - name: 'box_events', - version: '1.7.0', - }, - { - name: 'carbon_black_cloud', - version: '1.13.0', - }, ]; const initialPackages = packages.slice(0, 3); @@ -167,6 +107,7 @@ const additionalPackages = packages.slice(3); export default function (providerContext: FtrProviderContext) { const { getService, getPageObjects } = providerContext; + const browser = getService('browser'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); const logger = getService('log'); @@ -368,7 +309,7 @@ export default function (providerContext: FtrProviderContext) { // Install more integrations and reload the page logger.info(`Installing ${additionalPackages.length} integration packages.`); await Promise.all(additionalPackages.map(installPackage)); - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await browser.refresh(); await PageObjects.discoverLogExplorer.openDatasetSelector(); @@ -382,14 +323,14 @@ export default function (providerContext: FtrProviderContext) { // Load more integrations await retry.try(async () => { const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); - expect(nodes.length).to.be(28); + expect(nodes.length).to.be(20); await nodes.at(-1)?.scrollIntoViewIfNecessary(); }); // No other integrations to load after scrolling to last integration await retry.try(async () => { const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); - expect(nodes.length).to.be(28); + expect(nodes.length).to.be(20); }); logger.info(`Uninstalling ${additionalPackages.length} integration packages.`); @@ -400,6 +341,10 @@ export default function (providerContext: FtrProviderContext) { // describe('when click on an integration and moves into the second navigation level', () => {}); describe('when open/close the selector', () => { + before(async () => { + await browser.refresh(); + }); + it('should restore the latest navigation panel', async () => { await PageObjects.discoverLogExplorer.openDatasetSelector(); await PageObjects.discoverLogExplorer.clearSearchField(); From 9c609c9d31ae3f9a8983e290ba1bdd94bff673cd Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Tue, 8 Aug 2023 20:24:05 +0200 Subject: [PATCH 09/23] test(discover-log-explorer): implement network utilities --- .../from_the_browser/loaded_kibana.ts | 2 +- test/functional/services/common/browser.ts | 86 ++++++++++++++++++- .../sub_components/datasets_list.tsx | 1 + .../sub_components/datasets_skeleton.tsx | 2 +- .../discover_log_explorer/dataset_selector.ts | 57 +++++++++++- .../page_objects/discover_log_explorer.ts | 11 +++ 6 files changed, 151 insertions(+), 8 deletions(-) diff --git a/test/analytics/tests/instrumented_events/from_the_browser/loaded_kibana.ts b/test/analytics/tests/instrumented_events/from_the_browser/loaded_kibana.ts index e4ac2346b5893..02e1e7656bf78 100644 --- a/test/analytics/tests/instrumented_events/from_the_browser/loaded_kibana.ts +++ b/test/analytics/tests/instrumented_events/from_the_browser/loaded_kibana.ts @@ -62,7 +62,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(event.properties.value4).to.be.a('number'); expect(event.properties.value5).to.be.a('number'); - if (browser.isChromium) { + if (browser.isChromium()) { // Kibana Loaded memory expect(meta).to.have.property('jsHeapSizeLimit'); expect(meta.jsHeapSizeLimit).to.be.a('number'); diff --git a/test/functional/services/common/browser.ts b/test/functional/services/common/browser.ts index 393f093d54189..2b95a8a01c5fe 100644 --- a/test/functional/services/common/browser.ts +++ b/test/functional/services/common/browser.ts @@ -9,6 +9,7 @@ import { setTimeout as setTimeoutAsync } from 'timers/promises'; import { cloneDeepWith } from 'lodash'; import { Key, Origin, WebDriver } from 'selenium-webdriver'; +import { Driver as ChromiumWebDriver } from 'selenium-webdriver/chrome'; import { modifyUrl } from '@kbn/std'; import sharp from 'sharp'; @@ -16,6 +17,7 @@ import { NoSuchSessionError } from 'selenium-webdriver/lib/error'; import { WebElementWrapper } from '../lib/web_element_wrapper'; import { FtrProviderContext, FtrService } from '../../ftr_provider_context'; import { Browsers } from '../remote/browsers'; +import { NETWORK_PROFILES } from '../remote/network_profiles'; export type Browser = BrowserService; @@ -25,19 +27,20 @@ class BrowserService extends FtrService { */ public readonly keys = Key; public readonly isFirefox: boolean; - public readonly isChromium: boolean; private readonly log = this.ctx.getService('log'); constructor( ctx: FtrProviderContext, public readonly browserType: string, - private readonly driver: WebDriver + protected readonly driver: WebDriver | ChromiumWebDriver ) { super(ctx); this.isFirefox = this.browserType === Browsers.Firefox; - this.isChromium = - this.browserType === Browsers.Chrome || this.browserType === Browsers.ChromiumEdge; + } + + public isChromium(): this is { driver: ChromiumWebDriver } { + return this.driver instanceof ChromiumWebDriver; } /** @@ -661,6 +664,81 @@ class BrowserService extends FtrService { } } } + + /** + * Get the network simulation for chromium browsers if available. + * https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/chrome_exports_Driver.html#getNetworkConditions + * + * @return {Promise} + */ + public async getNetworkConditions() { + if (this.isChromium()) { + return this.driver.getNetworkConditions(); + } else { + const message = + 'WebDriver does not support the .getNetworkConditions method.\nProbably the browser in used is not chromium based.'; + this.log.error(message); + throw new Error(message); + } + } + + /** + * Delete the network simulation for chromium browsers if available. + * + * @return {Promise} + */ + public async restoreNetworkConditions() { + if (this.isChromium()) { + this.log.debug('Restore network conditions simulation.'); + return this.setNetworkConditions({}); + } else { + const message = + 'WebDriver does not support the .deleteNetworkConditions method.\nProbably the browser in used is not chromium based.'; + this.log.error(message); + throw new Error(message); + } + } + + /** + * Set the network conditions for chromium browsers if available. + * + * __Sample Usage:__ + * + * driver.setNetworkConditions({ + * offline: false, + * latency: 5, // Additional latency (ms). + * download_throughput: 500 * 1024, // Maximal aggregated download throughput. + * upload_throughput: 500 * 1024 // Maximal aggregated upload throughput. + * }); + * + * https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/chrome_exports_Driver.html#setNetworkConditions + * + * @return {Promise} + */ + public async setNetworkConditions(specs: object) { + const { + DOWNLOAD: downloadThroughput, + UPLOAD: uploadThroughput, + LATENCY: latency, + } = NETWORK_PROFILES.CLOUD_USER; + + const defaultSpecs = { + offline: false, + latency, + download_throughput: downloadThroughput, + upload_throughput: uploadThroughput, + }; + + if (this.isChromium()) { + this.log.debug('Set network conditions simulation.'); + return this.driver.setNetworkConditions({ ...defaultSpecs, ...specs }); + } else { + const message = + 'WebDriver does not support the .setNetworkCondition method.\nProbably the browser in used is not chromium based.'; + this.log.error(message); + throw new Error(message); + } + } } export async function BrowserProvider(ctx: FtrProviderContext) { diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_list.tsx b/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_list.tsx index bda629607fc39..134bd7616ac8a 100644 --- a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_list.tsx +++ b/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_list.tsx @@ -44,6 +44,7 @@ export const DatasetsList = ({ if (hasError) { return ( ( - + ); diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts index 0d1fc0fc029ab..7cf9f954fdf2b 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -133,6 +133,7 @@ export default function (providerContext: FtrProviderContext) { }); beforeEach(async () => { + await browser.refresh(); await PageObjects.discoverLogExplorer.openDatasetSelector(); }); @@ -173,7 +174,49 @@ export default function (providerContext: FtrProviderContext) { }); }); - describe('when navigating into Uncategorized data streams', () => { + describe.only('when navigating into Uncategorized data streams', () => { + it('should display a loading skeleton while loading', async function () { + // Skip the test in case network condition utils are not available + try { + await browser.setNetworkConditions({ download_throughput: 1024 }); // Almost stuck network conditions + const unamanagedDatasetButton = + await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await unamanagedDatasetButton.click(); + + await PageObjects.discoverLogExplorer.assertLoadingSkeletonExists(); + + await browser.restoreNetworkConditions(); + } catch (error) { + console.log(error); + this.skip(); + } + }); + + it('should display an error prompt if could not retrieve the data streams', async function () { + // Skip the test in case network condition utils are not available + try { + const unamanagedDatasetButton = + await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await unamanagedDatasetButton.click(); + + await retry.try(async () => { + await PageObjects.discoverLogExplorer.assertNoDataStreamsPromptExists(); + }); + + await browser.setNetworkConditions({ offline: true }); + await PageObjects.discoverLogExplorer.typeSearchFieldWith('a'); + + await retry.try(async () => { + await PageObjects.discoverLogExplorer.assertNoDataStreamsErrorExists(); + }); + + await browser.restoreNetworkConditions(); + } catch (error) { + console.log(error); + this.skip(); + } + }); + it('should display an empty prompt for no data streams', async () => { const unamanagedDatasetButton = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); @@ -338,7 +381,17 @@ export default function (providerContext: FtrProviderContext) { }); }); - // describe('when click on an integration and moves into the second navigation level', () => {}); + describe('when click on an integration and moves into the second navigation level', () => {}); + + // describe('when navigating into Uncategorized data streams', () => { + // beforeEach(async () => { + // await PageObjects.discoverLogExplorer.openDatasetSelector(); + // }); + + // afterEach(async () => { + // await PageObjects.discoverLogExplorer.closeDatasetSelector(); + // }); + // }); describe('when open/close the selector', () => { before(async () => { diff --git a/x-pack/test/functional/page_objects/discover_log_explorer.ts b/x-pack/test/functional/page_objects/discover_log_explorer.ts index fe2cf4001f410..d3a4324fdf27e 100644 --- a/x-pack/test/functional/page_objects/discover_log_explorer.ts +++ b/x-pack/test/functional/page_objects/discover_log_explorer.ts @@ -113,6 +113,10 @@ export function DiscoverLogExplorerPageObject({ getService }: FtrProviderContext ); }, + assertLoadingSkeletonExists() { + return testSubjects.existOrFail('datasetSelectorSkeleton'); + }, + async assertNoIntegrationsPromptExists() { const integrationStatus = await testSubjects.find('integrationStatusItem'); const promptTitle = await integrationStatus.findByTagName('h2'); @@ -126,5 +130,12 @@ export function DiscoverLogExplorerPageObject({ getService }: FtrProviderContext expect(await promptTitle.getVisibleText()).to.be('No data streams found'); }, + + async assertNoDataStreamsErrorExists() { + const integrationStatus = await testSubjects.find('datasetErrorPrompt'); + const promptTitle = await integrationStatus.findByTagName('h2'); + + expect(await promptTitle.getVisibleText()).to.be('No data streams found'); + }, }; } From 852f4f4ed8736f646071253f430c176ca0c7901f Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Wed, 9 Aug 2023 11:19:08 +0200 Subject: [PATCH 10/23] test(discover-log-explorer): implement Network profiles --- test/functional/services/common/browser.ts | 51 +++++++------------ .../services/remote/network_profiles.ts | 45 +++++++++++++--- test/functional/services/remote/webdriver.ts | 24 +++------ .../discover_log_explorer/dataset_selector.ts | 8 ++- 4 files changed, 68 insertions(+), 60 deletions(-) diff --git a/test/functional/services/common/browser.ts b/test/functional/services/common/browser.ts index 2b95a8a01c5fe..f02af6827de01 100644 --- a/test/functional/services/common/browser.ts +++ b/test/functional/services/common/browser.ts @@ -7,7 +7,7 @@ */ import { setTimeout as setTimeoutAsync } from 'timers/promises'; -import { cloneDeepWith } from 'lodash'; +import { cloneDeepWith, isString } from 'lodash'; import { Key, Origin, WebDriver } from 'selenium-webdriver'; import { Driver as ChromiumWebDriver } from 'selenium-webdriver/chrome'; import { modifyUrl } from '@kbn/std'; @@ -17,7 +17,7 @@ import { NoSuchSessionError } from 'selenium-webdriver/lib/error'; import { WebElementWrapper } from '../lib/web_element_wrapper'; import { FtrProviderContext, FtrService } from '../../ftr_provider_context'; import { Browsers } from '../remote/browsers'; -import { NETWORK_PROFILES } from '../remote/network_profiles'; +import { NetworkOptions, NetworkProfile, NETWORK_PROFILES } from '../remote/network_profiles'; export type Browser = BrowserService; @@ -673,7 +673,7 @@ class BrowserService extends FtrService { */ public async getNetworkConditions() { if (this.isChromium()) { - return this.driver.getNetworkConditions(); + return this.driver.getNetworkConditions().catch(() => undefined); // Return undefined instead of throwing if no conditions are set. } else { const message = 'WebDriver does not support the .getNetworkConditions method.\nProbably the browser in used is not chromium based.'; @@ -688,15 +688,8 @@ class BrowserService extends FtrService { * @return {Promise} */ public async restoreNetworkConditions() { - if (this.isChromium()) { - this.log.debug('Restore network conditions simulation.'); - return this.setNetworkConditions({}); - } else { - const message = - 'WebDriver does not support the .deleteNetworkConditions method.\nProbably the browser in used is not chromium based.'; - this.log.error(message); - throw new Error(message); - } + this.log.debug('Restore network conditions simulation.'); + return this.setNetworkConditions('NO_THROTTLING'); } /** @@ -704,34 +697,28 @@ class BrowserService extends FtrService { * * __Sample Usage:__ * - * driver.setNetworkConditions({ - * offline: false, - * latency: 5, // Additional latency (ms). - * download_throughput: 500 * 1024, // Maximal aggregated download throughput. - * upload_throughput: 500 * 1024 // Maximal aggregated upload throughput. + * browser.setNetworkConditions('FAST_3G') + * browser.setNetworkConditions('SLOW_3G') + * browser.setNetworkConditions('OFFLINE') + * browser.setNetworkConditions({ + * offline: false, + * latency: 5, // Additional latency (ms). + * download_throughput: 500 * 1024, // Maximal aggregated download throughput. + * upload_throughput: 500 * 1024, // Maximal aggregated upload throughput. * }); * * https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/chrome_exports_Driver.html#setNetworkConditions * * @return {Promise} */ - public async setNetworkConditions(specs: object) { - const { - DOWNLOAD: downloadThroughput, - UPLOAD: uploadThroughput, - LATENCY: latency, - } = NETWORK_PROFILES.CLOUD_USER; - - const defaultSpecs = { - offline: false, - latency, - download_throughput: downloadThroughput, - upload_throughput: uploadThroughput, - }; + public async setNetworkConditions(profileOrOptions: NetworkProfile | NetworkOptions) { + const networkOptions = isString(profileOrOptions) + ? NETWORK_PROFILES[profileOrOptions] + : profileOrOptions; if (this.isChromium()) { - this.log.debug('Set network conditions simulation.'); - return this.driver.setNetworkConditions({ ...defaultSpecs, ...specs }); + this.log.debug(`Set network conditions with profile "${profileOrOptions}".`); + return this.driver.setNetworkConditions(networkOptions); } else { const message = 'WebDriver does not support the .setNetworkCondition method.\nProbably the browser in used is not chromium based.'; diff --git a/test/functional/services/remote/network_profiles.ts b/test/functional/services/remote/network_profiles.ts index cb4076686270c..29e4a0feeaace 100644 --- a/test/functional/services/remote/network_profiles.ts +++ b/test/functional/services/remote/network_profiles.ts @@ -6,10 +6,13 @@ * Side Public License, v 1. */ -interface NetworkOptions { - DOWNLOAD: number; - UPLOAD: number; - LATENCY: number; +export type NetworkProfile = 'NO_THROTTLING' | 'FAST_3G' | 'SLOW_3G' | 'OFFLINE' | 'CLOUD_USER'; + +export interface NetworkOptions { + offline: boolean; + latency: number; + download_throughput: number; + upload_throughput: number; } const sec = 10 ** 3; @@ -17,6 +20,36 @@ const MBps = 10 ** 6 / 8; // megabyte per second (MB/s) (can be abbreviated as M // Selenium uses B/s (bytes) for network throttling // Download (B/s) Upload (B/s) Latency (ms) -export const NETWORK_PROFILES: { [key: string]: NetworkOptions } = { - CLOUD_USER: { DOWNLOAD: 6 * MBps, UPLOAD: 6 * MBps, LATENCY: 0.1 * sec }, + +export const NETWORK_PROFILES: Record = { + NO_THROTTLING: { + offline: false, + latency: 0, + download_throughput: -1, + upload_throughput: -1, + }, + FAST_3G: { + offline: false, + latency: 0.56 * sec, + download_throughput: 1.44 * MBps, + upload_throughput: 0.7 * MBps, + }, + SLOW_3G: { + offline: false, + latency: 2 * sec, + download_throughput: 0.4 * MBps, + upload_throughput: 0.4 * MBps, + }, + OFFLINE: { + offline: true, + latency: 0, + download_throughput: 0, + upload_throughput: 0, + }, + CLOUD_USER: { + offline: false, + latency: 0.1 * sec, + download_throughput: 6 * MBps, + upload_throughput: 6 * MBps, + }, }; diff --git a/test/functional/services/remote/webdriver.ts b/test/functional/services/remote/webdriver.ts index 1486d02656d12..702f674b3c10d 100644 --- a/test/functional/services/remote/webdriver.ts +++ b/test/functional/services/remote/webdriver.ts @@ -30,7 +30,7 @@ import { createStdoutSocket } from './create_stdout_stream'; import { preventParallelCalls } from './prevent_parallel_calls'; import { Browsers } from './browsers'; -import { NETWORK_PROFILES } from './network_profiles'; +import { NetworkProfile, NETWORK_PROFILES } from './network_profiles'; const throttleOption: string = process.env.TEST_THROTTLE_NETWORK as string; const headlessBrowser: string = process.env.TEST_BROWSER_HEADLESS as string; @@ -300,22 +300,17 @@ async function attemptToCreateCommand( const { session, consoleLog$ } = await buildDriverInstance(); if (throttleOption === '1' && browserType === 'chrome') { - const { KBN_NETWORK_TEST_PROFILE = 'CLOUD_USER' } = process.env; + const KBN_NETWORK_TEST_PROFILE = (process.env.KBN_NETWORK_TEST_PROFILE ?? + 'CLOUD_USER') as NetworkProfile; const profile = - KBN_NETWORK_TEST_PROFILE in Object.keys(NETWORK_PROFILES) - ? KBN_NETWORK_TEST_PROFILE - : 'CLOUD_USER'; + KBN_NETWORK_TEST_PROFILE in NETWORK_PROFILES ? KBN_NETWORK_TEST_PROFILE : 'CLOUD_USER'; - const { - DOWNLOAD: downloadThroughput, - UPLOAD: uploadThroughput, - LATENCY: latency, - } = NETWORK_PROFILES[`${profile}`]; + const networkProfileOptions = NETWORK_PROFILES[profile]; // Only chrome supports this option. log.debug( - `NETWORK THROTTLED with profile ${profile}: ${downloadThroughput} B/s down, ${uploadThroughput} B/s up, ${latency} ms latency.` + `NETWORK THROTTLED with profile ${profile}: ${networkProfileOptions.download_throughput} B/s down, ${networkProfileOptions.upload_throughput} B/s up, ${networkProfileOptions.latency} ms latency.` ); if (noCache) { @@ -326,12 +321,7 @@ async function attemptToCreateCommand( } // @ts-expect-error - session.setNetworkConditions({ - offline: false, - latency, - download_throughput: downloadThroughput, - upload_throughput: uploadThroughput, - }); + session.setNetworkConditions(networkProfileOptions); } if (attemptId !== attemptCounter) { diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts index 7cf9f954fdf2b..49588a402aee8 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -174,11 +174,11 @@ export default function (providerContext: FtrProviderContext) { }); }); - describe.only('when navigating into Uncategorized data streams', () => { + describe('when navigating into Uncategorized data streams', () => { it('should display a loading skeleton while loading', async function () { // Skip the test in case network condition utils are not available try { - await browser.setNetworkConditions({ download_throughput: 1024 }); // Almost stuck network conditions + await browser.setNetworkConditions('SLOW_3G'); // Almost stuck network conditions const unamanagedDatasetButton = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); await unamanagedDatasetButton.click(); @@ -187,7 +187,6 @@ export default function (providerContext: FtrProviderContext) { await browser.restoreNetworkConditions(); } catch (error) { - console.log(error); this.skip(); } }); @@ -203,7 +202,7 @@ export default function (providerContext: FtrProviderContext) { await PageObjects.discoverLogExplorer.assertNoDataStreamsPromptExists(); }); - await browser.setNetworkConditions({ offline: true }); + await browser.setNetworkConditions('OFFLINE'); await PageObjects.discoverLogExplorer.typeSearchFieldWith('a'); await retry.try(async () => { @@ -212,7 +211,6 @@ export default function (providerContext: FtrProviderContext) { await browser.restoreNetworkConditions(); } catch (error) { - console.log(error); this.skip(); } }); From bcabdab4e945663d8a93abe941c0728483294e00 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Wed, 9 Aug 2023 12:25:02 +0200 Subject: [PATCH 11/23] test(discover-log-explorer): copy customization tests to serverless --- .../discover_log_explorer/customization.ts | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.ts b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.ts index 579f4e4b8f5c5..e4780b49575cd 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.ts @@ -8,7 +8,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const kibanaServer = getService('kibanaServer'); - const PageObjects = getPageObjects(['common']); + const PageObjects = getPageObjects(['common', 'navigationalSearch']); const testSubjects = getService('testSubjects'); describe('Customizations', () => { @@ -24,11 +24,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('DatasetSelector should replace the DataViewPicker', async () => { // Assert does not render on discover app await PageObjects.common.navigateToApp('discover'); - await testSubjects.missingOrFail('dataset-selector-popover'); + await testSubjects.missingOrFail('datasetSelectorPopover'); // Assert it renders on log-explorer profile await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); - await testSubjects.existOrFail('dataset-selector-popover'); + await testSubjects.existOrFail('datasetSelectorPopover'); }); it('the TopNav bar should hide New, Open and Save options', async () => { @@ -50,6 +50,24 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.existOrFail('openInspectorButton'); await testSubjects.missingOrFail('discoverSaveButton'); }); + + it('should add a searchable deep link to the profile page', async () => { + await PageObjects.common.navigateToApp('home'); + await PageObjects.navigationalSearch.searchFor('discover log explorer'); + + const results = await PageObjects.navigationalSearch.getDisplayedResults(); + expect(results[0].label).to.eql('Discover / Logs Explorer'); + }); + + it('should render a filter controls section as part of the unified search bar', async () => { + // Assert does not render on discover app + await PageObjects.common.navigateToApp('discover'); + await testSubjects.missingOrFail('datasetFiltersCustomization'); + + // Assert it renders on log-explorer profile + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await testSubjects.existOrFail('datasetFiltersCustomization', { allowHidden: true }); + }); }); }); } From 5b29f5d3d38c4e15c04f1e17084f03959dc75d9f Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Wed, 9 Aug 2023 14:37:06 +0200 Subject: [PATCH 12/23] test(discover-log-explorer): add test for dataset selection --- .../integrations_list_status.tsx | 1 + .../discover_log_explorer/dataset_selector.ts | 240 +++++++++++++++++- .../page_objects/discover_log_explorer.ts | 18 +- .../discover_log_explorer/customization.ts | 8 - 4 files changed, 255 insertions(+), 12 deletions(-) diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/integrations_list_status.tsx b/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/integrations_list_status.tsx index 418ccbefffd00..42ff78fdd3e83 100644 --- a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/integrations_list_status.tsx +++ b/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/integrations_list_status.tsx @@ -34,6 +34,7 @@ export const IntegrationsListStatus = ({ if (hasError) { return ( { + await PageObjects.discoverLogExplorer.assertNoIntegrationsPromptExists(); + }); + + await PageObjects.common.sleep(5000); + await browser.setNetworkConditions('OFFLINE'); + await PageObjects.discoverLogExplorer.typeSearchFieldWith('a'); + + await retry.try(async () => { + await PageObjects.discoverLogExplorer.assertNoIntegrationsErrorExists(); + }); + + await browser.restoreNetworkConditions(); + } catch (error) { + this.skip(); + } + }); + it('should display an empty prompt for no integrations', async () => { const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); expect(integrations.length).to.be(0); @@ -258,7 +279,6 @@ export default function (providerContext: FtrProviderContext) { }); afterEach(async () => { - await PageObjects.discoverLogExplorer.clearSearchField(); await PageObjects.discoverLogExplorer.closeDatasetSelector(); }); @@ -379,7 +399,136 @@ export default function (providerContext: FtrProviderContext) { }); }); - describe('when click on an integration and moves into the second navigation level', () => {}); + describe.only('when click on an integration and moves into the second navigation level', () => { + before(async () => { + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + }); + + beforeEach(async () => { + await browser.refresh(); + await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.discoverLogExplorer.clearSearchField(); + }); + + afterEach(async () => { + await PageObjects.discoverLogExplorer.closeDatasetSelector(); + }); + + it('should display a list of available datasets', async () => { + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + await nodes[0].click(); + }); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); + }); + + it('should sort the datasets list by the clicked sorting option', async () => { + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + await nodes[0].click(); + }); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + }); + + // Test ascending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); + + // Test descending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('desc'); + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be('error'); + expect(await menuEntries[1].getVisibleText()).to.be('access'); + }); + + // Test back ascending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); + }); + + it('should filter the datasets list by the typed dataset name', async () => { + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + await nodes[0].click(); + }); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + }); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); + + await PageObjects.discoverLogExplorer.typeSearchFieldWith('err'); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(menuEntries.length).to.be(1); + expect(await menuEntries[0].getVisibleText()).to.be('error'); + }); + }); + + it('should update the current selection with the clicked dataset', async () => { + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + await nodes[0].click(); + }); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + }); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be('access'); + menuEntries[0].click(); + }); + + await retry.try(async () => { + const selectorButton = await PageObjects.discoverLogExplorer.getDatasetSelectorButton(); + + expect(await selectorButton.getVisibleText()).to.be('[Apache HTTP Server] access'); + }); + }); + }); // describe('when navigating into Uncategorized data streams', () => { // beforeEach(async () => { @@ -393,6 +542,10 @@ export default function (providerContext: FtrProviderContext) { describe('when open/close the selector', () => { before(async () => { + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + }); + + beforeEach(async () => { await browser.refresh(); }); @@ -428,6 +581,89 @@ export default function (providerContext: FtrProviderContext) { expect(await menuEntries[1].getVisibleText()).to.be('error'); }); }); + + it('should restore the latest search results', async () => { + await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.discoverLogExplorer.clearSearchField(); + + await PageObjects.discoverLogExplorer.typeSearchFieldWith('system'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql([initialPackageMap.system]); + }); + + await PageObjects.discoverLogExplorer.closeDatasetSelector(); + await PageObjects.discoverLogExplorer.openDatasetSelector(); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql([initialPackageMap.system]); + }); + }); + }); + + describe('when switching between integration panels', () => { + before(async () => { + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + }); + + it('should remember the latest search and restore its results for each integration', async () => { + await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.discoverLogExplorer.clearSearchField(); + + await PageObjects.discoverLogExplorer.typeSearchFieldWith('apache'); + + await retry.try(async () => { + const { nodes, integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql([initialPackageMap.apache]); + nodes[0].click(); + }); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); + + await PageObjects.discoverLogExplorer.typeSearchFieldWith('err'); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(menuEntries.length).to.be(1); + expect(await menuEntries[0].getVisibleText()).to.be('error'); + }); + + // Navigate back to integrations + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + panelTitleNode.click(); + + await retry.try(async () => { + const { nodes, integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql([initialPackageMap.apache]); + + const searchValue = await PageObjects.discoverLogExplorer.getSearchFieldValue(); + expect(searchValue).to.eql('apache'); + + nodes[0].click(); + }); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + const searchValue = await PageObjects.discoverLogExplorer.getSearchFieldValue(); + expect(searchValue).to.eql('err'); + + expect(menuEntries.length).to.be(1); + expect(await menuEntries[0].getVisibleText()).to.be('error'); + }); + }); }); }); }); diff --git a/x-pack/test/functional/page_objects/discover_log_explorer.ts b/x-pack/test/functional/page_objects/discover_log_explorer.ts index d3a4324fdf27e..fe6e6582b3740 100644 --- a/x-pack/test/functional/page_objects/discover_log_explorer.ts +++ b/x-pack/test/functional/page_objects/discover_log_explorer.ts @@ -73,9 +73,9 @@ export function DiscoverLogExplorerPageObject({ getService }: FtrProviderContext async closeDatasetSelector() { const button = await this.getDatasetSelectorButton(); - const content = await this.getDatasetSelectorContent(); + const isOpen = await testSubjects.exists('datasetSelectorContent'); - if (await content.isDisplayed()) return button.click(); + if (isOpen) return button.click(); }, async clickSortButtonBy(direction: 'asc' | 'desc') { @@ -91,6 +91,13 @@ export function DiscoverLogExplorerPageObject({ getService }: FtrProviderContext return sortingButton.click(); }, + async getSearchFieldValue() { + const searchControlsContainer = await this.getDatasetSelectorSearchControls(); + const searchField = await searchControlsContainer.findByCssSelector('input[type=search]'); + + return searchField.getAttribute('value'); + }, + async typeSearchFieldWith(name: string) { const searchControlsContainer = await this.getDatasetSelectorSearchControls(); const searchField = await searchControlsContainer.findByCssSelector('input[type=search]'); @@ -124,6 +131,13 @@ export function DiscoverLogExplorerPageObject({ getService }: FtrProviderContext expect(await promptTitle.getVisibleText()).to.be('No integrations found'); }, + async assertNoIntegrationsErrorExists() { + const integrationStatus = await testSubjects.find('integrationsErrorPrompt'); + const promptTitle = await integrationStatus.findByTagName('h2'); + + expect(await promptTitle.getVisibleText()).to.be('No integrations found'); + }, + async assertNoDataStreamsPromptExists() { const integrationStatus = await testSubjects.find('emptyDatasetPrompt'); const promptTitle = await integrationStatus.findByTagName('h2'); diff --git a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.ts b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.ts index e4780b49575cd..08f687b4e0199 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.ts @@ -51,14 +51,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.missingOrFail('discoverSaveButton'); }); - it('should add a searchable deep link to the profile page', async () => { - await PageObjects.common.navigateToApp('home'); - await PageObjects.navigationalSearch.searchFor('discover log explorer'); - - const results = await PageObjects.navigationalSearch.getDisplayedResults(); - expect(results[0].label).to.eql('Discover / Logs Explorer'); - }); - it('should render a filter controls section as part of the unified search bar', async () => { // Assert does not render on discover app await PageObjects.common.navigateToApp('discover'); From 5fbe9538b8cc581fb27ad2141e74c736ce1a5b3a Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Wed, 9 Aug 2023 14:50:19 +0200 Subject: [PATCH 13/23] test(discover-log-explorer): remove only --- .../functional/apps/discover_log_explorer/dataset_selector.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts index c8cfe7ceee399..8255ec0c9a403 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -399,7 +399,7 @@ export default function (providerContext: FtrProviderContext) { }); }); - describe.only('when click on an integration and moves into the second navigation level', () => { + describe('when click on an integration and moves into the second navigation level', () => { before(async () => { await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); }); From 4fc6616f8c843f68b27088c435369811975eba28 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Wed, 9 Aug 2023 16:41:14 +0200 Subject: [PATCH 14/23] test(discover-log-explorer): add uncategorized test --- .../discover_log_explorer/dataset_selector.ts | 130 +++++++++++++++++- 1 file changed, 129 insertions(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts index 8255ec0c9a403..6703e4ea37cd4 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -105,6 +105,8 @@ const initialPackagesTexts = Object.values(initialPackageMap); const additionalPackages = packages.slice(3); +const expectedUncategorized = ['logs-gaming-*', 'logs-manufacturing-*', 'logs-retail-*']; + export default function (providerContext: FtrProviderContext) { const { getService, getPageObjects } = providerContext; const browser = getService('browser'); @@ -530,7 +532,133 @@ export default function (providerContext: FtrProviderContext) { }); }); - // describe('when navigating into Uncategorized data streams', () => { + describe('when navigating into Uncategorized data streams', () => { + before(async () => { + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + }); + + beforeEach(async () => { + await browser.refresh(); + await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.discoverLogExplorer.clearSearchField(); + }); + + afterEach(async () => { + await PageObjects.discoverLogExplorer.closeDatasetSelector(); + }); + + it('should display a list of available datasets', async () => { + const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await button.click(); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); + expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); + expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); + expect(await menuEntries[2].getVisibleText()).to.be(expectedUncategorized[2]); + }); + }); + + it('should sort the datasets list by the clicked sorting option', async () => { + const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await button.click(); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + + expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); + }); + + // Test ascending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); + expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); + expect(await menuEntries[2].getVisibleText()).to.be(expectedUncategorized[2]); + }); + + // Test descending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('desc'); + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[2]); + expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); + expect(await menuEntries[2].getVisibleText()).to.be(expectedUncategorized[0]); + }); + + // Test back ascending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); + expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); + expect(await menuEntries[2].getVisibleText()).to.be(expectedUncategorized[2]); + }); + }); + + it('should filter the datasets list by the typed dataset name', async () => { + const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await button.click(); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + + expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); + }); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); + expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); + expect(await menuEntries[2].getVisibleText()).to.be(expectedUncategorized[2]); + }); + + await PageObjects.discoverLogExplorer.typeSearchFieldWith('retail'); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(menuEntries.length).to.be(1); + expect(await menuEntries[0].getVisibleText()).to.be('logs-retail-*'); + }); + }); + + it('should update the current selection with the clicked dataset', async () => { + const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await button.click(); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + + expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); + }); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be('logs-gaming-*'); + menuEntries[0].click(); + }); + + await retry.try(async () => { + const selectorButton = await PageObjects.discoverLogExplorer.getDatasetSelectorButton(); + + expect(await selectorButton.getVisibleText()).to.be('logs-gaming-*'); + }); + }); + }); // beforeEach(async () => { // await PageObjects.discoverLogExplorer.openDatasetSelector(); // }); From 90714eb7568f4917cdc70a875a40d733b240fdd6 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Wed, 9 Aug 2023 18:04:44 +0200 Subject: [PATCH 15/23] test(discover-log-explorer): add columns tests --- .../columns_selection.ts | 147 ++++++++++++++++++ .../discover_log_explorer/dataset_selector.ts | 3 +- .../apps/discover_log_explorer/index.ts | 1 + 3 files changed, 149 insertions(+), 2 deletions(-) create mode 100644 x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts diff --git a/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts b/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts new file mode 100644 index 0000000000000..3462d52516c78 --- /dev/null +++ b/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts @@ -0,0 +1,147 @@ +/* + * 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 ({ getService, getPageObjects }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const kibanaServer = getService('kibanaServer'); + const retry = getService('retry'); + const PageObjects = getPageObjects([ + 'common', + 'discover', + 'discoverLogExplorer', + 'unifiedFieldList', + ]); + + const defaultLogColumns = ['@timestamp', 'message']; + + describe('Columns selection initialization and update', () => { + before(async () => { + await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); + await esArchiver.load( + 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + ); + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + }); + + after(async () => { + await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); + await esArchiver.unload( + 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + ); + }); + + describe('when the log explorer profile loads', () => { + it('should initialize the table columns to logs default selection', async () => { + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + + await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); + + await PageObjects.discover.waitForDocTableLoadingComplete(); + await retry.try(async () => { + expect(await PageObjects.discover.getColumnHeaders()).to.eql(defaultLogColumns); + }); + }); + + it('should restore the table columns from the url state if exists', async () => { + await PageObjects.common.navigateToApp('discover', { + hash: '/p/log-explorer?_a=(columns:!(message,data_stream.namespace))', + }); + + await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); + + await PageObjects.discover.waitForDocTableLoadingComplete(); + await retry.try(async () => { + expect(await PageObjects.discover.getColumnHeaders()).to.eql([ + ...defaultLogColumns, + 'data_stream.namespace', + ]); + }); + }); + }); + + describe('when switching dataset using the dataset selector', () => { + it('should set the table columns to logs default selection', async () => { + await PageObjects.common.navigateToApp('discover', { + hash: '/p/log-explorer', + }); + + await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); + + await PageObjects.discover.waitForDocTableLoadingComplete(); + await retry.try(async () => { + expect(await PageObjects.discover.getColumnHeaders()).to.eql(defaultLogColumns); + }); + + // Remove message column, it shows Document since nothing is selected + await PageObjects.unifiedFieldList.clickFieldListItemRemove('message'); + await PageObjects.discover.waitForDocTableLoadingComplete(); + await retry.try(async () => { + expect(await PageObjects.discover.getColumnHeaders()).to.eql(['@timestamp', 'Document']); + }); + + // Switch to other dataset and verify columns are restored + await PageObjects.discoverLogExplorer.openDatasetSelector(); + const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await button.click(); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + menuEntries[0].click(); + }); + + await PageObjects.discover.waitForDocTableLoadingComplete(); + await retry.try(async () => { + expect(await PageObjects.discover.getColumnHeaders()).to.eql(defaultLogColumns); + }); + }); + + it('should keep the current table columns selection if exists', async () => { + await PageObjects.common.navigateToApp('discover', { + hash: '/p/log-explorer', + }); + + await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); + + await PageObjects.discover.waitForDocTableLoadingComplete(); + await retry.try(async () => { + expect(await PageObjects.discover.getColumnHeaders()).to.eql(defaultLogColumns); + }); + + // Add new column + await PageObjects.unifiedFieldList.clickFieldListItemAdd('data_stream.namespace'); + + await PageObjects.discover.waitForDocTableLoadingComplete(); + await retry.try(async () => { + expect(await PageObjects.discover.getColumnHeaders()).to.eql([ + ...defaultLogColumns, + 'data_stream.namespace', + ]); + }); + + await PageObjects.discoverLogExplorer.openDatasetSelector(); + const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await button.click(); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + menuEntries[0].click(); + }); + + await PageObjects.discover.waitForDocTableLoadingComplete(); + + await retry.try(async () => { + expect(await PageObjects.discover.getColumnHeaders()).to.eql([ + ...defaultLogColumns, + 'data_stream.namespace', + ]); + }); + }); + }); + }); +} diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts index 6703e4ea37cd4..8bdef035212e0 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -107,8 +107,7 @@ const additionalPackages = packages.slice(3); const expectedUncategorized = ['logs-gaming-*', 'logs-manufacturing-*', 'logs-retail-*']; -export default function (providerContext: FtrProviderContext) { - const { getService, getPageObjects } = providerContext; +export default function ({ getService, getPageObjects }: FtrProviderContext) { const browser = getService('browser'); const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); diff --git a/x-pack/test/functional/apps/discover_log_explorer/index.ts b/x-pack/test/functional/apps/discover_log_explorer/index.ts index eb0bbf1a0f488..dd8b99db79ad0 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/index.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/index.ts @@ -9,6 +9,7 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { describe('Discover Log-Explorer profile', function () { + loadTestFile(require.resolve('./columns_selection')); loadTestFile(require.resolve('./customization')); loadTestFile(require.resolve('./dataset_selection_state')); loadTestFile(require.resolve('./dataset_selector')); From 23e44623b4ad16b6cd9cb2cb597c31820257eb9c Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Wed, 9 Aug 2023 18:30:43 +0200 Subject: [PATCH 16/23] test(discover-log-explorer): update test --- .../discover_log_explorer/columns_selection.ts | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts b/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts index 3462d52516c78..6d599123fd4ee 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts @@ -42,7 +42,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); - await PageObjects.discover.waitForDocTableLoadingComplete(); await retry.try(async () => { expect(await PageObjects.discover.getColumnHeaders()).to.eql(defaultLogColumns); }); @@ -55,7 +54,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); - await PageObjects.discover.waitForDocTableLoadingComplete(); await retry.try(async () => { expect(await PageObjects.discover.getColumnHeaders()).to.eql([ ...defaultLogColumns, @@ -73,14 +71,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); - await PageObjects.discover.waitForDocTableLoadingComplete(); await retry.try(async () => { expect(await PageObjects.discover.getColumnHeaders()).to.eql(defaultLogColumns); }); // Remove message column, it shows Document since nothing is selected await PageObjects.unifiedFieldList.clickFieldListItemRemove('message'); - await PageObjects.discover.waitForDocTableLoadingComplete(); await retry.try(async () => { expect(await PageObjects.discover.getColumnHeaders()).to.eql(['@timestamp', 'Document']); }); @@ -95,7 +91,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { menuEntries[0].click(); }); - await PageObjects.discover.waitForDocTableLoadingComplete(); await retry.try(async () => { expect(await PageObjects.discover.getColumnHeaders()).to.eql(defaultLogColumns); }); @@ -103,20 +98,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should keep the current table columns selection if exists', async () => { await PageObjects.common.navigateToApp('discover', { - hash: '/p/log-explorer', + hash: '/p/log-explorer?_a=(columns:!(message,data_stream.namespace))', }); await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); - await PageObjects.discover.waitForDocTableLoadingComplete(); - await retry.try(async () => { - expect(await PageObjects.discover.getColumnHeaders()).to.eql(defaultLogColumns); - }); - - // Add new column - await PageObjects.unifiedFieldList.clickFieldListItemAdd('data_stream.namespace'); - - await PageObjects.discover.waitForDocTableLoadingComplete(); await retry.try(async () => { expect(await PageObjects.discover.getColumnHeaders()).to.eql([ ...defaultLogColumns, @@ -133,8 +119,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { menuEntries[0].click(); }); - await PageObjects.discover.waitForDocTableLoadingComplete(); - await retry.try(async () => { expect(await PageObjects.discover.getColumnHeaders()).to.eql([ ...defaultLogColumns, From 88579b06711c6152ecf8905c6dd135d4950b9898 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Wed, 9 Aug 2023 20:01:40 +0200 Subject: [PATCH 17/23] test(discover-log-explorer): update test descriptions --- .../apps/discover_log_explorer/columns_selection.ts | 6 +++--- .../apps/discover_log_explorer/customization.ts | 2 +- .../discover_log_explorer/dataset_selection_state.ts | 4 ++-- .../apps/discover_log_explorer/dataset_selector.ts | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts b/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts index 6d599123fd4ee..5cef510241f05 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts @@ -37,7 +37,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); describe('when the log explorer profile loads', () => { - it('should initialize the table columns to logs default selection', async () => { + it("should initialize the table columns to logs' default selection", async () => { await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); @@ -47,7 +47,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - it('should restore the table columns from the url state if exists', async () => { + it('should restore the table columns from the URL state if exists', async () => { await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer?_a=(columns:!(message,data_stream.namespace))', }); @@ -63,7 +63,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - describe('when switching dataset using the dataset selector', () => { + describe('when switching datasets using the dataset selector', () => { it('should set the table columns to logs default selection', async () => { await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer', diff --git a/x-pack/test/functional/apps/discover_log_explorer/customization.ts b/x-pack/test/functional/apps/discover_log_explorer/customization.ts index df6ac8eeb8780..6cd713a40f63a 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/customization.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/customization.ts @@ -32,7 +32,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.existOrFail('datasetSelectorPopover'); }); - it('the TopNav bar should hide New, Open and Save options', async () => { + it('the TopNav bar should hide then New, Open and Save options', async () => { // Assert does not render on discover app await PageObjects.common.navigateToApp('discover'); await testSubjects.existOrFail('discoverNewButton'); diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selection_state.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selection_state.ts index f795afb966493..c1c2b335358bc 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selection_state.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selection_state.ts @@ -23,7 +23,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - describe('when the "index" query param exist', () => { + describe('when the "index" query param exists', () => { it('should decode and restore the selection from a valid encoded index', async () => { const azureActivitylogsIndex = 'BQZwpgNmDGAuCWB7AdgLmAEwIay+W6yWAtmKgOQSIDmIAtFgF4CuATmAHRZzwBu8sAJ5VadAFTkANAlhRU3BPyEiQASklFS8lu2kC55AII6wAAgAyNEFN5hWIJGnIBGDgFYOAJgDM5deCgeFAAVQQAHMgdkaihVIA==='; @@ -37,7 +37,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(datasetSelectionTitle).to.be('[Azure Logs] activitylogs'); }); - it('should fallback to "All log datasets" selection and notify the user for an invalid encoded index', async () => { + it('should fallback to the "All log datasets" selection and notify the user of an invalid encoded index', async () => { const invalidEncodedIndex = 'invalid-encoded-index'; await PageObjects.common.navigateToApp('discover', { hash: `/p/log-explorer?_a=(index:${encodeURIComponent(invalidEncodedIndex)})`, diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts index 8bdef035212e0..cc362014dc588 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -143,7 +143,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); describe('when open on the first navigation level', () => { - it('should always display the all log datasets entry as first item', async () => { + it('should always display the "All log datasets" entry as the first item', async () => { const allLogDatasetButton = await PageObjects.discoverLogExplorer.getAllLogDatasetsButton(); const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); @@ -155,7 +155,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(allLogDatasetTitle).to.be(firstEntryTitle); }); - it('should always display the unmanaged datasets entry as second item', async () => { + it('should always display the unmanaged datasets entry as the second item', async () => { const unamanagedDatasetButton = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); @@ -283,7 +283,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.discoverLogExplorer.closeDatasetSelector(); }); - it('should always display the all log datasets entry as first item', async () => { + it('should always display the "All log datasets" entry as the first item', async () => { const allLogDatasetButton = await PageObjects.discoverLogExplorer.getAllLogDatasetsButton(); const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); @@ -295,7 +295,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(allLogDatasetTitle).to.be(firstEntryTitle); }); - it('should always display the unmanaged datasets entry as second item', async () => { + it('should always display the unmanaged datasets entry as the second item', async () => { const unamanagedDatasetButton = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); @@ -367,7 +367,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.discoverLogExplorer.assertNoIntegrationsPromptExists(); }); - it('should load more integrations scrolling to the end of the list', async () => { + it('should load more integrations by scrolling to the end of the list', async () => { // Install more integrations and reload the page logger.info(`Installing ${additionalPackages.length} integration packages.`); await Promise.all(additionalPackages.map(installPackage)); @@ -400,7 +400,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); - describe('when click on an integration and moves into the second navigation level', () => { + describe('when clicking on integration and moving into the second navigation level', () => { before(async () => { await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); }); From f824e4034d682dd37253d4c756381a2017bf1302 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Thu, 10 Aug 2023 11:08:58 +0200 Subject: [PATCH 18/23] test(discover-log-explorer): remove unnecessary imports --- .../columns_selection.ts | 4 --- .../discover_log_explorer/dataset_selector.ts | 34 ++++--------------- 2 files changed, 6 insertions(+), 32 deletions(-) diff --git a/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts b/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts index 5cef510241f05..3c72fabc0b4aa 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts @@ -9,7 +9,6 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); const retry = getService('retry'); const PageObjects = getPageObjects([ 'common', @@ -22,15 +21,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('Columns selection initialization and update', () => { before(async () => { - await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); await esArchiver.load( 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' ); - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); }); after(async () => { - await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); await esArchiver.unload( 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' ); diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts index cc362014dc588..50f1bf539b6ff 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -138,10 +138,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.discoverLogExplorer.openDatasetSelector(); }); - afterEach(async () => { - await PageObjects.discoverLogExplorer.closeDatasetSelector(); - }); - describe('when open on the first navigation level', () => { it('should always display the "All log datasets" entry as the first item', async () => { const allLogDatasetButton = @@ -254,17 +250,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('with installed integrations and uncategorized data streams', () => { before(async () => { - await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); await esArchiver.load( 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' ); logger.info(`Installing ${initialPackages.length} integration packages.`); await Promise.all(initialPackages.map(installPackage)); - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); }); after(async () => { - await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); await esArchiver.unload( 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' ); @@ -274,13 +267,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); describe('when open on the first navigation level', () => { - beforeEach(async () => { - await PageObjects.discoverLogExplorer.openDatasetSelector(); - await PageObjects.discoverLogExplorer.clearSearchField(); + before(async () => { + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); }); - afterEach(async () => { - await PageObjects.discoverLogExplorer.closeDatasetSelector(); + beforeEach(async () => { + await browser.refresh(); + await PageObjects.discoverLogExplorer.openDatasetSelector(); }); it('should always display the "All log datasets" entry as the first item', async () => { @@ -408,11 +401,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { beforeEach(async () => { await browser.refresh(); await PageObjects.discoverLogExplorer.openDatasetSelector(); - await PageObjects.discoverLogExplorer.clearSearchField(); - }); - - afterEach(async () => { - await PageObjects.discoverLogExplorer.closeDatasetSelector(); }); it('should display a list of available datasets', async () => { @@ -539,11 +527,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { beforeEach(async () => { await browser.refresh(); await PageObjects.discoverLogExplorer.openDatasetSelector(); - await PageObjects.discoverLogExplorer.clearSearchField(); - }); - - afterEach(async () => { - await PageObjects.discoverLogExplorer.closeDatasetSelector(); }); it('should display a list of available datasets', async () => { @@ -674,12 +657,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { beforeEach(async () => { await browser.refresh(); + await PageObjects.discoverLogExplorer.openDatasetSelector(); }); it('should restore the latest navigation panel', async () => { - await PageObjects.discoverLogExplorer.openDatasetSelector(); - await PageObjects.discoverLogExplorer.clearSearchField(); - await retry.try(async () => { const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); await nodes[0].click(); @@ -710,9 +691,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should restore the latest search results', async () => { - await PageObjects.discoverLogExplorer.openDatasetSelector(); - await PageObjects.discoverLogExplorer.clearSearchField(); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('system'); await retry.try(async () => { From 9d2be7880fb8cb6cb4da033eeb23420be4820f70 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Thu, 10 Aug 2023 11:24:02 +0200 Subject: [PATCH 19/23] fix(discover-log-explorer): fix popover alignment --- .../dataset_selector/sub_components/datasets_popover.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_popover.tsx b/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_popover.tsx index e98c7fe2d70e7..7428ffbd47612 100644 --- a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_popover.tsx +++ b/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_popover.tsx @@ -46,6 +46,7 @@ export const DatasetsPopover = ({ Date: Thu, 10 Aug 2023 13:01:16 +0200 Subject: [PATCH 20/23] fix(discover-log-explorer): update tests --- .../columns_selection.ts | 76 +- .../discover_log_explorer/dataset_selector.ts | 1 - .../columns_selection.ts | 57 ++ .../discover_log_explorer/dataset_selector.ts | 774 ++++++++++++++++++ .../discover_log_explorer/index.ts | 4 +- 5 files changed, 837 insertions(+), 75 deletions(-) create mode 100644 x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/columns_selection.ts create mode 100644 x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/dataset_selector.ts diff --git a/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts b/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts index 3c72fabc0b4aa..7946e60547055 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts @@ -7,17 +7,12 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; +const defaultLogColumns = ['@timestamp', 'message']; + export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const retry = getService('retry'); - const PageObjects = getPageObjects([ - 'common', - 'discover', - 'discoverLogExplorer', - 'unifiedFieldList', - ]); - - const defaultLogColumns = ['@timestamp', 'message']; + const PageObjects = getPageObjects(['common', 'discover', 'discoverLogExplorer']); describe('Columns selection initialization and update', () => { before(async () => { @@ -58,70 +53,5 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); }); - - describe('when switching datasets using the dataset selector', () => { - it('should set the table columns to logs default selection', async () => { - await PageObjects.common.navigateToApp('discover', { - hash: '/p/log-explorer', - }); - - await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); - - await retry.try(async () => { - expect(await PageObjects.discover.getColumnHeaders()).to.eql(defaultLogColumns); - }); - - // Remove message column, it shows Document since nothing is selected - await PageObjects.unifiedFieldList.clickFieldListItemRemove('message'); - await retry.try(async () => { - expect(await PageObjects.discover.getColumnHeaders()).to.eql(['@timestamp', 'Document']); - }); - - // Switch to other dataset and verify columns are restored - await PageObjects.discoverLogExplorer.openDatasetSelector(); - const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); - await button.click(); - - await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); - menuEntries[0].click(); - }); - - await retry.try(async () => { - expect(await PageObjects.discover.getColumnHeaders()).to.eql(defaultLogColumns); - }); - }); - - it('should keep the current table columns selection if exists', async () => { - await PageObjects.common.navigateToApp('discover', { - hash: '/p/log-explorer?_a=(columns:!(message,data_stream.namespace))', - }); - - await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); - - await retry.try(async () => { - expect(await PageObjects.discover.getColumnHeaders()).to.eql([ - ...defaultLogColumns, - 'data_stream.namespace', - ]); - }); - - await PageObjects.discoverLogExplorer.openDatasetSelector(); - const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); - await button.click(); - - await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); - menuEntries[0].click(); - }); - - await retry.try(async () => { - expect(await PageObjects.discover.getColumnHeaders()).to.eql([ - ...defaultLogColumns, - 'data_stream.namespace', - ]); - }); - }); - }); }); } diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts index 50f1bf539b6ff..0f41d7ad69b25 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -110,7 +110,6 @@ const expectedUncategorized = ['logs-gaming-*', 'logs-manufacturing-*', 'logs-re export default function ({ getService, getPageObjects }: FtrProviderContext) { const browser = getService('browser'); const esArchiver = getService('esArchiver'); - const kibanaServer = getService('kibanaServer'); const logger = getService('log'); const retry = getService('retry'); const supertest = getService('supertest'); diff --git a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/columns_selection.ts b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/columns_selection.ts new file mode 100644 index 0000000000000..62d453ba3a595 --- /dev/null +++ b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/columns_selection.ts @@ -0,0 +1,57 @@ +/* + * 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'; + +const defaultLogColumns = ['@timestamp', 'message']; + +export default function ({ getService, getPageObjects }: FtrProviderContext) { + const esArchiver = getService('esArchiver'); + const retry = getService('retry'); + const PageObjects = getPageObjects(['common', 'discover', 'discoverLogExplorer']); + + describe('Columns selection initialization and update', () => { + before(async () => { + await esArchiver.load( + 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + ); + }); + + after(async () => { + await esArchiver.unload( + 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + ); + }); + + describe('when the log explorer profile loads', () => { + it("should initialize the table columns to logs' default selection", async () => { + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + + await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); + + await retry.try(async () => { + expect(await PageObjects.discover.getColumnHeaders()).to.eql(defaultLogColumns); + }); + }); + + it('should restore the table columns from the URL state if exists', async () => { + await PageObjects.common.navigateToApp('discover', { + hash: '/p/log-explorer?_a=(columns:!(message,data_stream.namespace))', + }); + + await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); + + await retry.try(async () => { + expect(await PageObjects.discover.getColumnHeaders()).to.eql([ + ...defaultLogColumns, + 'data_stream.namespace', + ]); + }); + }); + }); + }); +} diff --git a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/dataset_selector.ts b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/dataset_selector.ts new file mode 100644 index 0000000000000..5113cd76571c8 --- /dev/null +++ b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/dataset_selector.ts @@ -0,0 +1,774 @@ +/* + * 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'; + +interface IntegrationPackage { + name: string; + version: string; +} + +const packages: IntegrationPackage[] = [ + { + name: 'apache', + version: '1.14.0', + }, + { + name: 'aws', + version: '1.51.0', + }, + { + name: 'system', + version: '1.38.1', + }, + { + name: '1password', + version: '1.18.0', + }, + { + name: 'activemq', + version: '0.13.0', + }, + { + name: 'akamai', + version: '2.14.0', + }, + { + name: 'apache_tomcat', + version: '0.12.1', + }, + { + name: 'apm', + version: '8.10.0-preview-1689351101', + }, + { + name: 'atlassian_bitbucket', + version: '1.14.0', + }, + { + name: 'atlassian_confluence', + version: '1.15.0', + }, + { + name: 'atlassian_jira', + version: '1.15.0', + }, + { + name: 'auditd', + version: '3.12.0', + }, + { + name: 'auditd_manager', + version: '1.12.0', + }, + { + name: 'auth0', + version: '1.10.0', + }, + { + name: 'aws_logs', + version: '0.5.0', + }, + { + name: 'azure', + version: '1.5.28', + }, + { + name: 'azure_app_service', + version: '0.0.1', + }, + { + name: 'azure_blob_storage', + version: '0.5.0', + }, + { + name: 'azure_frontdoor', + version: '1.1.0', + }, + { + name: 'azure_functions', + version: '0.0.1', + }, +]; + +const initialPackages = packages.slice(0, 3); +const initialPackageMap = { + apache: 'Apache HTTP Server', + aws: 'AWS', + system: 'System', +}; +const initialPackagesTexts = Object.values(initialPackageMap); + +const additionalPackages = packages.slice(3); + +const expectedUncategorized = ['logs-gaming-*', 'logs-manufacturing-*', 'logs-retail-*']; + +export default function ({ getService, getPageObjects }: FtrProviderContext) { + const browser = getService('browser'); + const esArchiver = getService('esArchiver'); + const logger = getService('log'); + const retry = getService('retry'); + const supertest = getService('supertest'); + const PageObjects = getPageObjects(['common', 'discoverLogExplorer']); + + const uninstallPackage = ({ name, version }: IntegrationPackage) => { + return supertest.delete(`/api/fleet/epm/packages/${name}/${version}`).set('kbn-xsrf', 'xxxx'); + }; + + const installPackage = ({ name, version }: IntegrationPackage) => { + return supertest + .post(`/api/fleet/epm/packages/${name}/${version}`) + .set('kbn-xsrf', 'xxxx') + .send({ force: true }); + }; + + describe('Dataset Selector', () => { + describe('without installed integrations or uncategorized data streams', () => { + before(async () => { + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + }); + + beforeEach(async () => { + await browser.refresh(); + await PageObjects.discoverLogExplorer.openDatasetSelector(); + }); + + describe('when open on the first navigation level', () => { + it('should always display the "All log datasets" entry as the first item', async () => { + const allLogDatasetButton = + await PageObjects.discoverLogExplorer.getAllLogDatasetsButton(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + const allLogDatasetTitle = await allLogDatasetButton.getVisibleText(); + const firstEntryTitle = await menuEntries[0].getVisibleText(); + + expect(allLogDatasetTitle).to.be('All log datasets'); + expect(allLogDatasetTitle).to.be(firstEntryTitle); + }); + + it('should always display the unmanaged datasets entry as the second item', async () => { + const unamanagedDatasetButton = + await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + const unmanagedDatasetTitle = await unamanagedDatasetButton.getVisibleText(); + const secondEntryTitle = await menuEntries[1].getVisibleText(); + + expect(unmanagedDatasetTitle).to.be('Uncategorized'); + expect(unmanagedDatasetTitle).to.be(secondEntryTitle); + }); + + it('should display an error prompt if could not retrieve the integrations', async function () { + // Skip the test in case network condition utils are not available + try { + await retry.try(async () => { + await PageObjects.discoverLogExplorer.assertNoIntegrationsPromptExists(); + }); + + await PageObjects.common.sleep(5000); + await browser.setNetworkConditions('OFFLINE'); + await PageObjects.discoverLogExplorer.typeSearchFieldWith('a'); + + await retry.try(async () => { + await PageObjects.discoverLogExplorer.assertNoIntegrationsErrorExists(); + }); + + await browser.restoreNetworkConditions(); + } catch (error) { + this.skip(); + } + }); + + it('should display an empty prompt for no integrations', async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations.length).to.be(0); + + await PageObjects.discoverLogExplorer.assertNoIntegrationsPromptExists(); + }); + }); + + describe('when navigating into Uncategorized data streams', () => { + it('should display a loading skeleton while loading', async function () { + // Skip the test in case network condition utils are not available + try { + await browser.setNetworkConditions('SLOW_3G'); // Almost stuck network conditions + const unamanagedDatasetButton = + await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await unamanagedDatasetButton.click(); + + await PageObjects.discoverLogExplorer.assertLoadingSkeletonExists(); + + await browser.restoreNetworkConditions(); + } catch (error) { + this.skip(); + } + }); + + it('should display an error prompt if could not retrieve the data streams', async function () { + // Skip the test in case network condition utils are not available + try { + const unamanagedDatasetButton = + await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await unamanagedDatasetButton.click(); + + await retry.try(async () => { + await PageObjects.discoverLogExplorer.assertNoDataStreamsPromptExists(); + }); + + await browser.setNetworkConditions('OFFLINE'); + await PageObjects.discoverLogExplorer.typeSearchFieldWith('a'); + + await retry.try(async () => { + await PageObjects.discoverLogExplorer.assertNoDataStreamsErrorExists(); + }); + + await browser.restoreNetworkConditions(); + } catch (error) { + this.skip(); + } + }); + + it('should display an empty prompt for no data streams', async () => { + const unamanagedDatasetButton = + await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await unamanagedDatasetButton.click(); + + const unamanagedDatasetEntries = + await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(unamanagedDatasetEntries.length).to.be(0); + + await PageObjects.discoverLogExplorer.assertNoDataStreamsPromptExists(); + }); + }); + }); + + describe('with installed integrations and uncategorized data streams', () => { + before(async () => { + await esArchiver.load( + 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + ); + logger.info(`Installing ${initialPackages.length} integration packages.`); + await Promise.all(initialPackages.map(installPackage)); + }); + + after(async () => { + await esArchiver.unload( + 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + ); + + logger.info(`Uninstalling ${initialPackages.length} integration packages.`); + await Promise.all(initialPackages.map(uninstallPackage)); + }); + + describe('when open on the first navigation level', () => { + before(async () => { + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + }); + + beforeEach(async () => { + await browser.refresh(); + await PageObjects.discoverLogExplorer.openDatasetSelector(); + }); + + it('should always display the "All log datasets" entry as the first item', async () => { + const allLogDatasetButton = + await PageObjects.discoverLogExplorer.getAllLogDatasetsButton(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + const allLogDatasetTitle = await allLogDatasetButton.getVisibleText(); + const firstEntryTitle = await menuEntries[0].getVisibleText(); + + expect(allLogDatasetTitle).to.be('All log datasets'); + expect(allLogDatasetTitle).to.be(firstEntryTitle); + }); + + it('should always display the unmanaged datasets entry as the second item', async () => { + const unamanagedDatasetButton = + await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + const unmanagedDatasetTitle = await unamanagedDatasetButton.getVisibleText(); + const secondEntryTitle = await menuEntries[1].getVisibleText(); + + expect(unmanagedDatasetTitle).to.be('Uncategorized'); + expect(unmanagedDatasetTitle).to.be(secondEntryTitle); + }); + + it('should display a list of installed integrations', async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + + expect(integrations.length).to.be(3); + expect(integrations).to.eql(initialPackagesTexts); + }); + + it('should sort the integrations list by the clicked sorting option', async () => { + // Test ascending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql(initialPackagesTexts); + }); + + // Test descending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('desc'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql(initialPackagesTexts.slice().reverse()); + }); + + // Test back ascending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql(initialPackagesTexts); + }); + }); + + it('should filter the integrations list by the typed integration name', async () => { + await PageObjects.discoverLogExplorer.typeSearchFieldWith('system'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql([initialPackageMap.system]); + }); + + await PageObjects.discoverLogExplorer.typeSearchFieldWith('a'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql([initialPackageMap.apache, initialPackageMap.aws]); + }); + }); + + it('should display an empty prompt when the search does not match any result', async () => { + await PageObjects.discoverLogExplorer.typeSearchFieldWith('no result search text'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations.length).to.be(0); + }); + + await PageObjects.discoverLogExplorer.assertNoIntegrationsPromptExists(); + }); + + it('should load more integrations by scrolling to the end of the list', async () => { + // Install more integrations and reload the page + logger.info(`Installing ${additionalPackages.length} integration packages.`); + await Promise.all(additionalPackages.map(installPackage)); + await browser.refresh(); + + await PageObjects.discoverLogExplorer.openDatasetSelector(); + + // Initially fetched integrations + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(nodes.length).to.be(15); + await nodes.at(-1)?.scrollIntoViewIfNecessary(); + }); + + // Load more integrations + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(nodes.length).to.be(20); + await nodes.at(-1)?.scrollIntoViewIfNecessary(); + }); + + // No other integrations to load after scrolling to last integration + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(nodes.length).to.be(20); + }); + + logger.info(`Uninstalling ${additionalPackages.length} integration packages.`); + await Promise.all(additionalPackages.map(uninstallPackage)); + }); + }); + + describe('when clicking on integration and moving into the second navigation level', () => { + before(async () => { + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + }); + + beforeEach(async () => { + await browser.refresh(); + await PageObjects.discoverLogExplorer.openDatasetSelector(); + }); + + it('should display a list of available datasets', async () => { + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + await nodes[0].click(); + }); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); + }); + + it('should sort the datasets list by the clicked sorting option', async () => { + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + await nodes[0].click(); + }); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + }); + + // Test ascending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); + + // Test descending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('desc'); + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be('error'); + expect(await menuEntries[1].getVisibleText()).to.be('access'); + }); + + // Test back ascending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); + }); + + it('should filter the datasets list by the typed dataset name', async () => { + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + await nodes[0].click(); + }); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + }); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); + + await PageObjects.discoverLogExplorer.typeSearchFieldWith('err'); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(menuEntries.length).to.be(1); + expect(await menuEntries[0].getVisibleText()).to.be('error'); + }); + }); + + it('should update the current selection with the clicked dataset', async () => { + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + await nodes[0].click(); + }); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + }); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be('access'); + menuEntries[0].click(); + }); + + await retry.try(async () => { + const selectorButton = await PageObjects.discoverLogExplorer.getDatasetSelectorButton(); + + expect(await selectorButton.getVisibleText()).to.be('[Apache HTTP Server] access'); + }); + }); + }); + + describe('when navigating into Uncategorized data streams', () => { + before(async () => { + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + }); + + beforeEach(async () => { + await browser.refresh(); + await PageObjects.discoverLogExplorer.openDatasetSelector(); + }); + + it('should display a list of available datasets', async () => { + const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await button.click(); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); + expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); + expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); + expect(await menuEntries[2].getVisibleText()).to.be(expectedUncategorized[2]); + }); + }); + + it('should sort the datasets list by the clicked sorting option', async () => { + const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await button.click(); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + + expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); + }); + + // Test ascending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); + expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); + expect(await menuEntries[2].getVisibleText()).to.be(expectedUncategorized[2]); + }); + + // Test descending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('desc'); + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[2]); + expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); + expect(await menuEntries[2].getVisibleText()).to.be(expectedUncategorized[0]); + }); + + // Test back ascending order + await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); + expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); + expect(await menuEntries[2].getVisibleText()).to.be(expectedUncategorized[2]); + }); + }); + + it('should filter the datasets list by the typed dataset name', async () => { + const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await button.click(); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + + expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); + }); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); + expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); + expect(await menuEntries[2].getVisibleText()).to.be(expectedUncategorized[2]); + }); + + await PageObjects.discoverLogExplorer.typeSearchFieldWith('retail'); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(menuEntries.length).to.be(1); + expect(await menuEntries[0].getVisibleText()).to.be('logs-retail-*'); + }); + }); + + it('should update the current selection with the clicked dataset', async () => { + const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await button.click(); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + + expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); + }); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await menuEntries[0].getVisibleText()).to.be('logs-gaming-*'); + menuEntries[0].click(); + }); + + await retry.try(async () => { + const selectorButton = await PageObjects.discoverLogExplorer.getDatasetSelectorButton(); + + expect(await selectorButton.getVisibleText()).to.be('logs-gaming-*'); + }); + }); + }); + // beforeEach(async () => { + // await PageObjects.discoverLogExplorer.openDatasetSelector(); + // }); + + // afterEach(async () => { + // await PageObjects.discoverLogExplorer.closeDatasetSelector(); + // }); + // }); + + describe('when open/close the selector', () => { + before(async () => { + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + }); + + beforeEach(async () => { + await browser.refresh(); + await PageObjects.discoverLogExplorer.openDatasetSelector(); + }); + + it('should restore the latest navigation panel', async () => { + await retry.try(async () => { + const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + await nodes[0].click(); + }); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); + + await PageObjects.discoverLogExplorer.closeDatasetSelector(); + await PageObjects.discoverLogExplorer.openDatasetSelector(); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); + }); + + it('should restore the latest search results', async () => { + await PageObjects.discoverLogExplorer.typeSearchFieldWith('system'); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql([initialPackageMap.system]); + }); + + await PageObjects.discoverLogExplorer.closeDatasetSelector(); + await PageObjects.discoverLogExplorer.openDatasetSelector(); + + await retry.try(async () => { + const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql([initialPackageMap.system]); + }); + }); + }); + + describe('when switching between integration panels', () => { + before(async () => { + await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + }); + + it('should remember the latest search and restore its results for each integration', async () => { + await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.discoverLogExplorer.clearSearchField(); + + await PageObjects.discoverLogExplorer.typeSearchFieldWith('apache'); + + await retry.try(async () => { + const { nodes, integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql([initialPackageMap.apache]); + nodes[0].click(); + }); + + await retry.try(async () => { + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); + expect(await menuEntries[0].getVisibleText()).to.be('access'); + expect(await menuEntries[1].getVisibleText()).to.be('error'); + }); + + await PageObjects.discoverLogExplorer.typeSearchFieldWith('err'); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + expect(menuEntries.length).to.be(1); + expect(await menuEntries[0].getVisibleText()).to.be('error'); + }); + + // Navigate back to integrations + const panelTitleNode = + await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + panelTitleNode.click(); + + await retry.try(async () => { + const { nodes, integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + expect(integrations).to.eql([initialPackageMap.apache]); + + const searchValue = await PageObjects.discoverLogExplorer.getSearchFieldValue(); + expect(searchValue).to.eql('apache'); + + nodes[0].click(); + }); + + await retry.try(async () => { + const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + + const searchValue = await PageObjects.discoverLogExplorer.getSearchFieldValue(); + expect(searchValue).to.eql('err'); + + expect(menuEntries.length).to.be(1); + expect(await menuEntries[0].getVisibleText()).to.be('error'); + }); + }); + }); + }); + }); +} diff --git a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/index.ts b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/index.ts index e334c028cbaca..9d669460e7793 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/index.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/index.ts @@ -8,8 +8,10 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function (loadTestFile: FtrProviderContext['loadTestFile']) { - describe('Discover Log-Explorer profile', function () { + describe.only('Discover Log-Explorer profile', function () { + loadTestFile(require.resolve('./columns_selection')); loadTestFile(require.resolve('./customization')); loadTestFile(require.resolve('./dataset_selection_state')); + loadTestFile(require.resolve('./dataset_selector')); }); } From e83756af742b5c8b15fba588a56d539ba2f7fcdc Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Thu, 10 Aug 2023 13:04:05 +0200 Subject: [PATCH 21/23] fix(discover-log-explorer): remove only --- .../test_suites/observability/discover_log_explorer/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/index.ts b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/index.ts index 9d669460e7793..8e9843fc02815 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/index.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/index.ts @@ -8,7 +8,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function (loadTestFile: FtrProviderContext['loadTestFile']) { - describe.only('Discover Log-Explorer profile', function () { + describe('Discover Log-Explorer profile', function () { loadTestFile(require.resolve('./columns_selection')); loadTestFile(require.resolve('./customization')); loadTestFile(require.resolve('./dataset_selection_state')); From 17f0918d87df5e77c790d4ea9b1ac18dfd15e595 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Thu, 10 Aug 2023 15:09:45 +0200 Subject: [PATCH 22/23] fix(discover-log-explorer): update tests for serverless and create setup helper --- .../discover_log_explorer/dataset_selector.ts | 132 ++------------- .../page_objects/discover_log_explorer.ts | 153 ++++++++++++++++++ .../discover_log_explorer/dataset_selector.ts | 132 ++------------- 3 files changed, 175 insertions(+), 242 deletions(-) diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts index 0f41d7ad69b25..b456da8bddb2a 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts @@ -7,95 +7,6 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; -interface IntegrationPackage { - name: string; - version: string; -} - -const packages: IntegrationPackage[] = [ - { - name: 'apache', - version: '1.14.0', - }, - { - name: 'aws', - version: '1.51.0', - }, - { - name: 'system', - version: '1.38.1', - }, - { - name: '1password', - version: '1.18.0', - }, - { - name: 'activemq', - version: '0.13.0', - }, - { - name: 'akamai', - version: '2.14.0', - }, - { - name: 'apache_tomcat', - version: '0.12.1', - }, - { - name: 'apm', - version: '8.10.0-preview-1689351101', - }, - { - name: 'atlassian_bitbucket', - version: '1.14.0', - }, - { - name: 'atlassian_confluence', - version: '1.15.0', - }, - { - name: 'atlassian_jira', - version: '1.15.0', - }, - { - name: 'auditd', - version: '3.12.0', - }, - { - name: 'auditd_manager', - version: '1.12.0', - }, - { - name: 'auth0', - version: '1.10.0', - }, - { - name: 'aws_logs', - version: '0.5.0', - }, - { - name: 'azure', - version: '1.5.28', - }, - { - name: 'azure_app_service', - version: '0.0.1', - }, - { - name: 'azure_blob_storage', - version: '0.5.0', - }, - { - name: 'azure_frontdoor', - version: '1.1.0', - }, - { - name: 'azure_functions', - version: '0.0.1', - }, -]; - -const initialPackages = packages.slice(0, 3); const initialPackageMap = { apache: 'Apache HTTP Server', aws: 'AWS', @@ -103,30 +14,19 @@ const initialPackageMap = { }; const initialPackagesTexts = Object.values(initialPackageMap); -const additionalPackages = packages.slice(3); - const expectedUncategorized = ['logs-gaming-*', 'logs-manufacturing-*', 'logs-retail-*']; export default function ({ getService, getPageObjects }: FtrProviderContext) { const browser = getService('browser'); const esArchiver = getService('esArchiver'); - const logger = getService('log'); const retry = getService('retry'); - const supertest = getService('supertest'); const PageObjects = getPageObjects(['common', 'discoverLogExplorer']); - const uninstallPackage = ({ name, version }: IntegrationPackage) => { - return supertest.delete(`/api/fleet/epm/packages/${name}/${version}`).set('kbn-xsrf', 'xxxx'); - }; - - const installPackage = ({ name, version }: IntegrationPackage) => { - return supertest - .post(`/api/fleet/epm/packages/${name}/${version}`) - .set('kbn-xsrf', 'xxxx') - .send({ force: true }); - }; - describe('Dataset Selector', () => { + before(async () => { + await PageObjects.discoverLogExplorer.removeInstalledPackages(); + }); + describe('without installed integrations or uncategorized data streams', () => { before(async () => { await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); @@ -248,21 +148,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); describe('with installed integrations and uncategorized data streams', () => { + let cleanupIntegrationsSetup: () => Promise; + before(async () => { await esArchiver.load( 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' ); - logger.info(`Installing ${initialPackages.length} integration packages.`); - await Promise.all(initialPackages.map(installPackage)); + cleanupIntegrationsSetup = await PageObjects.discoverLogExplorer.setupInitialIntegrations(); }); after(async () => { await esArchiver.unload( 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' ); - - logger.info(`Uninstalling ${initialPackages.length} integration packages.`); - await Promise.all(initialPackages.map(uninstallPackage)); + await cleanupIntegrationsSetup(); }); describe('when open on the first navigation level', () => { @@ -361,8 +260,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should load more integrations by scrolling to the end of the list', async () => { // Install more integrations and reload the page - logger.info(`Installing ${additionalPackages.length} integration packages.`); - await Promise.all(additionalPackages.map(installPackage)); + const cleanupAdditionalSetup = + await PageObjects.discoverLogExplorer.setupAdditionalIntegrations(); await browser.refresh(); await PageObjects.discoverLogExplorer.openDatasetSelector(); @@ -387,8 +286,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(nodes.length).to.be(20); }); - logger.info(`Uninstalling ${additionalPackages.length} integration packages.`); - await Promise.all(additionalPackages.map(uninstallPackage)); + cleanupAdditionalSetup(); }); }); @@ -640,14 +538,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); }); - // beforeEach(async () => { - // await PageObjects.discoverLogExplorer.openDatasetSelector(); - // }); - - // afterEach(async () => { - // await PageObjects.discoverLogExplorer.closeDatasetSelector(); - // }); - // }); describe('when open/close the selector', () => { before(async () => { diff --git a/x-pack/test/functional/page_objects/discover_log_explorer.ts b/x-pack/test/functional/page_objects/discover_log_explorer.ts index fe6e6582b3740..282a703863dc2 100644 --- a/x-pack/test/functional/page_objects/discover_log_explorer.ts +++ b/x-pack/test/functional/page_objects/discover_log_explorer.ts @@ -7,11 +7,164 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../ftr_provider_context'; +export interface IntegrationPackage { + name: string; + version: string; +} + +const packages: IntegrationPackage[] = [ + { + name: 'apache', + version: '1.14.0', + }, + { + name: 'aws', + version: '1.51.0', + }, + { + name: 'system', + version: '1.38.1', + }, + { + name: '1password', + version: '1.18.0', + }, + { + name: 'activemq', + version: '0.13.0', + }, + { + name: 'akamai', + version: '2.14.0', + }, + { + name: 'apache_tomcat', + version: '0.12.1', + }, + { + name: 'apm', + version: '8.4.2', + }, + { + name: 'atlassian_bitbucket', + version: '1.14.0', + }, + { + name: 'atlassian_confluence', + version: '1.15.0', + }, + { + name: 'atlassian_jira', + version: '1.15.0', + }, + { + name: 'auditd', + version: '3.12.0', + }, + { + name: 'auditd_manager', + version: '1.12.0', + }, + { + name: 'auth0', + version: '1.10.0', + }, + { + name: 'aws_logs', + version: '0.5.0', + }, + { + name: 'azure', + version: '1.5.28', + }, + { + name: 'azure_app_service', + version: '0.0.1', + }, + { + name: 'azure_blob_storage', + version: '0.5.0', + }, + { + name: 'azure_frontdoor', + version: '1.1.0', + }, + { + name: 'azure_functions', + version: '0.0.1', + }, +]; + +const initialPackages = packages.slice(0, 3); +const additionalPackages = packages.slice(3); + export function DiscoverLogExplorerPageObject({ getService }: FtrProviderContext) { + const log = getService('log'); + const supertest = getService('supertest'); const testSubjects = getService('testSubjects'); const toasts = getService('toasts'); return { + uninstallPackage: ({ name, version }: IntegrationPackage) => { + return supertest.delete(`/api/fleet/epm/packages/${name}/${version}`).set('kbn-xsrf', 'xxxx'); + }, + + installPackage: ({ name, version }: IntegrationPackage) => { + return supertest + .post(`/api/fleet/epm/packages/${name}/${version}`) + .set('kbn-xsrf', 'xxxx') + .send({ force: true }); + }, + + getInstalledPackages: () => { + return supertest + .get(`/api/fleet/epm/packages/installed?dataStreamType=logs&perPage=1000`) + .set('kbn-xsrf', 'xxxx'); + }, + + async removeInstalledPackages(): Promise { + const response = await this.getInstalledPackages(); + + // Uninstall installed integration + await Promise.all( + response.body.items.map((pkg: IntegrationPackage) => this.uninstallPackage(pkg)) + ); + + return response.body.items; + }, + + async setupInitialIntegrations() { + log.info(`===== Setup initial integration packages. =====`); + log.info(`===== Uninstall initial integration packages. =====`); + const uninstalled = await this.removeInstalledPackages(); + log.info(`===== Install ${initialPackages.length} mock integration packages. =====`); + await Promise.all(initialPackages.map((pkg: IntegrationPackage) => this.installPackage(pkg))); + + return async () => { + log.info(`===== Uninstall ${initialPackages.length} mock integration packages. =====`); + await Promise.all( + initialPackages.map((pkg: IntegrationPackage) => this.uninstallPackage(pkg)) + ); + log.info(`===== Restore pre-existing integration packages. =====`); + await Promise.all(uninstalled.map((pkg: IntegrationPackage) => this.installPackage(pkg))); + }; + }, + + async setupAdditionalIntegrations() { + log.info(`===== Setup additional integration packages. =====`); + log.info(`===== Install ${additionalPackages.length} mock integration packages. =====`); + await Promise.all( + additionalPackages.map((pkg: IntegrationPackage) => this.installPackage(pkg)) + ); + + return async () => { + log.info(`===== Uninstall ${additionalPackages.length} mock integration packages. =====`); + await Promise.all( + additionalPackages.map((pkg: IntegrationPackage) => this.uninstallPackage(pkg)) + ); + }; + }, + getDatasetSelector() { return testSubjects.find('datasetSelectorPopover'); }, diff --git a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/dataset_selector.ts b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/dataset_selector.ts index 5113cd76571c8..cbb3ea9d95de5 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/dataset_selector.ts @@ -7,95 +7,6 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; -interface IntegrationPackage { - name: string; - version: string; -} - -const packages: IntegrationPackage[] = [ - { - name: 'apache', - version: '1.14.0', - }, - { - name: 'aws', - version: '1.51.0', - }, - { - name: 'system', - version: '1.38.1', - }, - { - name: '1password', - version: '1.18.0', - }, - { - name: 'activemq', - version: '0.13.0', - }, - { - name: 'akamai', - version: '2.14.0', - }, - { - name: 'apache_tomcat', - version: '0.12.1', - }, - { - name: 'apm', - version: '8.10.0-preview-1689351101', - }, - { - name: 'atlassian_bitbucket', - version: '1.14.0', - }, - { - name: 'atlassian_confluence', - version: '1.15.0', - }, - { - name: 'atlassian_jira', - version: '1.15.0', - }, - { - name: 'auditd', - version: '3.12.0', - }, - { - name: 'auditd_manager', - version: '1.12.0', - }, - { - name: 'auth0', - version: '1.10.0', - }, - { - name: 'aws_logs', - version: '0.5.0', - }, - { - name: 'azure', - version: '1.5.28', - }, - { - name: 'azure_app_service', - version: '0.0.1', - }, - { - name: 'azure_blob_storage', - version: '0.5.0', - }, - { - name: 'azure_frontdoor', - version: '1.1.0', - }, - { - name: 'azure_functions', - version: '0.0.1', - }, -]; - -const initialPackages = packages.slice(0, 3); const initialPackageMap = { apache: 'Apache HTTP Server', aws: 'AWS', @@ -103,30 +14,19 @@ const initialPackageMap = { }; const initialPackagesTexts = Object.values(initialPackageMap); -const additionalPackages = packages.slice(3); - const expectedUncategorized = ['logs-gaming-*', 'logs-manufacturing-*', 'logs-retail-*']; export default function ({ getService, getPageObjects }: FtrProviderContext) { const browser = getService('browser'); const esArchiver = getService('esArchiver'); - const logger = getService('log'); const retry = getService('retry'); - const supertest = getService('supertest'); const PageObjects = getPageObjects(['common', 'discoverLogExplorer']); - const uninstallPackage = ({ name, version }: IntegrationPackage) => { - return supertest.delete(`/api/fleet/epm/packages/${name}/${version}`).set('kbn-xsrf', 'xxxx'); - }; - - const installPackage = ({ name, version }: IntegrationPackage) => { - return supertest - .post(`/api/fleet/epm/packages/${name}/${version}`) - .set('kbn-xsrf', 'xxxx') - .send({ force: true }); - }; - describe('Dataset Selector', () => { + before(async () => { + await PageObjects.discoverLogExplorer.removeInstalledPackages(); + }); + describe('without installed integrations or uncategorized data streams', () => { before(async () => { await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); @@ -248,21 +148,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); describe('with installed integrations and uncategorized data streams', () => { + let cleanupIntegrationsSetup: () => Promise; + before(async () => { await esArchiver.load( 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' ); - logger.info(`Installing ${initialPackages.length} integration packages.`); - await Promise.all(initialPackages.map(installPackage)); + cleanupIntegrationsSetup = await PageObjects.discoverLogExplorer.setupInitialIntegrations(); }); after(async () => { await esArchiver.unload( 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' ); - - logger.info(`Uninstalling ${initialPackages.length} integration packages.`); - await Promise.all(initialPackages.map(uninstallPackage)); + await cleanupIntegrationsSetup(); }); describe('when open on the first navigation level', () => { @@ -361,8 +260,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should load more integrations by scrolling to the end of the list', async () => { // Install more integrations and reload the page - logger.info(`Installing ${additionalPackages.length} integration packages.`); - await Promise.all(additionalPackages.map(installPackage)); + const cleanupAdditionalSetup = + await PageObjects.discoverLogExplorer.setupAdditionalIntegrations(); await browser.refresh(); await PageObjects.discoverLogExplorer.openDatasetSelector(); @@ -387,8 +286,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { expect(nodes.length).to.be(20); }); - logger.info(`Uninstalling ${additionalPackages.length} integration packages.`); - await Promise.all(additionalPackages.map(uninstallPackage)); + cleanupAdditionalSetup(); }); }); @@ -640,14 +538,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); }); }); - // beforeEach(async () => { - // await PageObjects.discoverLogExplorer.openDatasetSelector(); - // }); - - // afterEach(async () => { - // await PageObjects.discoverLogExplorer.closeDatasetSelector(); - // }); - // }); describe('when open/close the selector', () => { before(async () => { From 45f8fe4a72b05c907be2af5d2f7a0a78d3099c44 Mon Sep 17 00:00:00 2001 From: Marco Antonio Ghiani Date: Thu, 10 Aug 2023 15:49:47 +0200 Subject: [PATCH 23/23] test(discover-log-explorer): final changes --- test/functional/services/common/browser.ts | 2 +- .../functional/apps/discover_log_explorer/columns_selection.ts | 2 +- .../observability/discover_log_explorer/columns_selection.ts | 2 +- .../observability/discover_log_explorer/customization.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/functional/services/common/browser.ts b/test/functional/services/common/browser.ts index f02af6827de01..fd46e5ac1448b 100644 --- a/test/functional/services/common/browser.ts +++ b/test/functional/services/common/browser.ts @@ -669,7 +669,7 @@ class BrowserService extends FtrService { * Get the network simulation for chromium browsers if available. * https://www.selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/chrome_exports_Driver.html#getNetworkConditions * - * @return {Promise} + * @return {Promise} */ public async getNetworkConditions() { if (this.isChromium()) { diff --git a/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts b/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts index 7946e60547055..c1a9aee81758a 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts +++ b/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts @@ -12,7 +12,7 @@ const defaultLogColumns = ['@timestamp', 'message']; export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const retry = getService('retry'); - const PageObjects = getPageObjects(['common', 'discover', 'discoverLogExplorer']); + const PageObjects = getPageObjects(['common', 'discover']); describe('Columns selection initialization and update', () => { before(async () => { diff --git a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/columns_selection.ts b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/columns_selection.ts index 62d453ba3a595..dfba8f72a699d 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/columns_selection.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/columns_selection.ts @@ -12,7 +12,7 @@ const defaultLogColumns = ['@timestamp', 'message']; export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const retry = getService('retry'); - const PageObjects = getPageObjects(['common', 'discover', 'discoverLogExplorer']); + const PageObjects = getPageObjects(['common', 'discover']); describe('Columns selection initialization and update', () => { before(async () => { diff --git a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.ts b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.ts index 08f687b4e0199..a647293a73145 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.ts @@ -8,7 +8,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const kibanaServer = getService('kibanaServer'); - const PageObjects = getPageObjects(['common', 'navigationalSearch']); + const PageObjects = getPageObjects(['common']); const testSubjects = getService('testSubjects'); describe('Customizations', () => {