mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[8.x] [Discover] Add context awareness telemetry tests for Observability profiles (#201310) (#202246)
# Backport This will backport the following commits from `main` to `8.x`: - [[Discover] Add context awareness telemetry tests for Observability profiles (#201310)](https://github.com/elastic/kibana/pull/201310) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Davis McPhee","email":"davis.mcphee@elastic.co"},"sourceCommit":{"committedDate":"2024-11-29T00:12:26Z","message":"[Discover] Add context awareness telemetry tests for Observability profiles (#201310)\n\n## Summary\r\n\r\nAs suggested in\r\nhttps://github.com/elastic/kibana/pull/199255#discussion_r1842804292,\r\nI've copied and modified the existing Discover context awareness\r\ntelemetry tests to work for Observability profiles. This helps test that\r\nsolution root profiles are picked up as expected, as well as giving us\r\nsome serverless coverage.\r\n\r\n@elastic/appex-qa It didn't seem like there were any config specific\r\nservices for serverless tests yet, so I added the EBT to services to the\r\nmain serverless config. If there's a better way to do this, please let\r\nme know and I can update it.\r\n\r\n### Checklist\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This was checked for breaking HTTP API changes, and any breaking\r\nchanges have been approved by the breaking-change committee. The\r\n`release_note:breaking` label should be applied in these situations.\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [ ] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"be7d748845d4238b644d9ec2dc2880739700ddad","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Discover","release_note:skip","v9.0.0","Team:DataDiscovery","backport:prev-minor","Team:obs-ux-logs","Project:OneDiscover"],"title":"[Discover] Add context awareness telemetry tests for Observability profiles","number":201310,"url":"https://github.com/elastic/kibana/pull/201310","mergeCommit":{"message":"[Discover] Add context awareness telemetry tests for Observability profiles (#201310)\n\n## Summary\r\n\r\nAs suggested in\r\nhttps://github.com/elastic/kibana/pull/199255#discussion_r1842804292,\r\nI've copied and modified the existing Discover context awareness\r\ntelemetry tests to work for Observability profiles. This helps test that\r\nsolution root profiles are picked up as expected, as well as giving us\r\nsome serverless coverage.\r\n\r\n@elastic/appex-qa It didn't seem like there were any config specific\r\nservices for serverless tests yet, so I added the EBT to services to the\r\nmain serverless config. If there's a better way to do this, please let\r\nme know and I can update it.\r\n\r\n### Checklist\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This was checked for breaking HTTP API changes, and any breaking\r\nchanges have been approved by the breaking-change committee. The\r\n`release_note:breaking` label should be applied in these situations.\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [ ] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"be7d748845d4238b644d9ec2dc2880739700ddad"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201310","number":201310,"mergeCommit":{"message":"[Discover] Add context awareness telemetry tests for Observability profiles (#201310)\n\n## Summary\r\n\r\nAs suggested in\r\nhttps://github.com/elastic/kibana/pull/199255#discussion_r1842804292,\r\nI've copied and modified the existing Discover context awareness\r\ntelemetry tests to work for Observability profiles. This helps test that\r\nsolution root profiles are picked up as expected, as well as giving us\r\nsome serverless coverage.\r\n\r\n@elastic/appex-qa It didn't seem like there were any config specific\r\nservices for serverless tests yet, so I added the EBT to services to the\r\nmain serverless config. If there's a better way to do this, please let\r\nme know and I can update it.\r\n\r\n### Checklist\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This was checked for breaking HTTP API changes, and any breaking\r\nchanges have been approved by the breaking-change committee. The\r\n`release_note:breaking` label should be applied in these situations.\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [ ] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"be7d748845d4238b644d9ec2dc2880739700ddad"}}]}] BACKPORT--> Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
This commit is contained in:
parent
aff84f16bc
commit
fd2e0ea97c
8 changed files with 452 additions and 4 deletions
|
@ -22,6 +22,7 @@ disabled:
|
|||
- x-pack/test_serverless/functional/test_suites/observability/common_configs/config.group5.ts
|
||||
- x-pack/test_serverless/functional/test_suites/observability/common_configs/config.group6.ts
|
||||
- x-pack/test_serverless/functional/test_suites/observability/config.screenshots.ts
|
||||
- x-pack/test_serverless/functional/test_suites/observability/config.telemetry.ts
|
||||
# serverless config files that run deployment-agnostic tests
|
||||
- x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.serverless.config.ts
|
||||
- x-pack/test/api_integration/deployment_agnostic/configs/serverless/oblt.apm.serverless.config.ts
|
||||
|
|
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -1090,6 +1090,7 @@ x-pack/test_serverless/api_integration/test_suites/common/platform_security @ela
|
|||
/x-pack/test_serverless/functional/test_suites/common/examples/unified_field_list_examples @elastic/kibana-data-discovery
|
||||
/x-pack/test_serverless/functional/test_suites/common/management/data_views @elastic/kibana-data-discovery
|
||||
src/plugins/discover/public/context_awareness/profile_providers/security @elastic/kibana-data-discovery @elastic/security-threat-hunting-investigations
|
||||
src/plugins/discover/public/context_awareness/profile_providers/observability @elastic/kibana-data-discovery @elastic/obs-ux-logs-team
|
||||
|
||||
# Platform Docs
|
||||
/x-pack/test_serverless/functional/test_suites/security/screenshot_creation/index.ts @elastic/platform-docs
|
||||
|
|
|
@ -11,7 +11,9 @@ import { pageObjects } from './page_objects';
|
|||
import { services } from './services';
|
||||
import type { CreateTestConfigOptions } from '../shared/types';
|
||||
|
||||
export function createTestConfig(options: CreateTestConfigOptions) {
|
||||
export function createTestConfig<TServices extends {} = typeof services>(
|
||||
options: CreateTestConfigOptions<TServices>
|
||||
) {
|
||||
return async ({ readConfigFile }: FtrConfigProviderContext) => {
|
||||
const svlSharedConfig = await readConfigFile(require.resolve('../shared/config.base.ts'));
|
||||
|
||||
|
@ -19,7 +21,7 @@ export function createTestConfig(options: CreateTestConfigOptions) {
|
|||
...svlSharedConfig.getAll(),
|
||||
|
||||
pageObjects,
|
||||
services,
|
||||
services: { ...services, ...options.services },
|
||||
esTestCluster: {
|
||||
...svlSharedConfig.get('esTestCluster'),
|
||||
serverArgs: [
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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 { resolve } from 'path';
|
||||
import type { GenericFtrProviderContext } from '@kbn/test';
|
||||
import { KibanaEBTUIProvider } from '@kbn/test-suites-src/analytics/services/kibana_ebt';
|
||||
import { services as inheritedServices } from '../../services';
|
||||
import { pageObjects } from '../../page_objects';
|
||||
import { createTestConfig } from '../../config.base';
|
||||
|
||||
type ObservabilityTelemetryServices = typeof inheritedServices & {
|
||||
kibana_ebt_ui: typeof KibanaEBTUIProvider;
|
||||
};
|
||||
|
||||
const services: ObservabilityTelemetryServices = {
|
||||
...inheritedServices,
|
||||
kibana_ebt_ui: KibanaEBTUIProvider,
|
||||
};
|
||||
|
||||
export type ObservabilityTelemetryFtrProviderContext = GenericFtrProviderContext<
|
||||
ObservabilityTelemetryServices,
|
||||
typeof pageObjects
|
||||
>;
|
||||
|
||||
export default createTestConfig({
|
||||
serverlessProject: 'oblt',
|
||||
testFiles: [require.resolve('./index.telemetry.ts')],
|
||||
junit: {
|
||||
reportName: 'Serverless Observability Telemetry Functional Tests',
|
||||
},
|
||||
suiteTags: { exclude: ['skipSvlOblt'] },
|
||||
services,
|
||||
|
||||
// include settings from project controller
|
||||
// https://github.com/elastic/project-controller/blob/main/internal/project/observability/config/elasticsearch.yml
|
||||
esServerArgs: ['xpack.ml.dfa.enabled=false'],
|
||||
kbnServerArgs: [
|
||||
`--plugin-path=${resolve(
|
||||
__dirname,
|
||||
'../../../../../test/analytics/plugins/analytics_ftr_helpers'
|
||||
)}`,
|
||||
],
|
||||
});
|
|
@ -0,0 +1,339 @@
|
|||
/*
|
||||
* 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 type { ObservabilityTelemetryFtrProviderContext } from '../../../config.telemetry';
|
||||
|
||||
export default function ({ getService, getPageObjects }: ObservabilityTelemetryFtrProviderContext) {
|
||||
const { common, discover, unifiedFieldList, dashboard, header, timePicker, svlCommonPage } =
|
||||
getPageObjects([
|
||||
'common',
|
||||
'discover',
|
||||
'unifiedFieldList',
|
||||
'dashboard',
|
||||
'header',
|
||||
'timePicker',
|
||||
'svlCommonPage',
|
||||
]);
|
||||
const testSubjects = getService('testSubjects');
|
||||
const dataGrid = getService('dataGrid');
|
||||
const dataViews = getService('dataViews');
|
||||
const monacoEditor = getService('monacoEditor');
|
||||
const ebtUIHelper = getService('kibana_ebt_ui');
|
||||
const retry = getService('retry');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const dashboardAddPanel = getService('dashboardAddPanel');
|
||||
const browser = getService('browser');
|
||||
|
||||
describe('telemetry', () => {
|
||||
describe('context', () => {
|
||||
before(async () => {
|
||||
await svlCommonPage.loginAsAdmin();
|
||||
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
|
||||
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover');
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover');
|
||||
});
|
||||
|
||||
it('should set EBT context for telemetry events with o11y root profile', async () => {
|
||||
await common.navigateToApp('discover');
|
||||
await discover.selectTextBaseLang();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
await monacoEditor.setCodeEditorValue('from my-example-* | sort @timestamp desc');
|
||||
await ebtUIHelper.setOptIn(true);
|
||||
await testSubjects.click('querySubmitButton');
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
|
||||
const events = await ebtUIHelper.getEvents(Number.MAX_SAFE_INTEGER, {
|
||||
eventTypes: ['performance_metric'],
|
||||
withTimeoutMs: 500,
|
||||
});
|
||||
|
||||
expect(events[events.length - 1].context.discoverProfiles).to.eql([
|
||||
'observability-root-profile',
|
||||
'default-data-source-profile',
|
||||
]);
|
||||
});
|
||||
|
||||
it('should set EBT context for telemetry events when logs data source profile and reset', async () => {
|
||||
await common.navigateToApp('discover');
|
||||
await discover.selectTextBaseLang();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
await monacoEditor.setCodeEditorValue('from my-example-logs | sort @timestamp desc');
|
||||
await ebtUIHelper.setOptIn(true);
|
||||
await testSubjects.click('querySubmitButton');
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
|
||||
const events = await ebtUIHelper.getEvents(Number.MAX_SAFE_INTEGER, {
|
||||
eventTypes: ['performance_metric'],
|
||||
withTimeoutMs: 500,
|
||||
});
|
||||
|
||||
expect(events[events.length - 1].context.discoverProfiles).to.eql([
|
||||
'observability-root-profile',
|
||||
'observability-logs-data-source-profile',
|
||||
]);
|
||||
|
||||
// should reset the profiles when navigating away from Discover
|
||||
await common.navigateToApp('home');
|
||||
await retry.waitFor('home page to open', async () => {
|
||||
return await testSubjects.exists('homeApp');
|
||||
});
|
||||
await testSubjects.click('addSampleData');
|
||||
|
||||
await retry.try(async () => {
|
||||
const eventsAfter = await ebtUIHelper.getEvents(Number.MAX_SAFE_INTEGER, {
|
||||
eventTypes: ['click'],
|
||||
withTimeoutMs: 500,
|
||||
});
|
||||
|
||||
expect(eventsAfter[eventsAfter.length - 1].context.discoverProfiles).to.eql([]);
|
||||
});
|
||||
});
|
||||
|
||||
it('should not set EBT context for embeddables', async () => {
|
||||
await dashboard.navigateToApp();
|
||||
await dashboard.gotoDashboardLandingPage();
|
||||
await dashboard.clickNewDashboard();
|
||||
await timePicker.setDefaultAbsoluteRange();
|
||||
await ebtUIHelper.setOptIn(true);
|
||||
await dashboardAddPanel.addSavedSearch('A Saved Search');
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
await dashboard.waitForRenderComplete();
|
||||
const rows = await dataGrid.getDocTableRows();
|
||||
expect(rows.length).to.be.above(0);
|
||||
await testSubjects.click('dashboardEditorMenuButton');
|
||||
|
||||
const events = await ebtUIHelper.getEvents(Number.MAX_SAFE_INTEGER, {
|
||||
eventTypes: ['click'],
|
||||
withTimeoutMs: 500,
|
||||
});
|
||||
|
||||
expect(
|
||||
events.length > 0 &&
|
||||
events.every((event) => !(event.context.discoverProfiles as string[])?.length)
|
||||
).to.be(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('events', () => {
|
||||
beforeEach(async () => {
|
||||
await common.navigateToApp('discover');
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
});
|
||||
|
||||
it('should track field usage when a field is added to the table', async () => {
|
||||
await dataViews.switchToAndValidate('my-example-*');
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
await unifiedFieldList.waitUntilSidebarHasLoaded();
|
||||
await ebtUIHelper.setOptIn(true);
|
||||
await unifiedFieldList.clickFieldListItemAdd('service.name');
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
await unifiedFieldList.waitUntilSidebarHasLoaded();
|
||||
|
||||
const [event] = await ebtUIHelper.getEvents(Number.MAX_SAFE_INTEGER, {
|
||||
eventTypes: ['discover_field_usage'],
|
||||
withTimeoutMs: 500,
|
||||
});
|
||||
|
||||
expect(event.properties).to.eql({
|
||||
eventName: 'dataTableSelection',
|
||||
fieldName: 'service.name',
|
||||
});
|
||||
|
||||
await unifiedFieldList.clickFieldListItemAdd('_score');
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
await unifiedFieldList.waitUntilSidebarHasLoaded();
|
||||
|
||||
const [_, event2] = await ebtUIHelper.getEvents(Number.MAX_SAFE_INTEGER, {
|
||||
eventTypes: ['discover_field_usage'],
|
||||
withTimeoutMs: 500,
|
||||
});
|
||||
|
||||
expect(event2.properties).to.eql({
|
||||
eventName: 'dataTableSelection',
|
||||
});
|
||||
});
|
||||
|
||||
it('should track field usage when a field is removed from the table', async () => {
|
||||
await dataViews.switchToAndValidate('my-example-logs');
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
await unifiedFieldList.waitUntilSidebarHasLoaded();
|
||||
await unifiedFieldList.clickFieldListItemAdd('log.level');
|
||||
await browser.refresh();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
await unifiedFieldList.waitUntilSidebarHasLoaded();
|
||||
await ebtUIHelper.setOptIn(true);
|
||||
await unifiedFieldList.clickFieldListItemRemove('log.level');
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
await unifiedFieldList.waitUntilSidebarHasLoaded();
|
||||
|
||||
const [event] = await ebtUIHelper.getEvents(Number.MAX_SAFE_INTEGER, {
|
||||
eventTypes: ['discover_field_usage'],
|
||||
withTimeoutMs: 500,
|
||||
});
|
||||
|
||||
expect(event.properties).to.eql({
|
||||
eventName: 'dataTableRemoval',
|
||||
fieldName: 'log.level',
|
||||
});
|
||||
});
|
||||
|
||||
it('should track field usage when a filter is added', async () => {
|
||||
await dataViews.switchToAndValidate('my-example-logs');
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
await ebtUIHelper.setOptIn(true);
|
||||
await dataGrid.clickCellFilterForButtonExcludingControlColumns(0, 0);
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
await unifiedFieldList.waitUntilSidebarHasLoaded();
|
||||
|
||||
const [event] = await ebtUIHelper.getEvents(Number.MAX_SAFE_INTEGER, {
|
||||
eventTypes: ['discover_field_usage'],
|
||||
withTimeoutMs: 500,
|
||||
});
|
||||
|
||||
expect(event.properties).to.eql({
|
||||
eventName: 'filterAddition',
|
||||
fieldName: '@timestamp',
|
||||
filterOperation: '+',
|
||||
});
|
||||
|
||||
await unifiedFieldList.clickFieldListExistsFilter('log.level');
|
||||
|
||||
const [_, event2] = await ebtUIHelper.getEvents(Number.MAX_SAFE_INTEGER, {
|
||||
eventTypes: ['discover_field_usage'],
|
||||
withTimeoutMs: 500,
|
||||
});
|
||||
|
||||
expect(event2.properties).to.eql({
|
||||
eventName: 'filterAddition',
|
||||
fieldName: 'log.level',
|
||||
filterOperation: '_exists_',
|
||||
});
|
||||
});
|
||||
|
||||
it('should track field usage for doc viewer too', async () => {
|
||||
await dataViews.switchToAndValidate('my-example-logs');
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
await unifiedFieldList.waitUntilSidebarHasLoaded();
|
||||
await unifiedFieldList.clickFieldListItemAdd('log.level');
|
||||
await browser.refresh();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
await unifiedFieldList.waitUntilSidebarHasLoaded();
|
||||
await ebtUIHelper.setOptIn(true);
|
||||
|
||||
await dataGrid.clickRowToggle();
|
||||
await discover.isShowingDocViewer();
|
||||
|
||||
// event 1
|
||||
await dataGrid.clickFieldActionInFlyout('service.name', 'toggleColumnButton');
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
|
||||
// event 2
|
||||
await dataGrid.clickFieldActionInFlyout('log.level', 'toggleColumnButton');
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
|
||||
// event 3
|
||||
await dataGrid.clickFieldActionInFlyout('log.level', 'addFilterOutValueButton');
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
|
||||
const [event1, event2, event3] = await ebtUIHelper.getEvents(Number.MAX_SAFE_INTEGER, {
|
||||
eventTypes: ['discover_field_usage'],
|
||||
withTimeoutMs: 500,
|
||||
});
|
||||
|
||||
expect(event1.properties).to.eql({
|
||||
eventName: 'dataTableSelection',
|
||||
fieldName: 'service.name',
|
||||
});
|
||||
|
||||
expect(event2.properties).to.eql({
|
||||
eventName: 'dataTableRemoval',
|
||||
fieldName: 'log.level',
|
||||
});
|
||||
|
||||
expect(event3.properties).to.eql({
|
||||
eventName: 'filterAddition',
|
||||
fieldName: 'log.level',
|
||||
filterOperation: '-',
|
||||
});
|
||||
});
|
||||
|
||||
it('should track field usage on surrounding documents page', async () => {
|
||||
await dataViews.switchToAndValidate('my-example-logs');
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
await unifiedFieldList.waitUntilSidebarHasLoaded();
|
||||
await unifiedFieldList.clickFieldListItemAdd('log.level');
|
||||
await browser.refresh();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
await unifiedFieldList.waitUntilSidebarHasLoaded();
|
||||
await dataGrid.clickRowToggle({ rowIndex: 1 });
|
||||
await discover.isShowingDocViewer();
|
||||
|
||||
const [, surroundingActionEl] = await dataGrid.getRowActions();
|
||||
await surroundingActionEl.click();
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
await ebtUIHelper.setOptIn(true);
|
||||
|
||||
await dataGrid.clickRowToggle({ rowIndex: 0 });
|
||||
await discover.isShowingDocViewer();
|
||||
|
||||
// event 1
|
||||
await dataGrid.clickFieldActionInFlyout('service.name', 'toggleColumnButton');
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
|
||||
// event 2
|
||||
await dataGrid.clickFieldActionInFlyout('log.level', 'toggleColumnButton');
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
|
||||
// event 3
|
||||
await dataGrid.clickFieldActionInFlyout('log.level', 'addFilterOutValueButton');
|
||||
await header.waitUntilLoadingHasFinished();
|
||||
await discover.waitUntilSearchingHasFinished();
|
||||
|
||||
const [event1, event2, event3] = await ebtUIHelper.getEvents(Number.MAX_SAFE_INTEGER, {
|
||||
eventTypes: ['discover_field_usage'],
|
||||
withTimeoutMs: 500,
|
||||
});
|
||||
|
||||
expect(event1.properties).to.eql({
|
||||
eventName: 'dataTableSelection',
|
||||
fieldName: 'service.name',
|
||||
});
|
||||
|
||||
expect(event2.properties).to.eql({
|
||||
eventName: 'dataTableRemoval',
|
||||
fieldName: 'log.level',
|
||||
});
|
||||
|
||||
expect(event3.properties).to.eql({
|
||||
eventName: 'filterAddition',
|
||||
fieldName: 'log.level',
|
||||
filterOperation: '-',
|
||||
});
|
||||
|
||||
expect(event3.context.discoverProfiles).to.eql([
|
||||
'observability-root-profile',
|
||||
'observability-logs-data-source-profile',
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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 type { ObservabilityTelemetryFtrProviderContext } from '../../../config.telemetry';
|
||||
|
||||
export default function ({
|
||||
getService,
|
||||
getPageObjects,
|
||||
loadTestFile,
|
||||
}: ObservabilityTelemetryFtrProviderContext) {
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const PageObjects = getPageObjects(['timePicker', 'svlCommonPage']);
|
||||
const from = '2024-06-10T14:00:00.000Z';
|
||||
const to = '2024-06-10T16:30:00.000Z';
|
||||
|
||||
describe('discover/observabilitySolution/context_awareness/telemetry', function () {
|
||||
before(async () => {
|
||||
await esArchiver.load('test/functional/fixtures/es_archiver/discover/context_awareness');
|
||||
await kibanaServer.importExport.load(
|
||||
'test/functional/fixtures/kbn_archiver/discover/context_awareness'
|
||||
);
|
||||
await kibanaServer.uiSettings.update({
|
||||
'timepicker:timeDefaults': `{ "from": "${from}", "to": "${to}"}`,
|
||||
});
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await esArchiver.unload('test/functional/fixtures/es_archiver/discover/context_awareness');
|
||||
await kibanaServer.importExport.unload(
|
||||
'test/functional/fixtures/kbn_archiver/discover/context_awareness'
|
||||
);
|
||||
await PageObjects.timePicker.resetDefaultAbsoluteRangeViaUiSettings();
|
||||
});
|
||||
|
||||
loadTestFile(require.resolve('./_telemetry'));
|
||||
});
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* 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 type { ObservabilityTelemetryFtrProviderContext } from './config.telemetry';
|
||||
|
||||
export default function ({ loadTestFile }: ObservabilityTelemetryFtrProviderContext) {
|
||||
describe('serverless observability UI - telemetry', function () {
|
||||
this.tags(['skipMKI', 'esGate']);
|
||||
|
||||
loadTestFile(require.resolve('./discover/context_awareness/telemetry'));
|
||||
});
|
||||
}
|
|
@ -8,13 +8,13 @@
|
|||
import { ServerlessProjectType } from '@kbn/es';
|
||||
import { InheritedServices } from '../../api_integration/services';
|
||||
|
||||
export interface CreateTestConfigOptions {
|
||||
export interface CreateTestConfigOptions<TServices extends {} = InheritedServices> {
|
||||
serverlessProject: ServerlessProjectType;
|
||||
esServerArgs?: string[];
|
||||
kbnServerArgs?: string[];
|
||||
testFiles: string[];
|
||||
junit: { reportName: string };
|
||||
suiteTags?: { include?: string[]; exclude?: string[] };
|
||||
services?: InheritedServices;
|
||||
services?: TServices;
|
||||
apps?: Record<string, { pathname: string; hash?: string }>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue