From 3d4b3627a2a4bd67462ad0853a65283a1fa12908 Mon Sep 17 00:00:00 2001 From: Rodney Norris Date: Fri, 13 Sep 2024 11:22:38 -0500 Subject: [PATCH 001/129] [Search][App Search] support engine name in solution nav (#192781) ## Summary Updated how we build the app search side items for the solution nav to remove the renderItem handler and place all the engine links under the engine name. This will only be used for the Search solution nav so we are accepting the trade-off of losing the engine badges in the side nav when using the solution nav. ### Screenshots Engine page w/ Solution Nav image Engine Page w/ Classic Nav image --- .../app_search/components/layout/nav.tsx | 17 +++++++++++++++++ .../components/layout/page_template.tsx | 10 +++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/layout/nav.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/layout/nav.tsx index 20bbfe38e5f39..c70971ebc6ece 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/layout/nav.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/layout/nav.tsx @@ -65,3 +65,20 @@ export const useAppSearchNav = () => { // to cause all our navItems to properly render as nav links. return [{ id: '', name: '', items: navItems }]; }; + +// Process App Search side nav items for use in the new Solution Nav +export const cleanAppSearchNavItems = ( + items: Array> +): Array> => { + const enginesItem = items.find((item) => item.id === 'engines'); + if (enginesItem && enginesItem.items && enginesItem.items.length > 0) { + const engineChildren = enginesItem.items; + const engineNameItem = engineChildren.find((item) => item.id === 'engineName'); + if (engineNameItem && engineNameItem.renderItem) { + delete engineNameItem.renderItem; + engineNameItem.items = engineChildren.filter((item) => item.id !== 'engineName'); + enginesItem.items = [engineNameItem]; + } + } + return items; +}; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/layout/page_template.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/layout/page_template.tsx index 7e4d72c232b33..35792e2d0cbf9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/layout/page_template.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/layout/page_template.tsx @@ -16,7 +16,7 @@ import { SetAppSearchChrome } from '../../../shared/kibana_chrome'; import { EnterpriseSearchPageTemplateWrapper, PageTemplateProps } from '../../../shared/layout'; import { SendAppSearchTelemetry } from '../../../shared/telemetry'; -import { useAppSearchNav } from './nav'; +import { useAppSearchNav, cleanAppSearchNavItems } from './nav'; export const AppSearchPageTemplate: React.FC< Omit @@ -27,14 +27,14 @@ export const AppSearchPageTemplate: React.FC< React.useEffect(() => { if (chromeStyle === 'classic') return; + const appSearch = cleanAppSearchNavItems(navItems?.[0]?.items); // We update the new side nav definition with the selected app items - updateSideNavDefinition({ appSearch: navItems?.[0]?.items }); - }, [chromeStyle, navItems, updateSideNavDefinition]); - React.useEffect(() => { + updateSideNavDefinition({ appSearch }); + return () => { updateSideNavDefinition({ appSearch: undefined }); }; - }, [updateSideNavDefinition]); + }, [chromeStyle, navItems, updateSideNavDefinition]); return ( Date: Fri, 13 Sep 2024 13:31:11 -0300 Subject: [PATCH 002/129] [Telemetry][Security Solution] Fix integration tests on branch 9.0 (#192842) ## Summary Follow up of https://github.com/elastic/kibana/pull/192040 and https://github.com/elastic/kibana/issues/192624 The issue was while installing the agent policy because the `endpoint` package is not listed in the EPR for kibana 9+. The fix is to disable `kibanaVersionCheck`. --- .../lib/telemetry_helpers.ts | 38 +++++++++++++---- .../integration_tests/telemetry.test.ts | 41 +++++++++++-------- 2 files changed, 53 insertions(+), 26 deletions(-) diff --git a/x-pack/plugins/security_solution/server/integration_tests/lib/telemetry_helpers.ts b/x-pack/plugins/security_solution/server/integration_tests/lib/telemetry_helpers.ts index 2b1b5f2809dde..d83ff1e910ca5 100644 --- a/x-pack/plugins/security_solution/server/integration_tests/lib/telemetry_helpers.ts +++ b/x-pack/plugins/security_solution/server/integration_tests/lib/telemetry_helpers.ts @@ -16,6 +16,7 @@ import type { ExceptionListSchema, } from '@kbn/securitysolution-io-ts-list-types'; import { asyncForEach } from '@kbn/std'; +import { ToolingLog } from '@kbn/tooling-log'; import { createExceptionList, @@ -54,6 +55,11 @@ const endpointMetricsMetadataIndex = '.ds-metrics-endpoint.metadata-1'; const endpointMetricsPolicyIndex = '.ds-metrics-endpoint.policy-1'; const prebuiltRulesIndex = '.alerts-security.alerts'; +const logger = new ToolingLog({ + level: 'info', + writeTo: process.stdout, +}); + export function getTelemetryTasks( spy: jest.SpyInstance< SecuritySolutionPluginStart, @@ -259,7 +265,7 @@ export async function createAgentPolicy( enabled: true, policy_id: 'policy-elastic-agent-on-cloud', policy_ids: ['policy-elastic-agent-on-cloud'], - package: { name: 'endpoint', title: 'Elastic Endpoint', version: '9.0.0' }, + package: { name: 'endpoint', title: 'Elastic Endpoint', version: '8.15.1' }, inputs: [ { config: { @@ -282,14 +288,28 @@ export async function createAgentPolicy( ], }; - await soClient.create(LEGACY_AGENT_POLICY_SAVED_OBJECT_TYPE, {}, { id }).catch(() => {}); - await packagePolicyService - .create(soClient, esClient, packagePolicy, { - id, - spaceId: 'default', - bumpRevision: false, - }) - .catch(() => {}); + await soClient.get(LEGACY_AGENT_POLICY_SAVED_OBJECT_TYPE, id).catch(async (e) => { + try { + return await soClient.create(LEGACY_AGENT_POLICY_SAVED_OBJECT_TYPE, {}, { id }); + } catch { + logger.error(`>> Error searching for agent: ${e}`); + throw Error(`>> Error searching for agent: ${e}`); + } + }); + + await packagePolicyService.get(soClient, id).catch(async () => { + try { + return await packagePolicyService.create(soClient, esClient, packagePolicy, { + id, + spaceId: 'default', + bumpRevision: false, + force: true, + }); + } catch (e) { + logger.error(`>> Error creating package policy: ${e}`); + throw Error(`>> Error creating package policy: ${e}`); + } + }); } export async function createMockedExceptionList(so: SavedObjectsServiceStart) { diff --git a/x-pack/plugins/security_solution/server/integration_tests/telemetry.test.ts b/x-pack/plugins/security_solution/server/integration_tests/telemetry.test.ts index e4899f06eeb31..801926adbf948 100644 --- a/x-pack/plugins/security_solution/server/integration_tests/telemetry.test.ts +++ b/x-pack/plugins/security_solution/server/integration_tests/telemetry.test.ts @@ -85,7 +85,20 @@ describe('telemetry tasks', () => { beforeAll(async () => { await removeFile(logFilePath); - const servers = await setupTestServers(logFilePath); + const servers = await setupTestServers(logFilePath, { + xpack: { + fleet: { + internal: { + registry: { + // Since `endpoint` is not available in EPR yet for + // kibana 9 (e.g., https://epr.elastic.co/search?package=endpoint&kibana.version=9.0.0) + // we need to ignore version checks + kibanaVersionCheckEnabled: false, + }, + }, + }, + }, + }); esServer = servers.esServer; kibanaServer = servers.kibanaServer; @@ -311,9 +324,8 @@ describe('telemetry tasks', () => { expect(body.endpoint_metrics).toStrictEqual(endpointMetaTelemetryRequest.endpoint_metrics); expect(body.endpoint_meta).toStrictEqual(endpointMetaTelemetryRequest.endpoint_meta); - // TODO(szaffarano) Failing 9.0 version update: https://github.com/elastic/kibana/issues/192624 - // expect(body.policy_config).toStrictEqual(endpointMetaTelemetryRequest.policy_config); - // expect(body.policy_response).toStrictEqual(endpointMetaTelemetryRequest.policy_response); + expect(body.policy_config).toStrictEqual(endpointMetaTelemetryRequest.policy_config); + expect(body.policy_response).toStrictEqual(endpointMetaTelemetryRequest.policy_response); }); it('should manage runtime errors searching endpoint metrics', async () => { @@ -509,8 +521,7 @@ describe('telemetry tasks', () => { expect(body.endpoint_metrics).toStrictEqual(endpointMetaTelemetryRequest.endpoint_metrics); expect(body.endpoint_meta).toStrictEqual(endpointMetaTelemetryRequest.endpoint_meta); - // TODO(szaffarano) Failing 9.0 version update: https://github.com/elastic/kibana/issues/192624 - // expect(body.policy_config).toStrictEqual(endpointMetaTelemetryRequest.policy_config); + expect(body.policy_config).toStrictEqual(endpointMetaTelemetryRequest.policy_config); expect(body.policy_response).toStrictEqual({}); const requests = await getTaskMetricsRequests(task, started); @@ -542,8 +553,7 @@ describe('telemetry tasks', () => { expect(body.endpoint_metrics).toStrictEqual(endpointMetaTelemetryRequest.endpoint_metrics); expect(body.endpoint_meta).toStrictEqual(endpointMetaTelemetryRequest.endpoint_meta); - // TODO(szaffarano) Failing 9.0 version update: https://github.com/elastic/kibana/issues/192624 - // expect(body.policy_config).toStrictEqual(endpointMetaTelemetryRequest.policy_config); + expect(body.policy_config).toStrictEqual(endpointMetaTelemetryRequest.policy_config); expect(body.policy_response).toStrictEqual({}); const requests = await getTaskMetricsRequests(task, started); @@ -579,9 +589,8 @@ describe('telemetry tasks', () => { ...endpointMetaTelemetryRequest.endpoint_meta, capabilities: [], }); - // TODO(szaffarano) Failing 9.0 version update: https://github.com/elastic/kibana/issues/192624 - // expect(body.policy_config).toStrictEqual(endpointMetaTelemetryRequest.policy_config); - // expect(body.policy_response).toStrictEqual(endpointMetaTelemetryRequest.policy_response); + expect(body.policy_config).toStrictEqual(endpointMetaTelemetryRequest.policy_config); + expect(body.policy_response).toStrictEqual(endpointMetaTelemetryRequest.policy_response); const requests = await getTaskMetricsRequests(task, started); @@ -615,9 +624,8 @@ describe('telemetry tasks', () => { ...endpointMetaTelemetryRequest.endpoint_meta, capabilities: [], }); - // TODO(szaffarano) Failing 9.0 version update: https://github.com/elastic/kibana/issues/192624 - // expect(body.policy_config).toStrictEqual(endpointMetaTelemetryRequest.policy_config); - // expect(body.policy_response).toStrictEqual(endpointMetaTelemetryRequest.policy_response); + expect(body.policy_config).toStrictEqual(endpointMetaTelemetryRequest.policy_config); + expect(body.policy_response).toStrictEqual(endpointMetaTelemetryRequest.policy_response); const requests = await getTaskMetricsRequests(task, started); @@ -661,9 +669,8 @@ describe('telemetry tasks', () => { expect(body.endpoint_metrics).toStrictEqual(endpointMetaTelemetryRequest.endpoint_metrics); expect(body.endpoint_meta).toStrictEqual(endpointMetaTelemetryRequest.endpoint_meta); - // TODO(szaffarano) Failing 9.0 version update: https://github.com/elastic/kibana/issues/192624 - // expect(body.policy_config).toStrictEqual(endpointMetaTelemetryRequest.policy_config); - // expect(body.policy_response).toStrictEqual(endpointMetaTelemetryRequest.policy_response); + expect(body.policy_config).toStrictEqual(endpointMetaTelemetryRequest.policy_config); + expect(body.policy_response).toStrictEqual(endpointMetaTelemetryRequest.policy_response); const requests = await getTaskMetricsRequests(task, started); From fa748474c42ed0111dde735fb2d51d202ed86a9e Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Fri, 13 Sep 2024 12:36:41 -0400 Subject: [PATCH 003/129] [Fleet] Add showOnlyActiveDatastream to /packages/installed endpoint (#192631) --- .../fleet/server/routes/epm/handlers.ts | 5 +- .../server/services/epm/packages/get.test.ts | 85 ++++++++++++++++++- .../fleet/server/services/epm/packages/get.ts | 56 +++++++++--- .../fleet/server/types/rest_spec/epm.ts | 1 + .../fleet_api_integration/apis/epm/get.ts | 21 +++++ 5 files changed, 151 insertions(+), 17 deletions(-) diff --git a/x-pack/plugins/fleet/server/routes/epm/handlers.ts b/x-pack/plugins/fleet/server/routes/epm/handlers.ts index 560af83619a48..47bdbd972b4c7 100644 --- a/x-pack/plugins/fleet/server/routes/epm/handlers.ts +++ b/x-pack/plugins/fleet/server/routes/epm/handlers.ts @@ -142,9 +142,12 @@ export const getInstalledListHandler: FleetRequestHandler< TypeOf > = async (context, request, response) => { try { - const savedObjectsClient = (await context.fleet).internalSoClient; + const [fleetContext, coreContext] = await Promise.all([context.fleet, context.core]); + const savedObjectsClient = fleetContext.internalSoClient; + const esClient = coreContext.elasticsearch.client.asCurrentUser; const res = await getInstalledPackages({ savedObjectsClient, + esClient, ...request.query, }); diff --git a/x-pack/plugins/fleet/server/services/epm/packages/get.test.ts b/x-pack/plugins/fleet/server/services/epm/packages/get.test.ts index 31896033d2432..2dc295762e33a 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/get.test.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/get.test.ts @@ -8,7 +8,7 @@ import type { SavedObjectsClientContract, SavedObjectsFindResult } from '@kbn/core/server'; import { SavedObjectsErrorHelpers } from '@kbn/core/server'; -import { savedObjectsClientMock } from '@kbn/core/server/mocks'; +import { savedObjectsClientMock, elasticsearchServiceMock } from '@kbn/core/server/mocks'; import { ASSETS_SAVED_OBJECT_TYPE, @@ -17,7 +17,7 @@ import { } from '../../../../common'; import type { RegistryPackage } from '../../../../common/types'; import type { PackagePolicySOAttributes } from '../../../types'; - +import { dataStreamService } from '../../data_streams'; import { createAppContextStartContractMock } from '../../../mocks'; import { appContextService } from '../../app_context'; import { PackageNotFoundError } from '../../../errors'; @@ -32,6 +32,7 @@ import { getInstalledPackages, getPackageInfo, getPackages, getPackageUsageStats jest.mock('../registry'); jest.mock('../../settings'); jest.mock('../../audit_logging'); +jest.mock('../../data_streams'); const MockRegistry = jest.mocked(Registry); @@ -643,6 +644,7 @@ owner: elastic`, }); await getInstalledPackages({ + esClient: elasticsearchServiceMock.createInternalClient(), savedObjectsClient: soClient, dataStreamType: 'logs', nameQuery: 'nginx', @@ -785,6 +787,7 @@ owner: elastic`, }); const results = await getInstalledPackages({ + esClient: elasticsearchServiceMock.createInternalClient(), savedObjectsClient: soClient, dataStreamType: 'logs', nameQuery: 'nginx', @@ -816,6 +819,84 @@ owner: elastic`, total: 5, }); }); + it('filter non active datastreams if flag is true', async () => { + const soClient = savedObjectsClientMock.create(); + + jest.mocked(dataStreamService.getAllFleetDataStreams).mockResolvedValue([ + { + name: `logs-elastic_agent.apm_server-production`, + }, + { + name: `metrics-elastic_agent.apm_server-production`, + }, + ] as any); + + soClient.find.mockImplementation(async (options) => { + if (options.type === PACKAGES_SAVED_OBJECT_TYPE) { + return { + total: 5, + saved_objects: [ + { + type: 'epm-packages', + id: 'elastic_agent', + attributes: { + es_index_patterns: { + fleet_server_logs: 'logs-elastic_agent.fleet_server-*', + apm_server_logs: 'logs-elastic_agent.apm_server-*', + apm_server_metrics: 'metrics-elastic_agent.apm_server-*', + }, + name: 'elastic_agent', + version: '1.8.0', + install_status: 'installed', + }, + references: [], + sort: ['elastic_agent'], + }, + ], + } as any; + } else if (options.type === ASSETS_SAVED_OBJECT_TYPE) { + return { + total: 5, + saved_objects: [ + { + type: 'epm-packages-assets', + id: '338b6f9e-e126-5f1e-abb9-afe017d4788b', + attributes: { + package_name: 'elastic_agent', + package_version: '1.8.0', + install_source: 'upload', + asset_path: 'elastic_agent-1.8.0/manifest.yml', + media_type: 'text/yaml; charset=utf-8', + data_utf8: + 'name: elastic_agent\ntitle: Elastic Agent\nversion: 1.8.0\ndescription: Collect logs and metrics from Elastic Agents.\ntype: integration\nformat_version: 1.0.0\nlicense: basic\ncategories: ["elastic_stack"]\nconditions:\n kibana.version: "^8.7.1"\nowner:\n github: elastic/elastic-agent\nicons:\n - src: /img/logo_elastic_agent.svg\n title: logo Elastic Agent\n size: 64x64\n type: image/svg+xml\nscreenshots:\n - src: /img/elastic_agent_overview.png\n title: Elastic Agent Overview\n size: 2560×1234\n type: image/png\n - src: /img/elastic_agent_metrics.png\n title: Elastic Agent Metrics\n size: 2560×1234\n type: image/png\n - src: /img/elastic_agent_info.png\n title: Elastic Agent Information\n size: 2560×1234\n type: image/png\n - src: /img/elastic_agent_integrations.png\n title: Elastic Agent Integrations\n size: 2560×1234\n type: image/png\n', + data_base64: '', + }, + references: [], + }, + ], + } as any; + } + }); + + const results = await getInstalledPackages({ + savedObjectsClient: soClient, + esClient: elasticsearchServiceMock.createInternalClient(), + perPage: 10, + sortOrder: 'asc', + showOnlyActiveDataStreams: true, + }); + + expect(results.items[0].dataStreams).toEqual([ + { + name: 'logs-elastic_agent.apm_server-*', + title: 'apm_server_logs', + }, + { + name: 'metrics-elastic_agent.apm_server-*', + title: 'apm_server_metrics', + }, + ]); + }); }); describe('getPackageInfo', () => { diff --git a/x-pack/plugins/fleet/server/services/epm/packages/get.ts b/x-pack/plugins/fleet/server/services/epm/packages/get.ts index 2af0f1e9f1d2b..e59f0ad4b5ae9 100644 --- a/x-pack/plugins/fleet/server/services/epm/packages/get.ts +++ b/x-pack/plugins/fleet/server/services/epm/packages/get.ts @@ -7,12 +7,17 @@ import { safeLoad } from 'js-yaml'; import pMap from 'p-map'; -import type { SavedObjectsClientContract, SavedObjectsFindOptions } from '@kbn/core/server'; +import minimatch from 'minimatch'; +import type { + ElasticsearchClient, + SavedObjectsClientContract, + SavedObjectsFindOptions, +} from '@kbn/core/server'; import semverGte from 'semver/functions/gte'; import type { Logger } from '@kbn/core/server'; import { withSpan } from '@kbn/apm-utils'; -import type { SortResults } from '@elastic/elasticsearch/lib/api/types'; +import type { IndicesDataStream, SortResults } from '@elastic/elasticsearch/lib/api/types'; import { nodeBuilder } from '@kbn/es-query'; @@ -50,6 +55,7 @@ import { PackageInvalidArchiveError, } from '../../../errors'; import { appContextService } from '../..'; +import { dataStreamService } from '../../data_streams'; import * as Registry from '../registry'; import type { PackageAsset } from '../archive/storage'; import { getEsPackage } from '../archive/storage'; @@ -180,20 +186,22 @@ export async function getPackages( interface GetInstalledPackagesOptions { savedObjectsClient: SavedObjectsClientContract; + esClient: ElasticsearchClient; dataStreamType?: PackageDataStreamTypes; nameQuery?: string; searchAfter?: SortResults; perPage: number; sortOrder: 'asc' | 'desc'; + showOnlyActiveDataStreams?: boolean; } export async function getInstalledPackages(options: GetInstalledPackagesOptions) { - const { savedObjectsClient, ...otherOptions } = options; + const { savedObjectsClient, esClient, showOnlyActiveDataStreams, ...otherOptions } = options; const { dataStreamType } = otherOptions; - const packageSavedObjects = await getInstalledPackageSavedObjects( - savedObjectsClient, - otherOptions - ); + const [packageSavedObjects, allFleetDataStreams] = await Promise.all([ + getInstalledPackageSavedObjects(savedObjectsClient, otherOptions), + showOnlyActiveDataStreams ? dataStreamService.getAllFleetDataStreams(esClient) : undefined, + ]); const integrations = packageSavedObjects.saved_objects.map((integrationSavedObject) => { const { @@ -203,7 +211,11 @@ export async function getInstalledPackages(options: GetInstalledPackagesOptions) es_index_patterns: esIndexPatterns, } = integrationSavedObject.attributes; - const dataStreams = getInstalledPackageSavedObjectDataStreams(esIndexPatterns, dataStreamType); + const dataStreams = getInstalledPackageSavedObjectDataStreams( + esIndexPatterns, + dataStreamType, + allFleetDataStreams + ); return { name, @@ -296,7 +308,7 @@ export async function getPackageSavedObjects( async function getInstalledPackageSavedObjects( savedObjectsClient: SavedObjectsClientContract, - options: Omit + options: Omit ) { const { searchAfter, sortOrder, perPage, nameQuery, dataStreamType } = options; @@ -385,8 +397,13 @@ export async function getInstalledPackageManifests( function getInstalledPackageSavedObjectDataStreams( indexPatterns: Record, - dataStreamType?: string + dataStreamType?: string, + filterActiveDatastreams?: IndicesDataStream[] ) { + const filterActiveDatastreamsName = filterActiveDatastreams + ? filterActiveDatastreams.map((ds) => ds.name) + : undefined; + return Object.entries(indexPatterns) .map(([key, value]) => { return { @@ -395,11 +412,22 @@ function getInstalledPackageSavedObjectDataStreams( }; }) .filter((stream) => { - if (!dataStreamType) { - return true; - } else { - return stream.name.startsWith(`${dataStreamType}-`); + if (dataStreamType && !stream.name.startsWith(`${dataStreamType}-`)) { + return false; } + + if (filterActiveDatastreamsName) { + const patternRegex = new minimatch.Minimatch(stream.name, { + noglobstar: true, + nonegate: true, + }).makeRe(); + + return filterActiveDatastreamsName.some((dataStreamName) => + dataStreamName.match(patternRegex) + ); + } + + return true; }); } diff --git a/x-pack/plugins/fleet/server/types/rest_spec/epm.ts b/x-pack/plugins/fleet/server/types/rest_spec/epm.ts index 358d2c8d6345d..8f2ffe24fcf2a 100644 --- a/x-pack/plugins/fleet/server/types/rest_spec/epm.ts +++ b/x-pack/plugins/fleet/server/types/rest_spec/epm.ts @@ -35,6 +35,7 @@ export const GetInstalledPackagesRequestSchema = { schema.literal('profiling'), ]) ), + showOnlyActiveDataStreams: schema.maybe(schema.boolean()), nameQuery: schema.maybe(schema.string()), searchAfter: schema.maybe(schema.arrayOf(schema.oneOf([schema.string(), schema.number()]))), perPage: schema.number({ defaultValue: 15 }), diff --git a/x-pack/test/fleet_api_integration/apis/epm/get.ts b/x-pack/test/fleet_api_integration/apis/epm/get.ts index 90247a730df17..6f1edcd6aca10 100644 --- a/x-pack/test/fleet_api_integration/apis/epm/get.ts +++ b/x-pack/test/fleet_api_integration/apis/epm/get.ts @@ -18,6 +18,7 @@ export default function (providerContext: FtrProviderContext) { const { getService } = providerContext; const supertest = getService('supertest'); + const es = getService('es'); const supertestWithoutAuth = getService('supertestWithoutAuth'); const fleetAndAgents = getService('fleetAndAgents'); @@ -117,12 +118,22 @@ export default function (providerContext: FtrProviderContext) { await installPackage('experimental', '0.1.0'); await bundlePackage('endpoint-8.6.1'); await installPackage('endpoint', '8.6.1'); + await es.index({ + index: 'logs-apache.access-default', + document: { + '@timestamp': new Date().toISOString(), + }, + refresh: 'wait_for', + }); }); after(async () => { await uninstallPackage(testPkgName, testPkgVersion); await uninstallPackage('experimental', '0.1.0'); await uninstallPackage('endpoint', '8.6.1'); await removeBundledPackages(log); + await es.indices.deleteDataStream({ + name: 'logs-apache.access-default', + }); }); it('Allows the fetching of installed packages', async () => { const res = await supertest.get(`/api/fleet/epm/packages/installed`).expect(200); @@ -173,6 +184,16 @@ export default function (providerContext: FtrProviderContext) { expect(packages.length).to.be(1); expect(packages[0].name).to.be('experimental'); }); + it('Can be to only return active datastreams', async () => { + const res = await supertest + .get(`/api/fleet/epm/packages/installed?nameQuery=apache&showOnlyActiveDataStreams=true`) + .expect(200); + const packages = res.body.items; + expect(packages.length).to.be(1); + expect(packages[0].name).to.be('apache'); + expect(packages[0].dataStreams.length).to.be(1); + expect(packages[0].dataStreams[0].name).to.be('logs-apache.access-*'); + }); }); it('returns a 404 for a package that do not exists', async function () { await supertest.get('/api/fleet/epm/packages/notexists/99.99.99').expect(404); From b31d119e5532c362c44a134547f461fd7db56770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20=C3=81brah=C3=A1m?= Date: Fri, 13 Sep 2024 18:59:44 +0200 Subject: [PATCH 004/129] [Defend Workflows] Fix bug when event filter value cannot be changed without using {backspace} (#192196) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary This PR does 2 things around editing the value field for an Event Filter. 1. It fixes the issue when during editing an existing Event Filter you cannot update the value without pressing {backspace}, by clearing selection when user is typing: 5da28aa25404e6a2bdc8a2e9cfce2f6546976d07 Before: ![before](https://github.com/user-attachments/assets/7355c788-a9fd-4ea5-81b3-89ae41db2ee7) ➡️ After: ![after](https://github.com/user-attachments/assets/aa928fa4-6203-4fad-8f9b-4e586ac4d562) 2. Improves suggestions: before the change, suggestions were there initially, but after they are narrowed down by typing, they won't be displayed again after the user clears the input field. Therefore f9d60cf223644a3072d1a60fe273586338247b96 sets the suggestion search query unconditionally, helping with this issue. Before: ![before](https://github.com/user-attachments/assets/87ccfba6-5b9d-4976-a5af-13c3d56db373) ➡️ After: ![after](https://github.com/user-attachments/assets/c21a909c-4b45-470e-9e77-9edc269f07f7) ### Checklist Delete any items that are not applicable to this PR. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Elastic Machine --- .../src/field_value_match/index.test.tsx | 121 +++++++++++++----- .../src/field_value_match/index.tsx | 20 ++- .../cypress/e2e/artifacts/event_filters.cy.ts | 87 +++++++++++++ .../cypress/fixtures/artifacts_page.ts | 6 +- 4 files changed, 200 insertions(+), 34 deletions(-) create mode 100644 x-pack/plugins/security_solution/public/management/cypress/e2e/artifacts/event_filters.cy.ts diff --git a/packages/kbn-securitysolution-autocomplete/src/field_value_match/index.test.tsx b/packages/kbn-securitysolution-autocomplete/src/field_value_match/index.test.tsx index 1247a9cd3d5bd..e83d79b180e90 100644 --- a/packages/kbn-securitysolution-autocomplete/src/field_value_match/index.test.tsx +++ b/packages/kbn-securitysolution-autocomplete/src/field_value_match/index.test.tsx @@ -32,6 +32,13 @@ describe('AutocompleteFieldMatchComponent', () => { .fn() .mockResolvedValue([false, true, ['value 3', 'value 4'], jest.fn()]); + const findEuiComboBox = () => + wrapper.find(EuiComboBox).props() as unknown as { + onChange: (a: EuiComboBoxOptionOption[]) => void; + onSearchChange: (a: string) => void; + onCreateOption: (a: string) => void; + }; + beforeEach(() => { (useFieldValueAutocomplete as jest.Mock).mockReturnValue([ false, @@ -171,7 +178,7 @@ describe('AutocompleteFieldMatchComponent', () => { ).toEqual('127.0.0.1'); }); - test('it invokes "onChange" when new value created', async () => { + test('it invokes "onChange" when new value created', () => { const mockOnChange = jest.fn(); wrapper = mount( { /> ); - ( - wrapper.find(EuiComboBox).props() as unknown as { - onCreateOption: (a: string) => void; - } - ).onCreateOption('127.0.0.1'); + findEuiComboBox().onCreateOption('127.0.0.1'); expect(mockOnChange).toHaveBeenCalledWith('127.0.0.1'); }); - test('it invokes "onChange" when new value selected', async () => { + test('it invokes "onChange" when new value selected', () => { const mockOnChange = jest.fn(); wrapper = mount( { /> ); - ( - wrapper.find(EuiComboBox).props() as unknown as { - onChange: (a: EuiComboBoxOptionOption[]) => void; - } - ).onChange([{ label: 'value 1' }]); + findEuiComboBox().onChange([{ label: 'value 1' }]); expect(mockOnChange).toHaveBeenCalledWith('value 1'); }); + test('it invokes "onChange" with empty value (i.e. clears selection) when new value searched', () => { + const mockOnChange = jest.fn(); + wrapper = mount( + + ); + + act(() => { + findEuiComboBox().onSearchChange('value 12'); + }); + + expect(mockOnChange).toHaveBeenCalledWith(''); + }); + test('should show the warning helper text if the new value contains spaces when change', async () => { (useFieldValueAutocomplete as jest.Mock).mockReturnValue([ false, @@ -259,13 +286,7 @@ describe('AutocompleteFieldMatchComponent', () => { /> ); - await waitFor(() => - ( - wrapper.find(EuiComboBox).props() as unknown as { - onChange: (a: EuiComboBoxOptionOption[]) => void; - } - ).onChange([{ label: ' value 1 ' }]) - ); + await waitFor(() => findEuiComboBox().onChange([{ label: ' value 1 ' }])); wrapper.update(); expect(mockOnChange).toHaveBeenCalledWith(' value 1 '); @@ -293,11 +314,7 @@ describe('AutocompleteFieldMatchComponent', () => { /> ); act(() => { - ( - wrapper.find(EuiComboBox).props() as unknown as { - onSearchChange: (a: string) => void; - } - ).onSearchChange('value 1'); + findEuiComboBox().onSearchChange('value 1'); }); expect(useFieldValueAutocomplete).toHaveBeenCalledWith({ @@ -313,6 +330,54 @@ describe('AutocompleteFieldMatchComponent', () => { selectedField: getField('machine.os.raw'), }); }); + + test('it refreshes autocomplete with search query when input field is cleared', () => { + wrapper = mount( + + ); + + act(() => { + findEuiComboBox().onSearchChange('value 1'); + }); + act(() => { + findEuiComboBox().onSearchChange(''); + }); + + // 1st call is initial render, 2nd call sets the search query: + expect(useFieldValueAutocomplete).toHaveBeenNthCalledWith(2, { + autocompleteService: autocompleteStartMock, + fieldValue: 'windows', + indexPattern: { fields, id: '1234', title: 'logstash-*' }, + operatorType: 'match', + query: 'value 1', + selectedField: getField('machine.os.raw'), + }); + // last call is the refresh when input field is cleared + expect(useFieldValueAutocomplete).toHaveBeenLastCalledWith({ + autocompleteService: autocompleteStartMock, + fieldValue: 'windows', + indexPattern: { fields, id: '1234', title: 'logstash-*' }, + operatorType: 'match', + query: '', + selectedField: getField('machine.os.raw'), + }); + }); + test('should show the warning helper text if the new value contains spaces when searching a new query', () => { wrapper = mount( { /> ); act(() => { - ( - wrapper.find(EuiComboBox).props() as unknown as { - onSearchChange: (a: string) => void; - } - ).onSearchChange(' value 1'); + findEuiComboBox().onSearchChange(' value 1'); }); wrapper.update(); @@ -345,6 +406,7 @@ describe('AutocompleteFieldMatchComponent', () => { expect(euiFormHelptext.length).toBeTruthy(); expect(euiFormHelptext.text()).toEqual('Warning: there is a space'); }); + test('should show the warning helper text if selectedValue contains spaces when editing', () => { wrapper = mount( { expect(euiFormHelptext.length).toBeTruthy(); expect(euiFormHelptext.text()).toEqual('Warning: there is a space'); }); + test('should not show the warning helper text if selectedValue is falsy', () => { wrapper = mount( { + let endpointData: ReturnTypeFromChainable | undefined; + + const CONDITION_VALUE = 'valuesAutocompleteMatch'; + const SUBMIT_BUTTON = 'EventFiltersListPage-flyout-submitButton'; + + before(() => { + indexEndpointHosts().then((indexEndpoints) => { + endpointData = indexEndpoints; + }); + }); + + after(() => { + removeAllArtifacts(); + + endpointData?.cleanup(); + endpointData = undefined; + }); + + beforeEach(() => { + removeAllArtifacts(); + }); + + describe('when editing event filter value', () => { + let eventFiltersMock: ArtifactsFixtureType; + beforeEach(() => { + login(); + + eventFiltersMock = getArtifactsListTestsData().find( + ({ tabId }) => tabId === 'eventFilters' + ) as ArtifactsFixtureType; + + createArtifactList(eventFiltersMock.createRequestBody.list_id); + createPerPolicyArtifact(eventFiltersMock.artifactName, eventFiltersMock.createRequestBody); + + loadPage(APP_EVENT_FILTERS_PATH); + + cy.getByTestSubj('EventFiltersListPage-card-header-actions-button').click(); + cy.getByTestSubj('EventFiltersListPage-card-cardEditAction').click(); + cy.getByTestSubj('EventFiltersListPage-flyout').should('exist'); + }); + + it('should be able to modify after deleting value with {backspace}', () => { + cy.getByTestSubj(CONDITION_VALUE).type(' {backspace}.lnk{enter}'); + cy.getByTestSubj(SUBMIT_BUTTON).click(); + + cy.getByTestSubj('EventFiltersListPage-flyout').should('not.exist'); + cy.contains('notepad.exe.lnk'); + }); + + it('should be able to modify without using {backspace}', () => { + cy.getByTestSubj(CONDITION_VALUE).type('.lnk{enter}'); + cy.getByTestSubj(SUBMIT_BUTTON).click(); + + cy.getByTestSubj('EventFiltersListPage-flyout').should('not.exist'); + cy.contains('notepad.exe.lnk'); + }); + + it('should show suggestions when filter value is cleared', () => { + cy.getByTestSubj(CONDITION_VALUE).clear(); + cy.getByTestSubj(CONDITION_VALUE).type('aaaaaaaaaaaaaa as custom input'); + cy.get('button[role="option"]').should('have.length', 0); + + cy.getByTestSubj(CONDITION_VALUE).find('input').clear(); + cy.get('button[role="option"]').should('have.length.above', 1); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/public/management/cypress/fixtures/artifacts_page.ts b/x-pack/plugins/security_solution/public/management/cypress/fixtures/artifacts_page.ts index 97a6807a59f0a..2113347bfc446 100644 --- a/x-pack/plugins/security_solution/public/management/cypress/fixtures/artifacts_page.ts +++ b/x-pack/plugins/security_solution/public/management/cypress/fixtures/artifacts_page.ts @@ -17,7 +17,7 @@ interface FormEditingDescription { }>; } -interface ArtifactsFixtureType { +export interface ArtifactsFixtureType { title: string; pagePrefix: string; tabId: string; @@ -275,10 +275,10 @@ export const getArtifactsListTestsData = (): ArtifactsFixtureType[] => [ list_id: ENDPOINT_ARTIFACT_LISTS.eventFilters.id, entries: [ { - field: 'agent.id', + field: 'process.name', operator: 'included', type: 'match', - value: 'mr agent', + value: 'notepad.exe', }, ], os_types: ['windows'], From 36eedc121bff8d83fc6a4590f468397f56d0bd14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20C=C3=B4t=C3=A9?= Date: Fri, 13 Sep 2024 14:40:29 -0400 Subject: [PATCH 005/129] Fix bug in calculating when ad-hoc tasks are out of attempts (#192907) In this PR, I'm fixing a bug where ad-hoc tasks would have one fewer attempts to retry in failure scenarios when using mget. ## To verify 1. Apply the following diff to your code ``` diff --git a/x-pack/plugins/stack_connectors/server/connector_types/server_log/index.ts b/x-pack/plugins/stack_connectors/server/connector_types/server_log/index.ts index 0275b2bdc2f..d481c3820a1 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/server_log/index.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/server_log/index.ts @@ -77,6 +77,10 @@ export function getConnectorType(): ServerLogConnectorType { async function executor( execOptions: ServerLogConnectorTypeExecutorOptions ): Promise> { + + console.log('*** Server log execution'); + throw new Error('Fail'); + const { actionId, params, logger } = execOptions; const sanitizedMessage = withoutControlCharacters(params.message); diff --git a/x-pack/plugins/task_manager/server/config.ts b/x-pack/plugins/task_manager/server/config.ts index db07494ef4f..07e277f8d16 100644 --- a/x-pack/plugins/task_manager/server/config.ts +++ b/x-pack/plugins/task_manager/server/config.ts @@ -202,7 +202,7 @@ export const configSchema = schema.object( max: 100, min: 1, }), - claim_strategy: schema.string({ defaultValue: CLAIM_STRATEGY_UPDATE_BY_QUERY }), + claim_strategy: schema.string({ defaultValue: CLAIM_STRATEGY_MGET }), request_timeouts: requestTimeoutsConfig, }, { diff --git a/x-pack/plugins/task_manager/server/lib/get_retry_at.ts b/x-pack/plugins/task_manager/server/lib/get_retry_at.ts index 278ba18642d..c8fb911d500 100644 --- a/x-pack/plugins/task_manager/server/lib/get_retry_at.ts +++ b/x-pack/plugins/task_manager/server/lib/get_retry_at.ts @@ -54,6 +54,7 @@ export function getRetryDate({ } export function calculateDelayBasedOnAttempts(attempts: number) { + return 10 * 1000; // Return 30s for the first retry attempt if (attempts === 1) { return 30 * 1000; ``` 2. Create an always firing rule that runs every hour, triggering a server log on check intervals 3. Let the rule run and observe the server log action running and failing three times (as compared to two) --- .../server/task_running/task_runner.test.ts | 26 +++++++++++++++++++ .../server/task_running/task_runner.ts | 4 +++ 2 files changed, 30 insertions(+) diff --git a/x-pack/plugins/task_manager/server/task_running/task_runner.test.ts b/x-pack/plugins/task_manager/server/task_running/task_runner.test.ts index fd9d8363eb5c2..35aa255341f97 100644 --- a/x-pack/plugins/task_manager/server/task_running/task_runner.test.ts +++ b/x-pack/plugins/task_manager/server/task_running/task_runner.test.ts @@ -2304,6 +2304,32 @@ describe('TaskManagerRunner', () => { expect(runner.isAdHocTaskAndOutOfAttempts).toEqual(true); }); + + it(`should return true if attempts = max attempts and in claiming status`, async () => { + const { runner } = await pendingStageSetup({ + instance: { + id: 'foo', + taskType: 'testbar', + attempts: 5, + status: TaskStatus.Claiming, + }, + }); + + expect(runner.isAdHocTaskAndOutOfAttempts).toEqual(true); + }); + + it(`should return false if attempts = max attempts and in running status`, async () => { + const { runner } = await pendingStageSetup({ + instance: { + id: 'foo', + taskType: 'testbar', + attempts: 5, + status: TaskStatus.Running, + }, + }); + + expect(runner.isAdHocTaskAndOutOfAttempts).toEqual(false); + }); }); describe('removeTask()', () => { diff --git a/x-pack/plugins/task_manager/server/task_running/task_runner.ts b/x-pack/plugins/task_manager/server/task_running/task_runner.ts index 002fcfec1a41e..f125aee5952ce 100644 --- a/x-pack/plugins/task_manager/server/task_running/task_runner.ts +++ b/x-pack/plugins/task_manager/server/task_running/task_runner.ts @@ -294,6 +294,10 @@ export class TaskManagerRunner implements TaskRunner { * running a task, the task should be deleted instead of ran. */ public get isAdHocTaskAndOutOfAttempts() { + if (this.instance.task.status === 'running') { + // This function gets called with tasks marked as running when using MGET, so attempts is already incremented + return !this.instance.task.schedule && this.instance.task.attempts > this.getMaxAttempts(); + } return !this.instance.task.schedule && this.instance.task.attempts >= this.getMaxAttempts(); } From e0b5bdcb1350b2d51be9afc4659b95173c1c53b6 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Sat, 14 Sep 2024 05:26:54 +1000 Subject: [PATCH 006/129] skip failing test suite (#192510) --- test/plugin_functional/test_suites/data_plugin/session.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/plugin_functional/test_suites/data_plugin/session.ts b/test/plugin_functional/test_suites/data_plugin/session.ts index 812641e508d2c..d69a7529a19ad 100644 --- a/test/plugin_functional/test_suites/data_plugin/session.ts +++ b/test/plugin_functional/test_suites/data_plugin/session.ts @@ -32,7 +32,8 @@ export default function ({ getService, getPageObjects }: PluginFunctionalProvide return sessionIds.split(','); }; - describe('Session management', function describeSessionManagementTests() { + // Failing: See https://github.com/elastic/kibana/issues/192510 + describe.skip('Session management', function describeSessionManagementTests() { describe('Discover', () => { before(async () => { await common.navigateToApp('discover'); From a27a044e8b6a0a88d3e0dfb7d324c2e6290ecaac Mon Sep 17 00:00:00 2001 From: Juan Pablo Djeredjian Date: Fri, 13 Sep 2024 22:47:21 +0200 Subject: [PATCH 007/129] [Security Solution] Hide Rule Upgrade disabling behind Prebuilt Rule Customization FF (#192919) ## Summary With the merge of https://github.com/elastic/kibana/pull/191721, new logic was introduce to disable the Upgrade rule button in the Rule Upgrade table for rules which have conflicts in any of their fields. **This change should be hidden behind a FF.** Otherwise the UI upgrade flow might break for any users who might have customized the rule via API and generated conflicts. --- .../upgrade_prebuilt_rules_table_context.tsx | 7 +++- ...e_upgrade_prebuilt_rules_table_columns.tsx | 32 ++++++++++++++++--- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/upgrade_prebuilt_rules_table/upgrade_prebuilt_rules_table_context.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/upgrade_prebuilt_rules_table/upgrade_prebuilt_rules_table_context.tsx index 4fee1cf8f3560..efd63e5da6872 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/upgrade_prebuilt_rules_table/upgrade_prebuilt_rules_table_context.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/upgrade_prebuilt_rules_table/upgrade_prebuilt_rules_table_context.tsx @@ -75,11 +75,14 @@ export interface UpgradePrebuiltRulesTableState { * List of rule IDs that are currently being upgraded */ loadingRules: RuleSignatureId[]; - /** /** * The timestamp for when the rules were successfully fetched */ lastUpdated: number; + /** + * Feature Flag to enable prebuilt rules customization + */ + isPrebuiltRulesCustomizationEnabled: boolean; } export const PREBUILT_RULE_UPDATE_FLYOUT_ANCHOR = 'updatePrebuiltRulePreview'; @@ -315,6 +318,7 @@ export const UpgradePrebuiltRulesTableContextProvider = ({ isUpgradingSecurityPackages, loadingRules, lastUpdated: dataUpdatedAt, + isPrebuiltRulesCustomizationEnabled, }, actions, }; @@ -331,6 +335,7 @@ export const UpgradePrebuiltRulesTableContextProvider = ({ loadingRules, dataUpdatedAt, actions, + isPrebuiltRulesCustomizationEnabled, ]); return ( diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/upgrade_prebuilt_rules_table/use_upgrade_prebuilt_rules_table_columns.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/upgrade_prebuilt_rules_table/use_upgrade_prebuilt_rules_table_columns.tsx index 5552145de7b68..e7267007d2348 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/upgrade_prebuilt_rules_table/use_upgrade_prebuilt_rules_table_columns.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/upgrade_prebuilt_rules_table/use_upgrade_prebuilt_rules_table_columns.tsx @@ -107,13 +107,16 @@ const INTEGRATIONS_COLUMN: TableColumn = { const createUpgradeButtonColumn = ( upgradeRules: UpgradePrebuiltRulesTableActions['upgradeRules'], loadingRules: RuleSignatureId[], - isDisabled: boolean + isDisabled: boolean, + isPrebuiltRulesCustomizationEnabled: boolean ): TableColumn => ({ field: 'rule_id', name: , render: (ruleId: RuleSignatureId, record) => { const isRuleUpgrading = loadingRules.includes(ruleId); - const isUpgradeButtonDisabled = isRuleUpgrading || isDisabled || record.hasUnresolvedConflicts; + const isDisabledByConflicts = + isPrebuiltRulesCustomizationEnabled && record.hasUnresolvedConflicts; + const isUpgradeButtonDisabled = isRuleUpgrading || isDisabled || isDisabledByConflicts; const spinner = ( { const hasCRUDPermissions = hasUserCRUDPermission(canUserCRUD); const [showRelatedIntegrations] = useUiSetting$(SHOW_RELATED_INTEGRATIONS_SETTING); const { - state: { loadingRules, isRefetching, isUpgradingSecurityPackages }, + state: { + loadingRules, + isRefetching, + isUpgradingSecurityPackages, + isPrebuiltRulesCustomizationEnabled, + }, actions: { upgradeRules }, } = useUpgradePrebuiltRulesTableContext(); const isDisabled = isRefetching || isUpgradingSecurityPackages; @@ -173,9 +181,23 @@ export const useUpgradePrebuiltRulesTableColumns = (): TableColumn[] => { width: '12%', }, ...(hasCRUDPermissions - ? [createUpgradeButtonColumn(upgradeRules, loadingRules, isDisabled)] + ? [ + createUpgradeButtonColumn( + upgradeRules, + loadingRules, + isDisabled, + isPrebuiltRulesCustomizationEnabled + ), + ] : []), ], - [hasCRUDPermissions, loadingRules, isDisabled, showRelatedIntegrations, upgradeRules] + [ + hasCRUDPermissions, + loadingRules, + isDisabled, + showRelatedIntegrations, + upgradeRules, + isPrebuiltRulesCustomizationEnabled, + ] ); }; From 48de1a57e726f570feefe37e211d0b79033b1b75 Mon Sep 17 00:00:00 2001 From: Ersin Erdal <92688503+ersin-erdal@users.noreply.github.com> Date: Fri, 13 Sep 2024 23:48:05 +0200 Subject: [PATCH 008/129] Convert timestamp before passing to validation (#192379) Resolves: #186114 This PR adds a utility function to `stack_connectors` plugin to convert given date string or number (epoch) to proper type before passing to Date object or validation functions. --- .../lib/convert_timestamp.test.ts | 58 +++++++++++++++++++ .../connector_types/lib/convert_timestamp.ts | 26 +++++++++ .../server/connector_types/pagerduty/index.ts | 18 ++---- .../connector_types/servicenow_itom/api.ts | 6 +- 4 files changed, 94 insertions(+), 14 deletions(-) create mode 100644 x-pack/plugins/stack_connectors/server/connector_types/lib/convert_timestamp.test.ts create mode 100644 x-pack/plugins/stack_connectors/server/connector_types/lib/convert_timestamp.ts diff --git a/x-pack/plugins/stack_connectors/server/connector_types/lib/convert_timestamp.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/lib/convert_timestamp.test.ts new file mode 100644 index 0000000000000..1ff43c2e225d3 --- /dev/null +++ b/x-pack/plugins/stack_connectors/server/connector_types/lib/convert_timestamp.test.ts @@ -0,0 +1,58 @@ +/* + * 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 { convertTimestamp } from './convert_timestamp'; + +describe('convert_timestamp', () => { + const stringDate = '2024-09-06T11:10:24.681Z'; + const stringDateWithSlash = '2019/05/15'; + const stringDateWithDot = '10.12.1979'; + const anyString = 'asdfgh'; + const anyStringWithNumber = '123asdfghjkl'; + const epochDate = 1725880672; + const stringifiedEpochDate = '1725880672'; + + it('should return a string date as it is', () => { + expect(convertTimestamp(stringDate)).toBe(stringDate); + }); + + it('should return any string as it is', () => { + expect(convertTimestamp(anyString)).toBe(anyString); + }); + + it('should return any string date with slash as it is', () => { + expect(convertTimestamp(stringDateWithSlash)).toBe(stringDateWithSlash); + }); + + it('should return any string date with dot as it is', () => { + expect(convertTimestamp(stringDateWithDot)).toBe(stringDateWithDot); + }); + + it('should return any string with some numbers in it as it is', () => { + expect(convertTimestamp(anyStringWithNumber)).toBe(anyStringWithNumber); + }); + + it('should return a number if the input is a stringified number', () => { + expect(convertTimestamp('12345678')).toBe(12345678); + }); + + it('should return an epoch date as it is', () => { + expect(convertTimestamp(epochDate)).toBe(epochDate); + }); + + it('should return a stringified epoch date as number', () => { + expect(convertTimestamp(stringifiedEpochDate)).toBe(epochDate); + }); + + it('should return null if timestamp is not passed', () => { + expect(convertTimestamp()).toBe(null); + }); + + it('should return null if timestamp is null', () => { + expect(convertTimestamp(null)).toBe(null); + }); +}); diff --git a/x-pack/plugins/stack_connectors/server/connector_types/lib/convert_timestamp.ts b/x-pack/plugins/stack_connectors/server/connector_types/lib/convert_timestamp.ts new file mode 100644 index 0000000000000..3df7c18704a95 --- /dev/null +++ b/x-pack/plugins/stack_connectors/server/connector_types/lib/convert_timestamp.ts @@ -0,0 +1,26 @@ +/* + * 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. + */ + +export function convertTimestamp(timestamp?: string | number | null): string | number | null { + if (timestamp) { + if (typeof timestamp === 'string') { + const trimmedTimestamp = timestamp.trim(); + if (trimmedTimestamp.length > 0) { + const parsedTimestamp = parseInt(trimmedTimestamp, 10); + + if (!isNaN(parsedTimestamp) && JSON.stringify(parsedTimestamp) === trimmedTimestamp) { + return parsedTimestamp; // return converted epoch + } + return trimmedTimestamp; // return string + } + } + if (typeof timestamp === 'number') { + return timestamp; // return epoch + } + } + return null; +} diff --git a/x-pack/plugins/stack_connectors/server/connector_types/pagerduty/index.ts b/x-pack/plugins/stack_connectors/server/connector_types/pagerduty/index.ts index c4d2444540cad..15d72d78a511b 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/pagerduty/index.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/pagerduty/index.ts @@ -21,6 +21,7 @@ import { SecurityConnectorFeatureId, } from '@kbn/actions-plugin/common/types'; import { postPagerduty } from './post_pagerduty'; +import { convertTimestamp } from '../lib/convert_timestamp'; // uses the PagerDuty Events API v2 // https://v2.developer.pagerduty.com/docs/events-api-v2 @@ -99,19 +100,12 @@ export const ParamsSchema = schema.object( { validate: validateParams } ); -function validateTimestamp(timestamp?: string): string | null { - if (timestamp) { - return timestamp.trim().length > 0 ? timestamp.trim() : null; - } - return null; -} - function validateParams(paramsObject: unknown): string | void { const { timestamp, eventAction, dedupKey } = paramsObject as ActionParamsType; - const validatedTimestamp = validateTimestamp(timestamp); - if (validatedTimestamp != null) { + const convertedTimestamp = convertTimestamp(timestamp); + if (convertedTimestamp != null) { try { - const date = moment(validatedTimestamp); + const date = moment(convertedTimestamp); if (!date.isValid()) { return i18n.translate('xpack.stackConnectors.pagerduty.invalidTimestampErrorMessage', { defaultMessage: `error parsing timestamp "{timestamp}"`, @@ -327,13 +321,13 @@ function getBodyForEventAction(actionId: string, params: ActionParamsType): Page return data; } - const validatedTimestamp = validateTimestamp(params.timestamp); + const convertedTimestamp = convertTimestamp(params.timestamp); data.payload = { summary: params.summary || 'No summary provided.', source: params.source || `Kibana Action ${actionId}`, severity: params.severity || 'info', - ...(validatedTimestamp ? { timestamp: moment(validatedTimestamp).toISOString() } : {}), + ...(convertedTimestamp ? { timestamp: moment(convertedTimestamp).toISOString() } : {}), ...omitBy(pick(params, ['component', 'group', 'class']), isUndefined), ...(params.customDetails ? { custom_details: params.customDetails } : {}), }; diff --git a/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.ts b/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.ts index c68f1d4419eb1..eb417cf8e353d 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/servicenow_itom/api.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { convertTimestamp } from '../lib/convert_timestamp'; import { api as commonApi } from '../lib/servicenow/api'; import { ExecutorSubActionAddEventParams, @@ -15,8 +16,9 @@ import { const isValidDate = (d: Date) => !isNaN(d.valueOf()); const formatTimeOfEvent = (timeOfEvent: string | null): string | undefined => { - if (timeOfEvent != null) { - const date = new Date(timeOfEvent); + const convertedTimestamp = convertTimestamp(timeOfEvent); + if (convertedTimestamp != null) { + const date = new Date(convertedTimestamp); return isValidDate(date) ? // The format is: yyyy-MM-dd HH:mm:ss GMT From 4efcc28d7853f8274fe8c7e29d8da7749b4b07b4 Mon Sep 17 00:00:00 2001 From: Ryland Herrick Date: Fri, 13 Sep 2024 17:47:12 -0500 Subject: [PATCH 009/129] [Chore] Remove third-party testing internals from test snapshots (#192747) ## Summary This removes some indavertent testing of third-party APIs/implementations caused by directly passing the result of a `render()` call to `toMatchSnapshot()`. In all cases, this was solved by passing `render().container` (the root element rendered by the testing library) instead. These changes remove implementation details of both styled-components (#192368 being the reason for this commit) and testing-library from the snapshots. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --- .../__snapshots__/index.test.tsx.snap | 743 ++---- .../src/field/__tests__/index.test.tsx | 8 +- .../__snapshots__/comments.test.tsx.snap | 802 ++---- .../comments/comments.test.tsx | 6 +- .../__snapshots__/entry_content.test.tsx.snap | 170 +- .../entry_content/entry_content.test.tsx | 2 +- .../__snapshots__/os_conditions.test.tsx.snap | 529 +--- .../os_conditions/os_conditions.test.tsx | 8 +- .../__snapshots__/details_info.test.tsx.snap | 418 +-- .../meta/details_info/details_info.test.tsx | 4 +- ...erate_linked_rules_menu_item.test.tsx.snap | 266 +- .../generate_linked_rules_menu_item.test.tsx | 4 +- .../__snapshots__/header_menu.test.tsx.snap | 960 ++----- .../src/header_menu/header_menu.test.tsx | 14 +- .../__snapshots__/list_header.test.tsx.snap | 2351 ++++------------- .../__snapshots__/edit_modal.test.tsx.snap | 224 +- .../edit_modal/edit_modal.test.tsx | 2 +- .../src/list_header/list_header.test.tsx | 8 +- .../__snapshots__/menu_items.test.tsx.snap | 1247 ++------- .../menu_items/menu_items.test.tsx | 10 +- .../text_with_edit.test.tsx.snap | 240 +- .../text_with_edit/text_with_edit.test.tsx | 4 +- .../__snapshots__/index.test.tsx.snap | 1416 +++------- .../breadcrumb/index.test.tsx | 8 +- .../__snapshots__/index.test.tsx.snap | 733 +---- .../action_connectors_warning.test.tsx.snap | 758 +----- .../action_connectors_warning.test.tsx | 10 +- .../import_data_modal/index.test.tsx | 6 +- .../value_with_space_warning.test.tsx.snap | 219 +- .../value_with_space_warning.test.tsx | 6 +- .../__snapshots__/index.test.tsx.snap | 94 +- .../detail_panel_copy/index.test.tsx | 2 +- .../__snapshots__/index.test.tsx.snap | 279 +- .../process_tree_alert/index.test.tsx | 2 +- 34 files changed, 2189 insertions(+), 9364 deletions(-) diff --git a/packages/kbn-securitysolution-autocomplete/src/field/__tests__/__snapshots__/index.test.tsx.snap b/packages/kbn-securitysolution-autocomplete/src/field/__tests__/__snapshots__/index.test.tsx.snap index 87aab754d5867..4ab1374ec2565 100644 --- a/packages/kbn-securitysolution-autocomplete/src/field/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/kbn-securitysolution-autocomplete/src/field/__tests__/__snapshots__/index.test.tsx.snap @@ -1,659 +1,224 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`FieldComponent should allow user to clear values if isClearable is true 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
+
+
+
-
-
- -
-
- - -
-
+
-
-
-
- , - "container":
-
-
-
-
- -
-
+ - -
+
-
, - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
+
`; exports[`FieldComponent should render the component disabled if isDisabled is true 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
-
-
-
-
-
- -
-
-
-
-
-
- , - "container":
+
+
-
- -
+
-
, - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
+
`; exports[`FieldComponent should render the component enabled and displays the selected field correctly 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
+
+
+
-
-
- -
-
- -
-
+
-
-
-
- , - "container":
-
-
-
-
- -
-
- -
+
-
, - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
+
`; exports[`FieldComponent should render the loading spinner if isLoading is true when clicked 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
+
+
+
-
-
- -
-
- -
-
+
-
-
-
- , - "container":
-
-
-
-
- -
-
- -
+
-
, - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
+
`; diff --git a/packages/kbn-securitysolution-autocomplete/src/field/__tests__/index.test.tsx b/packages/kbn-securitysolution-autocomplete/src/field/__tests__/index.test.tsx index e028a83ce1423..b795abc5842f2 100644 --- a/packages/kbn-securitysolution-autocomplete/src/field/__tests__/index.test.tsx +++ b/packages/kbn-securitysolution-autocomplete/src/field/__tests__/index.test.tsx @@ -31,7 +31,7 @@ describe('FieldComponent', () => { selectedField={getField('machine.os.raw')} /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); const comboBox = wrapper.getByTestId('fieldAutocompleteComboBox'); const input = within(comboBox).getByRole('combobox'); expect(input).toHaveAttribute('value', 'machine.os.raw'); @@ -52,7 +52,7 @@ describe('FieldComponent', () => { selectedField={getField('machine.os.raw')} /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('fieldAutocompleteComboBox').querySelector('input')).toBeDisabled(); }); it('should render the loading spinner if isLoading is true when clicked', () => { @@ -72,7 +72,7 @@ describe('FieldComponent', () => { /> ); const fieldAutocompleteComboBox = wrapper.getByTestId('fieldAutocompleteComboBox'); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); fireEvent.click(fieldAutocompleteComboBox); expect(wrapper.getByRole('progressbar')).toBeInTheDocument(); }); @@ -92,7 +92,7 @@ describe('FieldComponent', () => { selectedField={getField('machine.os.raw')} /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('comboBoxClearButton')).toBeInTheDocument(); }); it('should change the selected value', async () => { diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/__snapshots__/comments.test.tsx.snap b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/__snapshots__/comments.test.tsx.snap index e14bdac01aa70..eb0c393848fa0 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/__snapshots__/comments.test.tsx.snap +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/__snapshots__/comments.test.tsx.snap @@ -1,722 +1,280 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`ExceptionItemCardComments should not render comments when the length is falsy 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
- , - "container":
, - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; +exports[`ExceptionItemCardComments should not render comments when the length is falsy 1`] = `
`; exports[`ExceptionItemCardComments should render comments panel closed 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
+
+
+
- + +
-
- , - "container":
-
- -
-
-
-
    -
  1. +
+
-
-

- some old comment -

-
+

+ some old comment +

- -
  • +
  • +
  • +
    +
    +
    -
    -

    - some old comment -

    -
    +

    + some old comment +

    -
  • - -
    +
    + +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; exports[`ExceptionItemCardComments should render comments panel opened when accordion is clicked 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    +
    +
    +
    -
    -
    - -
    -
    -
    -
      -
    1. -
      -
      - -
      -
      -
      -
      -
      -

      - some old comment -

      -
      -
      -
      -
    2. -
    3. -
      -
      - -
      -
      -
      -
      -
      -

      - some old comment -

      -
      -
      -
      -
    4. -
    -
    + Show comments (2)
    -
    -
    + +
    -
    - , - "container":
    -
    - -
    -
    -
    -
      -
    1. +
    +
    -
    -

    - some old comment -

    -
    +

    + some old comment +

    - -
  • +
  • +
  • +
    +
    +
    -
    -

    - some old comment -

    -
    +

    + some old comment +

    -
  • - -
    +
    + +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/comments.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/comments.test.tsx index 9cedd50ab6171..c8c8e92cd6c70 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/comments.test.tsx +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/comments.test.tsx @@ -19,7 +19,7 @@ describe('ExceptionItemCardComments', () => { const wrapper = render( ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.queryByTestId('ExceptionItemCardCommentsContainer')).not.toBeInTheDocument(); }); @@ -31,7 +31,7 @@ describe('ExceptionItemCardComments', () => { dataTestSubj="ExceptionItemCardCommentsContainer" /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('ExceptionItemCardCommentsContainer')).toHaveTextContent( i18n.exceptionItemCardCommentsAccordion(comments.length) @@ -52,6 +52,6 @@ describe('ExceptionItemCardComments', () => { expect(wrapper.getByTestId('accordionContentPanel')).toBeVisible(); expect(wrapper.getByTestId('accordionCommentList')).toBeVisible(); expect(wrapper.getByTestId('accordionCommentList')).toHaveTextContent('some old comment'); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); }); }); diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/__snapshots__/entry_content.test.tsx.snap b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/__snapshots__/entry_content.test.tsx.snap index 9927750e4f84e..f814be75fa63e 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/__snapshots__/entry_content.test.tsx.snap +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/__snapshots__/entry_content.test.tsx.snap @@ -1,164 +1,56 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`EntryContent should render a nested value 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    -
    - - - -
    - - - - - - - - included in - - - - list_id - - -
    -
    -
    -
    -
    - , - "container":
    +
    +
    + + +
    + + -
    - - - + included in + - - included in - - - - list_id - + list_id -
    +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/entry_content.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/entry_content.test.tsx index 7fc34c59521fb..7eb141493ef40 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/entry_content.test.tsx +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/entry_content.test.tsx @@ -53,6 +53,6 @@ describe('EntryContent', () => { expect(wrapper.getByTestId('EntryContentNestedEntry')).toBeInTheDocument(); expect(wrapper.getByTestId('nstedEntryIcon')).toBeInTheDocument(); expect(wrapper.getByTestId('entryValueExpression')).toHaveTextContent('list_id'); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); }); }); diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/os_conditions/__snapshots__/os_conditions.test.tsx.snap b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/os_conditions/__snapshots__/os_conditions.test.tsx.snap index 1ace7211d5e5f..3aa50a6d0a2fb 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/os_conditions/__snapshots__/os_conditions.test.tsx.snap +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/os_conditions/__snapshots__/os_conditions.test.tsx.snap @@ -1,467 +1,126 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`OsCondition should render one OS_LABELS 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    +
    + + - - - - - - OS - - - - - IS - - - - Mac - - - -
    -
    - , - "container":
    -
    - + + + OS + + + + - - - - OS - + IS + - - IS - - - - Mac - + Mac - -
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} + +
    +
    +
    `; exports[`OsCondition should render two OS_LABELS 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    +
    + + + + + + OS + + + - - - - - - OS - - - - - IS - - - - Mac, Windows - - - -
    -
    - , - "container":
    -
    - - - - - OS - + IS + - - IS - - - - Mac, Windows - + Mac, Windows - -
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} + +
    +
    +
    `; exports[`OsCondition should return any os sent 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    +
    + + + + + + OS + + + - - - - - - OS - - - - - IS - - - - MacPro - - - -
    -
    - , - "container":
    -
    - - - - - OS - + IS + - - IS - - - - MacPro - + MacPro - -
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} + +
    +
    +
    `; -exports[`OsCondition should return empty body 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    - , - "container":
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; +exports[`OsCondition should return empty body 1`] = `
    `; diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/os_conditions/os_conditions.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/os_conditions/os_conditions.test.tsx index 593eb06659fab..3aea8d5ed0065 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/os_conditions/os_conditions.test.tsx +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/os_conditions/os_conditions.test.tsx @@ -20,7 +20,7 @@ describe('OsCondition', () => { expect(wrapper.getByTestId('osValue')).toHaveTextContent( `${i18n.CONDITION_OPERATOR_TYPE_MATCH} ${OS_LABELS.macos}` ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); }); it('should render two OS_LABELS', () => { const wrapper = render(); @@ -28,11 +28,11 @@ describe('OsCondition', () => { expect(wrapper.getByTestId('osValue')).toHaveTextContent( `${i18n.CONDITION_OPERATOR_TYPE_MATCH} ${OS_LABELS.macos}, ${OS_LABELS.windows}` ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); }); it('should return empty body', () => { const wrapper = render(); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); }); it('should return any os sent', () => { const wrapper = render(); @@ -40,6 +40,6 @@ describe('OsCondition', () => { expect(wrapper.getByTestId('osValue')).toHaveTextContent( `${i18n.CONDITION_OPERATOR_TYPE_MATCH} MacPro` ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); }); }); diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/__snapshots__/details_info.test.tsx.snap b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/__snapshots__/details_info.test.tsx.snap index 66e6115e76a09..09b6237cc7cc8 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/__snapshots__/details_info.test.tsx.snap +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/__snapshots__/details_info.test.tsx.snap @@ -1,235 +1,63 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`MetaInfoDetails should render lastUpdate as JSX Element 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    +
    +
    +
    -
    -
    - created_by -
    -
    -
    - - - -

    - Last update value -

    -
    -
    -
    -
    -
    -
    - by -
    -
    -
    -
    -
    - - - - value - - - -
    -
    -
    + created_by
    - , - "container":
    -
    -
    - created_by -
    -
    -
    - -

    - Last update value -

    -
    +

    + Last update value +

    -
    -
    -
    - by -
    -
    + +
    +
    -
    -
    - - - - value - - - -
    -
    + by
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; - -exports[`MetaInfoDetails should render lastUpdate as string 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    +
    -
    - created_by -
    -
    -
    - last update + value
    -
    -
    - by -
    -
    -
    -
    -
    - - - - value - - - -
    -
    -
    - , - "container":
    +
    +
    +`; + +exports[`MetaInfoDetails should render lastUpdate as string 1`] = ` +
    +
    -
    - created_by -
    + created_by
    -
    +
    + - - last update - + last update -
    + +
    +
    -
    - by -
    + by
    +
    +
    -
    - - value - + value -
    +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/details_info.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/details_info.test.tsx index 1f2cd6d3e57d2..cbb48e172322e 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/details_info.test.tsx +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/details_info.test.tsx @@ -21,7 +21,7 @@ describe('MetaInfoDetails', () => { lastUpdateValue="value" /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('MetaInfoDetailslastUpdate')).toHaveTextContent('last update'); }); it('should render lastUpdate as JSX Element', () => { @@ -33,7 +33,7 @@ describe('MetaInfoDetails', () => { lastUpdateValue="value" /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('MetaInfoDetailslastUpdate')).toHaveTextContent('Last update value'); }); }); diff --git a/packages/kbn-securitysolution-exception-list-components/src/generate_linked_rules_menu_item/__snapshots__/generate_linked_rules_menu_item.test.tsx.snap b/packages/kbn-securitysolution-exception-list-components/src/generate_linked_rules_menu_item/__snapshots__/generate_linked_rules_menu_item.test.tsx.snap index a4e5a45683de8..7cdcf14d17aad 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/generate_linked_rules_menu_item/__snapshots__/generate_linked_rules_menu_item.test.tsx.snap +++ b/packages/kbn-securitysolution-exception-list-components/src/generate_linked_rules_menu_item/__snapshots__/generate_linked_rules_menu_item.test.tsx.snap @@ -1,247 +1,71 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`generateLinedRulesMenuItems should render the first linked rules with left icon and does not apply the css if the length is 1 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    +
    +
    +
    - -
    -
    - -
    - -
    -
    -
    -
    - , - "container":
    -
    - + +
    - -
    -
    - + Simple Rule Query +
    - -
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    + +
    +
    `; exports[`generateLinedRulesMenuItems should render the second linked rule and apply the css when the length is > 1 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    - - - -
    -
    - , - "container":
    -
    +
    + -
    - + Simple Rule Query 2 +
    -
    -
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    + +
    +
    `; diff --git a/packages/kbn-securitysolution-exception-list-components/src/generate_linked_rules_menu_item/generate_linked_rules_menu_item.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/generate_linked_rules_menu_item/generate_linked_rules_menu_item.test.tsx index 22696644d31dd..01f708a0f6bdc 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/generate_linked_rules_menu_item/generate_linked_rules_menu_item.test.tsx +++ b/packages/kbn-securitysolution-exception-list-components/src/generate_linked_rules_menu_item/generate_linked_rules_menu_item.test.tsx @@ -47,7 +47,7 @@ describe('generateLinedRulesMenuItems', () => { result.map((link) => { const wrapper = render(link); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('generateLinedRulesMenuItemsTestActionItem1a2b3c')); expect(wrapper.getByTestId('generateLinedRulesMenuItemsTestLeftIcon')); }); @@ -56,7 +56,7 @@ describe('generateLinedRulesMenuItems', () => { const result: ReactElement[] = getSecurityLinkAction(dataTestSubj); const wrapper = render(result[1]); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('generateLinedRulesMenuItemsTestActionItem2a2b3c')); }); }); diff --git a/packages/kbn-securitysolution-exception-list-components/src/header_menu/__snapshots__/header_menu.test.tsx.snap b/packages/kbn-securitysolution-exception-list-components/src/header_menu/__snapshots__/header_menu.test.tsx.snap index 5f87fe1383634..d7becb3e8ddc2 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/header_menu/__snapshots__/header_menu.test.tsx.snap +++ b/packages/kbn-securitysolution-exception-list-components/src/header_menu/__snapshots__/header_menu.test.tsx.snap @@ -1,865 +1,211 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`HeaderMenu should not render icon 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    - -
    -
    -
    - , - "container":
    +
    +
    -
    - -
    +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; exports[`HeaderMenu should render button icon disabled 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    - -
    -
    -
    -
    -
    - -
    - , - "container":
    +
    +
    -
    - -
    +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; exports[`HeaderMenu should render button icon with default settings 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    - -
    -
    -
    - , - "container":
    +
    +
    -
    - -
    +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; exports[`HeaderMenu should render custom Actions 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    - -
    -
    -
    - , - "container":
    +
    +
    -
    - -
    + color="inherit" + data-euiicon-type="boxesHorizontal" + /> + + +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; exports[`HeaderMenu should render empty button icon with actions and open the popover when clicked 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    - -
    -
    -
    - , - "container":
    +
    +
    -
    - -
    + class="eui-textTruncate euiButtonEmpty__text" + /> + + +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; exports[`HeaderMenu should render empty button icon with actions and should not open the popover when clicked if disableActions 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    - -
    -
    -
    - , - "container":
    +
    +
    -
    - -
    + class="eui-textTruncate euiButtonEmpty__text" + /> + + +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; exports[`HeaderMenu should render empty button icon with different icon settings 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    - -
    -
    -
    - , - "container":
    +
    +
    -
    - -
    + class="eui-textTruncate euiButtonEmpty__text" + /> + + +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; diff --git a/packages/kbn-securitysolution-exception-list-components/src/header_menu/header_menu.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/header_menu/header_menu.test.tsx index e680f259a39c5..7e14b503721b5 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/header_menu/header_menu.test.tsx +++ b/packages/kbn-securitysolution-exception-list-components/src/header_menu/header_menu.test.tsx @@ -19,7 +19,7 @@ describe('HeaderMenu', () => { ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('ButtonIcon')).toBeInTheDocument(); expect(wrapper.queryByTestId('EmptyButton')).not.toBeInTheDocument(); @@ -28,7 +28,7 @@ describe('HeaderMenu', () => { it('should not render icon', () => { const wrapper = render(); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('ButtonIcon')).toBeInTheDocument(); expect(wrapper.queryByTestId('EmptyButton')).not.toBeInTheDocument(); @@ -44,7 +44,7 @@ describe('HeaderMenu', () => { ); fireEvent.click(wrapper.getByTestId('ButtonIcon')); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('ActionItemdelete')).toBeDisabled(); expect(wrapper.getByTestId('ActionItemedit')).toBeEnabled(); }); @@ -60,7 +60,7 @@ describe('HeaderMenu', () => { /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('EmptyButton')).toBeInTheDocument(); expect(wrapper.queryByTestId('ButtonIcon')).not.toBeInTheDocument(); @@ -79,7 +79,7 @@ describe('HeaderMenu', () => { /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('EmptyButton')).toBeInTheDocument(); expect(wrapper.queryByTestId('ButtonIcon')).not.toBeInTheDocument(); @@ -99,7 +99,7 @@ describe('HeaderMenu', () => { /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('EmptyButton')).toBeInTheDocument(); expect(wrapper.queryByTestId('ButtonIcon')).not.toBeInTheDocument(); @@ -129,7 +129,7 @@ describe('HeaderMenu', () => { /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('EmptyButton')).toBeInTheDocument(); fireEvent.click(wrapper.getByTestId('EmptyButton')); diff --git a/packages/kbn-securitysolution-exception-list-components/src/list_header/__snapshots__/list_header.test.tsx.snap b/packages/kbn-securitysolution-exception-list-components/src/list_header/__snapshots__/list_header.test.tsx.snap index 4a8527faa5096..b6c22f01f14b8 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/list_header/__snapshots__/list_header.test.tsx.snap +++ b/packages/kbn-securitysolution-exception-list-components/src/list_header/__snapshots__/list_header.test.tsx.snap @@ -1,60 +1,98 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ExceptionListHeader should render edit modal 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    +
    +
    +
    + +
    +
    - + List Name + +
    +
    + +
    +
    +
    -
    -

    +
    - List Name + List description
    -

    -
    -
    -

    +

    -
    -
    - - List description - -
    -
    - -
    -
    -
    -
    - List ID - : -
    -
    - List_Id -
    -
    + List ID + :
    -

    +
    + List_Id +
    +
    -
    +

    +
    +
    +
    +
    -
    -
    +
    +
    +
    + + +
    +
    +
    -
    -
    -
    - -
    -
    -
    -
    +
    -
    -
    +
    +
    +`; + +exports[`ExceptionListHeader should render the List Header with name, default description and actions 1`] = ` +
    +
    +
    - -
    - , - "container":
    -
    -
    -
    - -
    -
    -

    - List Name + Linked to 0 rules
    -
    -

    -
    -
    -

    - - List description - -
    -
    -
    -
    - List ID - : -
    -
    - List_Id -
    -
    -

    +
    -
    +
    +
    +
    +
    +
    +`; + +exports[`ExceptionListHeader should render the List Header with name, default description and disabled actions because of the ReadOnly mode 1`] = ` +
    +
    +
    +
    + +
    +
    +
    +

    -
    -
    - - Linked to 0 rules - -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    + List Name +
    +
    -
    -

    -
    -
    -
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; - -exports[`ExceptionListHeader should render the List Header with name, default description and actions 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    -
    - +
    -
    -

    +
    - List Name + Add a description
    - -
    + />
    -

    -
    -
    -

    +

    -
    -
    - - Add a description - -
    -
    - -
    -
    -
    -
    - List ID - : -
    -
    - List_Id -
    -
    + List ID + :
    -

    -
    -
    -
    -
    -
    -
    - - Linked to 0 rules - -
    -
    - -
    -
    -
    -
    - -
    -
    -
    + List_Id
    -
    +

    -
    -
    -
    - , - "container":
    -
    -
    -
    - -
    -

    - List Name + Linked to 0 rules
    -
    -

    -
    -
    -

    - - Add a description - -
    -
    -
    -
    - List ID - : -
    -
    - List_Id -
    -
    -
    -

    -
    -
    -
    -
    -
    -
    -
    - - Linked to 0 rules - -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    + +
    +
    `; -exports[`ExceptionListHeader should render the List Header with name, default description and disabled actions because of the ReadOnly mode 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    +
    +
    +
    + +
    +
    - + List Name + +
    +
    +
    +
    -
    -

    +
    - List Name + Add a description
    -

    -
    -
    -

    +

    -
    -
    - - Add a description - -
    -
    -
    -
    -
    - List ID - : -
    -
    - List_Id -
    -
    + List ID + : +
    +
    + List_Id
    -

    +
    -
    +

    +
    +
    +
    +
    -
    -
    - - Linked to 0 rules - -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - , - "container":
    -
    -
    -
    - -
    -
    -
    -

    -
    -
    - - List Name + Linked to 0 rules
    -
    -

    -
    -
    -

    -

    - - Add a description - -
    -
    -
    -
    -
    - List ID - : -
    -
    - List_Id -
    -
    -
    -

    -
    -
    -
    -
    -
    -
    -
    - - Linked to 0 rules - -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; - -exports[`ExceptionListHeader should render the List Header with name, default description and disabled actions because user can not edit details 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    -
    - -
    -
    -
    -

    -
    -
    - - List Name - -
    -
    -
    -

    -
    -
    -

    -

    -
    -
    - Add a description - -
    -
    -
    -
    -
    - List ID - : -
    -
    - List_Id -
    -
    -
    -

    -
    -
    -
    -
    -
    -
    -
    - - Linked to 0 rules - -
    -
    -
    -
    - -
    -
    + aria-hidden="true" + class="euiButtonIcon__icon" + color="inherit" + data-euiicon-type="boxesHorizontal" + /> +
    @@ -1787,324 +815,9 @@ Object {
    -
    -
    -
    -
    -
    - -
    - , - "container":
    -
    -
    -
    - -
    -
    -
    -

    -
    -
    - - List Name - -
    -
    -
    -

    -
    -
    -

    -

    -
    -
    - - Add a description - -
    -
    -
    -
    -
    - List ID - : -
    -
    - List_Id -
    -
    -
    -

    -
    -
    -
    -
    -
    -
    -
    - - Linked to 0 rules - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} + +
    +
    `; diff --git a/packages/kbn-securitysolution-exception-list-components/src/list_header/edit_modal/__snapshots__/edit_modal.test.tsx.snap b/packages/kbn-securitysolution-exception-list-components/src/list_header/edit_modal/__snapshots__/edit_modal.test.tsx.snap index b333aa10d1872..bafe2d021ee61 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/list_header/edit_modal/__snapshots__/edit_modal.test.tsx.snap +++ b/packages/kbn-securitysolution-exception-list-components/src/list_header/edit_modal/__snapshots__/edit_modal.test.tsx.snap @@ -1,225 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`EditModal should render the title and description from listDetails 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    - -
    -
    - , - "container":
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; +exports[`EditModal should render the title and description from listDetails 1`] = `
    `; diff --git a/packages/kbn-securitysolution-exception-list-components/src/list_header/edit_modal/edit_modal.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/list_header/edit_modal/edit_modal.test.tsx index 08ff52626c1cc..39692e35394ec 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/list_header/edit_modal/edit_modal.test.tsx +++ b/packages/kbn-securitysolution-exception-list-components/src/list_header/edit_modal/edit_modal.test.tsx @@ -25,7 +25,7 @@ describe('EditModal', () => { onCancel={onCancel} /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('editModalTitle')).toHaveTextContent('list name'); }); it('should call onSave when submitting the form', () => { diff --git a/packages/kbn-securitysolution-exception-list-components/src/list_header/list_header.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/list_header/list_header.test.tsx index d4efec385f168..9ceb648dfa7e1 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/list_header/list_header.test.tsx +++ b/packages/kbn-securitysolution-exception-list-components/src/list_header/list_header.test.tsx @@ -47,7 +47,7 @@ describe('ExceptionListHeader', () => { backOptions={{ pageId: '', path: '', onNavigate }} /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); fireEvent.click(wrapper.getByTestId('RightSideMenuItemsMenuActionsItems')); expect(wrapper.queryByTestId('RightSideMenuItemsMenuActionsButtonIcon')).toBeDisabled(); expect(wrapper.getByTestId('DescriptionText')).toHaveTextContent( @@ -80,7 +80,7 @@ describe('ExceptionListHeader', () => { ); expect(wrapper.queryByTestId('RightSideMenuItemsMenuActionsButtonIcon')).toBeEnabled(); fireEvent.click(wrapper.getByTestId('RightSideMenuItemsMenuActionsButtonIcon')); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.queryByTestId('RightSideMenuItemsMenuActionsActionItem1')).toBeEnabled(); expect(wrapper.queryByTestId('RightSideMenuItemsMenuActionsActionItem2')).toBeDisabled(); @@ -103,7 +103,7 @@ describe('ExceptionListHeader', () => { backOptions={{ pageId: '', path: '', onNavigate }} /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); fireEvent.click(wrapper.getByTestId('RightSideMenuItemsContainer')); expect(wrapper.getByTestId('DescriptionText')).toHaveTextContent( i18n.EXCEPTION_LIST_HEADER_DESCRIPTION @@ -134,7 +134,7 @@ describe('ExceptionListHeader', () => { backOptions={{ pageId: '', path: '', onNavigate }} /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('EditModal')).toBeInTheDocument(); }); it('should go back the page path when back button is clicked', () => { diff --git a/packages/kbn-securitysolution-exception-list-components/src/list_header/menu_items/__snapshots__/menu_items.test.tsx.snap b/packages/kbn-securitysolution-exception-list-components/src/list_header/menu_items/__snapshots__/menu_items.test.tsx.snap index a08e9f336802a..e66aed7689cc4 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/list_header/menu_items/__snapshots__/menu_items.test.tsx.snap +++ b/packages/kbn-securitysolution-exception-list-components/src/list_header/menu_items/__snapshots__/menu_items.test.tsx.snap @@ -1,1156 +1,357 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`MenuItems should not render Manage rules 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - , - "container":
    +
    +
    -
    - -
    -
    -
    -
    -
    -
    - -
    + +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; - -exports[`MenuItems should not render linkedRules HeaderMenu component, instead should render a text 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    +
    - - Linked to 0 rules - -
    -
    -
    -
    -
    - -
    -
    -
    - , - "container":
    +
    +
    +`; + +exports[`MenuItems should not render linkedRules HeaderMenu component, instead should render a text 1`] = ` +
    +
    -
    - - Linked to 0 rules - -
    -
    +
    +
    + -
    -
    -
    -
    - -
    -
    -
    + +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; - -exports[`MenuItems should render all menu actions enabled 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    +
    - - Linked to 0 rules - -
    -
    -
    -
    -
    - -
    -
    -
    +
    +
    +`; + +exports[`MenuItems should render all menu actions enabled 1`] = ` +
    +
    -
    - + Linked to 0 rules +
    - , - "container":
    -
    - Linked to 0 rules - -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; - -exports[`MenuItems should render delete action disabled when "canUserEditList" is "false" 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    + +
    - , - "container":
    +
    +
    +`; + +exports[`MenuItems should render delete action disabled when "canUserEditList" is "false" 1`] = ` +
    +
    -
    - -
    + + +
    +
    +
    -
    - -
    +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; exports[`MenuItems should render linkedRules, manageRules and menuActions 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    +
    +
    +
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    - , - "container":
    -
    -
    -
    - -
    -
    -
    -
    - -
    + + +
    +
    -
    - -
    +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; diff --git a/packages/kbn-securitysolution-exception-list-components/src/list_header/menu_items/menu_items.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/list_header/menu_items/menu_items.test.tsx index b4e05e519f35c..16072bab295ab 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/list_header/menu_items/menu_items.test.tsx +++ b/packages/kbn-securitysolution-exception-list-components/src/list_header/menu_items/menu_items.test.tsx @@ -30,7 +30,7 @@ describe('MenuItems', () => { onManageRules={onManageRules} /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('LinkedRulesMenuItems')).toHaveTextContent('Linked to 1 rules'); expect(wrapper.getByTestId('LinkRulesButton')).toBeInTheDocument(); expect(wrapper.getByTestId('MenuActionsButtonIcon')).toBeInTheDocument(); @@ -47,7 +47,7 @@ describe('MenuItems', () => { onManageRules={onManageRules} /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.queryByTestId('LinkedRulesMenuItems')).not.toBeInTheDocument(); expect(wrapper.getByTestId('noLinkedRules')).toBeInTheDocument(); }); @@ -64,7 +64,7 @@ describe('MenuItems', () => { /> ); fireEvent.click(wrapper.getByTestId('MenuActionsButtonIcon')); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('MenuActionsActionItem1')).toBeEnabled(); expect(wrapper.getByTestId('MenuActionsActionItem2')).toBeEnabled(); expect(wrapper.getByTestId('MenuActionsActionItem3')).toBeEnabled(); @@ -83,7 +83,7 @@ describe('MenuItems', () => { /> ); fireEvent.click(wrapper.getByTestId('MenuActionsButtonIcon')); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('MenuActionsActionItem1')).toBeEnabled(); expect(wrapper.getByTestId('MenuActionsActionItem2')).toBeDisabled(); expect(wrapper.getByTestId('MenuActionsActionItem3')).toBeDisabled(); @@ -101,7 +101,7 @@ describe('MenuItems', () => { onManageRules={onManageRules} /> ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.queryByTestId('LinkRulesButton')).not.toBeInTheDocument(); }); it('should call onManageRules', () => { diff --git a/packages/kbn-securitysolution-exception-list-components/src/text_with_edit/__snapshots__/text_with_edit.test.tsx.snap b/packages/kbn-securitysolution-exception-list-components/src/text_with_edit/__snapshots__/text_with_edit.test.tsx.snap index 2f06c1efcee6d..b988d7429bf5e 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/text_with_edit/__snapshots__/text_with_edit.test.tsx.snap +++ b/packages/kbn-securitysolution-exception-list-components/src/text_with_edit/__snapshots__/text_with_edit.test.tsx.snap @@ -1,219 +1,57 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`TextWithEdit should not render the edit icon when isReadonly is true 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    - - Test - -
    -
    -
    -
    - , - "container":
    +
    +
    -
    - - Test - -
    -
    + Test +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    +
    `; exports[`TextWithEdit should render the edit icon when isReadonly is false 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    +
    +
    + -
    - - Test - -
    -
    - -
    -
    + Test +
    - , - "container":
    -
    - Test - -
    -
    - -
    + aria-hidden="true" + class="euiButtonIcon__icon" + color="inherit" + data-euiicon-type="pencil" + /> +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; diff --git a/packages/kbn-securitysolution-exception-list-components/src/text_with_edit/text_with_edit.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/text_with_edit/text_with_edit.test.tsx index 93fcdd1e11e96..eab0eb7817d8c 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/text_with_edit/text_with_edit.test.tsx +++ b/packages/kbn-securitysolution-exception-list-components/src/text_with_edit/text_with_edit.test.tsx @@ -16,7 +16,7 @@ describe('TextWithEdit', () => { const wrapper = render( ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('TextWithEditTestText')).toHaveTextContent('Test'); expect(wrapper.queryByTestId('TextWithEditTestEditIcon')).not.toBeInTheDocument(); }); @@ -24,7 +24,7 @@ describe('TextWithEdit', () => { const wrapper = render( ); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.container).toMatchSnapshot(); expect(wrapper.getByTestId('TextWithEditTestText')).toHaveTextContent('Test'); expect(wrapper.getByTestId('TextWithEditTestEditIcon')).toBeInTheDocument(); }); diff --git a/x-pack/plugins/kubernetes_security/public/components/tree_view_container/breadcrumb/__snapshots__/index.test.tsx.snap b/x-pack/plugins/kubernetes_security/public/components/tree_view_container/breadcrumb/__snapshots__/index.test.tsx.snap index 98b6f1dd203cf..00c776a2a132a 100644 --- a/x-pack/plugins/kubernetes_security/public/components/tree_view_container/breadcrumb/__snapshots__/index.test.tsx.snap +++ b/x-pack/plugins/kubernetes_security/public/components/tree_view_container/breadcrumb/__snapshots__/index.test.tsx.snap @@ -1,1133 +1,461 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Tree view Breadcrumb component When Breadcrumb is mounted renders Breadcrumb button content correctly 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    +
    +
    +
    -
    -
    - - - + + + - - + + + - -
    -
    -
    -
    - , - "container":
    -
    -
    -
    + + + - - - - - - - - - - - - - - - - + + - -
    + + +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; exports[`Tree view Breadcrumb component When Breadcrumb is mounted should display cluster icon button when no cluster name is provided 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    +
    +
    +
    -
    -
    - - - + + + - - + + + - -
    -
    -
    -
    - , - "container":
    -
    -
    -
    + + + - - - - - - - - - - - - - - - - + + - -
    + + +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; exports[`Tree view Breadcrumb component When Breadcrumb is mounted should render breadcrumb icons 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    +
    +
    +
    -
    -
    - - - + + + - - + + + - - + + + - -
    -
    -
    -
    - , - "container":
    -
    -
    -
    + + + - - - - - - - - - - - - - - - - - - - - + + - -
    + + +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; exports[`Tree view Breadcrumb component When Breadcrumb is mounted should render last breadcrumb content only 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    +
    +
    +
    -
    -
    - - - + + + - -
    -
    -
    -
    - , - "container":
    -
    -
    -
    + + + - - - - - - - - - - - - + + - -
    + + +
    -
    , - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} +
    +
    `; diff --git a/x-pack/plugins/kubernetes_security/public/components/tree_view_container/breadcrumb/index.test.tsx b/x-pack/plugins/kubernetes_security/public/components/tree_view_container/breadcrumb/index.test.tsx index 4ac0471c2a1a6..c377f21080ed1 100644 --- a/x-pack/plugins/kubernetes_security/public/components/tree_view_container/breadcrumb/index.test.tsx +++ b/x-pack/plugins/kubernetes_security/public/components/tree_view_container/breadcrumb/index.test.tsx @@ -44,7 +44,7 @@ describe('Tree view Breadcrumb component', () => { expect(renderResult.queryByText(MOCK_TREE_SELECTION.node!)).toBeFalsy(); expect(renderResult.queryByText(MOCK_TREE_SELECTION.pod!)).toBeNull(); expect(renderResult.queryByText(MOCK_TREE_SELECTION.containerImage!)).toBeVisible(); - expect(renderResult).toMatchSnapshot(); + expect(renderResult.container).toMatchSnapshot(); }); it('should render breadcrumb icons', async () => { @@ -60,7 +60,7 @@ describe('Tree view Breadcrumb component', () => { expect( renderResult.queryByTestId('kubernetesSecurityBreadcrumbIcon-containerImage') ).toBeVisible(); - expect(renderResult).toMatchSnapshot(); + expect(renderResult.container).toMatchSnapshot(); }); it('returns null when no selected collection', async () => { renderResult = mockedContext.render(); @@ -84,7 +84,7 @@ describe('Tree view Breadcrumb component', () => { ).toBeVisible(); expect(renderResult.queryByText(MOCK_TREE_SELECTION.clusterId!)).toBeNull(); expect(renderResult.queryByText(MOCK_TREE_SELECTION.containerImage!)).toBeVisible(); - expect(renderResult).toMatchSnapshot(); + expect(renderResult.container).toMatchSnapshot(); }); it('should return null when no cluster in selection', async () => { @@ -132,7 +132,7 @@ describe('Tree view Breadcrumb component', () => { expect(renderResult.queryByText(MOCK_TREE_SELECTION.node!)).toBeNull(); expect(renderResult.queryByText(MOCK_TREE_SELECTION.pod!)).toBeNull(); expect(renderResult.queryByText(MOCK_TREE_SELECTION.containerImage!)).toBeVisible(); - expect(renderResult).toMatchSnapshot(); + expect(renderResult.container).toMatchSnapshot(); }); }); }); diff --git a/x-pack/plugins/security_solution/public/common/components/import_data_modal/__snapshots__/index.test.tsx.snap b/x-pack/plugins/security_solution/public/common/components/import_data_modal/__snapshots__/index.test.tsx.snap index 4ca53999b7459..2a344f8cec05b 100644 --- a/x-pack/plugins/security_solution/public/common/components/import_data_modal/__snapshots__/index.test.tsx.snap +++ b/x-pack/plugins/security_solution/public/common/components/import_data_modal/__snapshots__/index.test.tsx.snap @@ -1,734 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`ImportDataModal renders correctly against snapshot 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
    -
    -
    -