From 7a74c24d00ee2321211c1b894fb691325d5f9217 Mon Sep 17 00:00:00 2001 From: Brad White Date: Thu, 12 Oct 2023 11:48:24 -0600 Subject: [PATCH 01/11] skip flaky suite (#133470) --- .../server/integration_tests/cloud_preconfiguration.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/fleet/server/integration_tests/cloud_preconfiguration.test.ts b/x-pack/plugins/fleet/server/integration_tests/cloud_preconfiguration.test.ts index ae19383f37216..db7d0ce60f006 100644 --- a/x-pack/plugins/fleet/server/integration_tests/cloud_preconfiguration.test.ts +++ b/x-pack/plugins/fleet/server/integration_tests/cloud_preconfiguration.test.ts @@ -143,7 +143,8 @@ describe('Fleet preconfiguration reset', () => { expect(agentPolicies.saved_objects.find((so) => so.id === 'default-policy')).toBeDefined(); }); - it('Create correct .fleet-policies', async () => { + // FLAKY: https://github.com/elastic/kibana/issues/133470 + it.skip('Create correct .fleet-policies', async () => { const res = await kbnServer.coreStart.elasticsearch.client.asInternalUser.search({ index: AGENT_POLICY_INDEX, q: `policy_id:policy-elastic-agent-on-cloud`, From bc8f45f529264534c2a98b9209cb95cea166a5d8 Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Thu, 12 Oct 2023 11:16:43 -0700 Subject: [PATCH 02/11] [DOCS] Fix cases link for notifications domain allowlist (#168656) --- docs/management/cases/manage-cases.asciidoc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/management/cases/manage-cases.asciidoc b/docs/management/cases/manage-cases.asciidoc index e3896423b3f13..1ebe9643d55c2 100644 --- a/docs/management/cases/manage-cases.asciidoc +++ b/docs/management/cases/manage-cases.asciidoc @@ -90,8 +90,7 @@ cases. For hosted {kib} on {ess}: -. Add the email addresses to the monitoring email allowlist. Follow the steps in -{cloud}/ec-watcher.html#ec-watcher-allowlist[Send alerts by email]. +. Add the email domains to the {cloud}/ec-organizations-notifications-domain-allowlist.html[notifications domain allowlist]. + -- You do not need to take any more steps to configure an email connector or update From f5caf787af8aa0136625523f0b12b57f43cb6ef2 Mon Sep 17 00:00:00 2001 From: Rachel Shen Date: Thu, 12 Oct 2023 13:32:32 -0600 Subject: [PATCH 03/11] [Reporting][Serverless] Make screenshotting in reporting plugin optional and disable in serverless (#168373) ## Summary Closes [#168379](https://github.com/elastic/kibana/issues/168379) ### After In logs for yarn serverless-es ```[2023-10-09T15:09:02.887-06:00][INFO ][plugins-service] Plugin "screenshotting" is disabled.``` ### 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 --- config/serverless.yml | 1 + x-pack/plugins/reporting/kibana.jsonc | 4 ++-- x-pack/plugins/reporting/server/core.ts | 6 +++--- .../reporting/server/export_types/common/export_type.ts | 2 +- .../plugins/reporting/server/export_types/png_v2/png_v2.ts | 2 +- .../server/export_types/printable_pdf/printable_pdf.ts | 2 +- .../export_types/printable_pdf_v2/printable_pdf_v2.ts | 2 +- .../reporting/server/routes/internal/diagnostic/browser.ts | 1 + x-pack/plugins/reporting/server/types.ts | 6 +++--- .../screenshotting/server/browsers/chromium/driver.test.ts | 1 + x-pack/plugins/screenshotting/server/config/schema.test.ts | 2 ++ x-pack/plugins/screenshotting/server/config/schema.ts | 6 +++++- .../plugins/screenshotting/server/screenshots/index.test.ts | 1 + .../screenshotting/server/screenshots/screenshots.test.ts | 1 + 14 files changed, 24 insertions(+), 13 deletions(-) diff --git a/config/serverless.yml b/config/serverless.yml index 282956932f412..30c4aff914a51 100644 --- a/config/serverless.yml +++ b/config/serverless.yml @@ -52,6 +52,7 @@ xpack.canvas.enabled: false xpack.cloud_integrations.data_migration.enabled: false data.search.sessions.enabled: false advanced_settings.enabled: false +xpack.screenshotting.enabled: false # Disable the browser-side functionality that depends on SecurityCheckupGetStateRoutes xpack.security.showInsecureClusterWarning: false diff --git a/x-pack/plugins/reporting/kibana.jsonc b/x-pack/plugins/reporting/kibana.jsonc index a02db938c9ec3..e89e750ebe98c 100644 --- a/x-pack/plugins/reporting/kibana.jsonc +++ b/x-pack/plugins/reporting/kibana.jsonc @@ -22,7 +22,6 @@ "uiActions", "taskManager", "embeddable", - "screenshotting", "screenshotMode", "share", "features" @@ -30,7 +29,8 @@ "optionalPlugins": [ "security", "spaces", - "usageCollection" + "usageCollection", + "screenshotting", ], "requiredBundles": [ "kibanaReact", diff --git a/x-pack/plugins/reporting/server/core.ts b/x-pack/plugins/reporting/server/core.ts index 453940f3cc914..c240d6d165704 100644 --- a/x-pack/plugins/reporting/server/core.ts +++ b/x-pack/plugins/reporting/server/core.ts @@ -78,7 +78,7 @@ export interface ReportingInternalStart { fieldFormats: FieldFormatsStart; licensing: LicensingPluginStart; logger: Logger; - screenshotting: ScreenshottingStart; + screenshotting?: ScreenshottingStart; security?: SecurityPluginStart; taskManager: TaskManagerStartContract; } @@ -134,7 +134,7 @@ export class ReportingCore { this.getContract = () => ({ usesUiCapabilities: () => config.roles.enabled === false, registerExportTypes: (id) => id, - getScreenshots: this.getScreenshots.bind(this), + getScreenshots: config.statefulSettings.enabled ? this.getScreenshots.bind(this) : undefined, getSpaceId: this.getSpaceId.bind(this), }); @@ -408,7 +408,7 @@ export class ReportingCore { ): Rx.Observable { return Rx.defer(() => this.getPluginStartDeps()).pipe( switchMap(({ screenshotting }) => { - return screenshotting.getScreenshots({ + return screenshotting!.getScreenshots({ ...options, urls: options.urls.map((url) => typeof url === 'string' diff --git a/x-pack/plugins/reporting/server/export_types/common/export_type.ts b/x-pack/plugins/reporting/server/export_types/common/export_type.ts index dd9ad3a5a20ab..96240863122d0 100644 --- a/x-pack/plugins/reporting/server/export_types/common/export_type.ts +++ b/x-pack/plugins/reporting/server/export_types/common/export_type.ts @@ -37,7 +37,7 @@ export interface BaseExportTypeStartDeps { savedObjects: SavedObjectsServiceStart; uiSettings: UiSettingsServiceStart; esClient: IClusterClient; - screenshotting: ScreenshottingStart; + screenshotting?: ScreenshottingStart; reporting: ReportingStart; } diff --git a/x-pack/plugins/reporting/server/export_types/png_v2/png_v2.ts b/x-pack/plugins/reporting/server/export_types/png_v2/png_v2.ts index ac297cfd8c02b..6afac5dacb4cb 100644 --- a/x-pack/plugins/reporting/server/export_types/png_v2/png_v2.ts +++ b/x-pack/plugins/reporting/server/export_types/png_v2/png_v2.ts @@ -104,7 +104,7 @@ export class PngExportType extends ExportType return generatePngObservable( () => - this.startDeps.reporting.getScreenshots({ + this.startDeps.reporting.getScreenshots!({ format: 'png', headers, layout: { ...payload.layout, id: 'preserve_layout' }, diff --git a/x-pack/plugins/reporting/server/export_types/printable_pdf/printable_pdf.ts b/x-pack/plugins/reporting/server/export_types/printable_pdf/printable_pdf.ts index 495a635370dc2..85e656642eb62 100644 --- a/x-pack/plugins/reporting/server/export_types/printable_pdf/printable_pdf.ts +++ b/x-pack/plugins/reporting/server/export_types/printable_pdf/printable_pdf.ts @@ -85,7 +85,7 @@ export class PdfV1ExportType extends ExportType - this.startDeps.reporting.getScreenshots({ + this.startDeps.reporting.getScreenshots!({ format: 'pdf', title, logo, diff --git a/x-pack/plugins/reporting/server/export_types/printable_pdf_v2/printable_pdf_v2.ts b/x-pack/plugins/reporting/server/export_types/printable_pdf_v2/printable_pdf_v2.ts index f673229a168ee..862d5908ddb3c 100644 --- a/x-pack/plugins/reporting/server/export_types/printable_pdf_v2/printable_pdf_v2.ts +++ b/x-pack/plugins/reporting/server/export_types/printable_pdf_v2/printable_pdf_v2.ts @@ -108,7 +108,7 @@ export class PdfExportType extends ExportType this.config, this.getServerInfo(), () => - this.startDeps.reporting.getScreenshots({ + this.startDeps.reporting.getScreenshots!({ format: 'pdf', title, logo, diff --git a/x-pack/plugins/reporting/server/routes/internal/diagnostic/browser.ts b/x-pack/plugins/reporting/server/routes/internal/diagnostic/browser.ts index 34c7583f9ef06..703dd5b24a97b 100644 --- a/x-pack/plugins/reporting/server/routes/internal/diagnostic/browser.ts +++ b/x-pack/plugins/reporting/server/routes/internal/diagnostic/browser.ts @@ -54,6 +54,7 @@ export const registerDiagnoseBrowser = (reporting: ReportingCore, logger: Logger const logsToHelpMap = logsToHelpMapFactory(docLinks); try { const { screenshotting } = await reporting.getPluginStartDeps(); + if (!screenshotting) throw new Error('Screenshotting is not enabled!'); const logs = await lastValueFrom(screenshotting.diagnose()); const knownIssues = Object.keys(logsToHelpMap) as Array; diff --git a/x-pack/plugins/reporting/server/types.ts b/x-pack/plugins/reporting/server/types.ts index da1e7f1f93037..d2ece5f1e2fab 100644 --- a/x-pack/plugins/reporting/server/types.ts +++ b/x-pack/plugins/reporting/server/types.ts @@ -41,7 +41,7 @@ import { ExportTypesRegistry } from './lib'; export interface ReportingSetup { registerExportTypes: ExportTypesRegistry['register']; getSpaceId: ReportingCore['getSpaceId']; - getScreenshots: ReportingCore['getScreenshots']; + getScreenshots?: ReportingCore['getScreenshots']; /** * Used to inform plugins if Reporting config is compatible with UI Capabilities / Application Sub-Feature Controls */ @@ -93,7 +93,7 @@ export type RunTaskFn = ( export interface ReportingSetupDeps { features: FeaturesPluginSetup; - screenshotMode: ScreenshotModePluginSetup; + screenshotMode?: ScreenshotModePluginSetup; security?: SecurityPluginSetup; spaces?: SpacesPluginSetup; taskManager: TaskManagerSetupContract; @@ -105,7 +105,7 @@ export interface ReportingStartDeps { discover: DiscoverServerPluginStart; fieldFormats: FieldFormatsStart; licensing: LicensingPluginStart; - screenshotting: ScreenshottingStart; + screenshotting?: ScreenshottingStart; security?: SecurityPluginStart; taskManager: TaskManagerStartContract; } diff --git a/x-pack/plugins/screenshotting/server/browsers/chromium/driver.test.ts b/x-pack/plugins/screenshotting/server/browsers/chromium/driver.test.ts index fb07eac64ed17..c9b9bbc9f8b03 100644 --- a/x-pack/plugins/screenshotting/server/browsers/chromium/driver.test.ts +++ b/x-pack/plugins/screenshotting/server/browsers/chromium/driver.test.ts @@ -26,6 +26,7 @@ describe('chromium driver', () => { mockLogger.get = () => mockLogger; mockConfig = { + enabled: true, networkPolicy: { enabled: false, rules: [], diff --git a/x-pack/plugins/screenshotting/server/config/schema.test.ts b/x-pack/plugins/screenshotting/server/config/schema.test.ts index bb68e8e938ace..a3a141429b4db 100644 --- a/x-pack/plugins/screenshotting/server/config/schema.test.ts +++ b/x-pack/plugins/screenshotting/server/config/schema.test.ts @@ -27,6 +27,7 @@ describe('ConfigSchema', () => { }, "zoom": 2, }, + "enabled": true, "networkPolicy": Object { "enabled": true, "rules": Array [ @@ -87,6 +88,7 @@ describe('ConfigSchema', () => { }, "zoom": 2, }, + "enabled": true, "networkPolicy": Object { "enabled": true, "rules": Array [ diff --git a/x-pack/plugins/screenshotting/server/config/schema.ts b/x-pack/plugins/screenshotting/server/config/schema.ts index 724f84ea3c811..0dda1e3ae9981 100644 --- a/x-pack/plugins/screenshotting/server/config/schema.ts +++ b/x-pack/plugins/screenshotting/server/config/schema.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { schema, TypeOf } from '@kbn/config-schema'; +import { schema, TypeOf, offeringBasedSchema } from '@kbn/config-schema'; import moment from 'moment'; const RulesSchema = schema.object({ @@ -23,6 +23,10 @@ const RulesSchema = schema.object({ }); export const ConfigSchema = schema.object({ + enabled: offeringBasedSchema({ + serverless: schema.boolean({ defaultValue: false }), + traditional: schema.boolean({ defaultValue: true }), + }), networkPolicy: schema.object({ enabled: schema.boolean({ defaultValue: true }), rules: schema.arrayOf(RulesSchema, { diff --git a/x-pack/plugins/screenshotting/server/screenshots/index.test.ts b/x-pack/plugins/screenshotting/server/screenshots/index.test.ts index f8bbbc081f38f..9538517d922ef 100644 --- a/x-pack/plugins/screenshotting/server/screenshots/index.test.ts +++ b/x-pack/plugins/screenshotting/server/screenshots/index.test.ts @@ -68,6 +68,7 @@ describe('Screenshot Observable Pipeline', () => { urls: ['/welcome/home/start/index.htm'], }; config = { + enabled: true, poolSize: 1, capture: { timeouts: { diff --git a/x-pack/plugins/screenshotting/server/screenshots/screenshots.test.ts b/x-pack/plugins/screenshotting/server/screenshots/screenshots.test.ts index d5e8757803c81..30803fcc95c32 100644 --- a/x-pack/plugins/screenshotting/server/screenshots/screenshots.test.ts +++ b/x-pack/plugins/screenshotting/server/screenshots/screenshots.test.ts @@ -37,6 +37,7 @@ describe('class Screenshots', () => { mockLogger = loggerMock.create(); mockConfig = { + enabled: true, networkPolicy: { enabled: false, rules: [], From 7f6b201e14959ba8418459a2d57a64d318c64199 Mon Sep 17 00:00:00 2001 From: Yuliia Naumenko Date: Thu, 12 Oct 2023 12:34:23 -0700 Subject: [PATCH 04/11] [Security Solution] Fixing ESQL Timeline tab content availability and variables naming (#168421) This PR revert the changes made [here](https://github.com/elastic/kibana/pull/168144) and changing the variables naming in the code to avoid the future confusion --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Michael Olorunnisola Co-authored-by: Jatin Kathuria --- .../common/experimental_features.ts | 6 ---- .../common/types/timeline/index.ts | 2 +- .../public/actions/constants.ts | 4 +-- .../discover_in_timeline/vis_apply_filter.ts | 13 ++++----- .../security_solution/public/actions/types.ts | 2 +- .../alerts/use_signal_index.test.tsx | 2 +- .../__mocks__/index.tsx | 6 ++-- .../customizations/mock.data.ts | 0 .../use_histogram_customizations.test.ts | 0 .../use_histogram_customizations.tsx | 6 ++-- .../use_search_bar_customizations.tsx | 4 +-- .../use_set_discover_customizations.ts | 0 .../index.test.tsx | 0 .../index.tsx | 0 .../mocks/esql_tab_content.tsx} | 4 +-- .../mocks/index.ts | 6 ++-- .../styles.tsx | 0 .../translations.ts | 0 .../use_discover_state.ts | 0 .../use_get_stateful_query_bar.test.tsx | 0 .../use_get_stateful_query_bar.tsx | 0 .../utils/index.test.ts | 0 .../utils/index.ts | 0 .../utils/test_utils.ts | 0 .../timeline/tabs_content/index.tsx | 28 +++++++++++++------ .../test/security_solution_cypress/config.ts | 1 - .../{discover => esql}/cell_actions.cy.ts | 7 ++--- .../discover_timeline_state_integration.cy.ts | 14 ++++------ .../esql_state.cy.ts} | 18 ++++-------- .../{discover => esql}/search_filter.cy.ts | 13 ++++----- .../cypress/screens/timeline.ts | 2 +- .../cypress/tasks/discover.ts | 10 +++++-- .../cypress/tasks/timeline.ts | 10 +++---- 33 files changed, 73 insertions(+), 85 deletions(-) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/__mocks__/index.tsx (65%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/customizations/mock.data.ts (100%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/customizations/use_histogram_customizations.test.ts (100%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/customizations/use_histogram_customizations.tsx (94%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/customizations/use_search_bar_customizations.tsx (75%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/customizations/use_set_discover_customizations.ts (100%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/index.test.tsx (100%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/index.tsx (100%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content/mocks/discover_tab_content.tsx => esql_tab_content/mocks/esql_tab_content.tsx} (85%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/mocks/index.ts (75%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/styles.tsx (100%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/translations.ts (100%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/use_discover_state.ts (100%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/use_get_stateful_query_bar.test.tsx (100%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/use_get_stateful_query_bar.tsx (100%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/utils/index.test.ts (100%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/utils/index.ts (100%) rename x-pack/plugins/security_solution/public/timelines/components/timeline/{discover_tab_content => esql_tab_content}/utils/test_utils.ts (100%) rename x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/{discover => esql}/cell_actions.cy.ts (91%) rename x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/{discover => esql}/discover_timeline_state_integration.cy.ts (97%) rename x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/{discover/discover_state.cy.ts => esql/esql_state.cy.ts} (87%) rename x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/{discover => esql}/search_filter.cy.ts (86%) diff --git a/x-pack/plugins/security_solution/common/experimental_features.ts b/x-pack/plugins/security_solution/common/experimental_features.ts index a30b5cfe17ae6..90346011c23e5 100644 --- a/x-pack/plugins/security_solution/common/experimental_features.ts +++ b/x-pack/plugins/security_solution/common/experimental_features.ts @@ -103,12 +103,6 @@ export const allowedExperimentalValues = Object.freeze({ * Enables experimental Entity Analytics HTTP endpoints */ riskScoringRoutesEnabled: true, - /* - * - * Enables Discover embedded within timeline - * - * */ - discoverInTimeline: true, /** * disables ES|QL rules diff --git a/x-pack/plugins/security_solution/common/types/timeline/index.ts b/x-pack/plugins/security_solution/common/types/timeline/index.ts index 7148009246dcd..0372765db9873 100644 --- a/x-pack/plugins/security_solution/common/types/timeline/index.ts +++ b/x-pack/plugins/security_solution/common/types/timeline/index.ts @@ -37,7 +37,7 @@ export enum TimelineTabs { eql = 'eql', session = 'session', securityAssistant = 'securityAssistant', - discover = 'discover', + esql = 'esql', } /* diff --git a/x-pack/plugins/security_solution/public/actions/constants.ts b/x-pack/plugins/security_solution/public/actions/constants.ts index 95c5ef2d788d2..95e72e70ccbab 100644 --- a/x-pack/plugins/security_solution/public/actions/constants.ts +++ b/x-pack/plugins/security_solution/public/actions/constants.ts @@ -10,11 +10,11 @@ export enum SecurityCellActionsTrigger { ALERTS_COUNT = 'security-alertsCount-cellActions', } -export enum DiscoverInTimelineTrigger { +export enum EsqlInTimelineTrigger { HISTOGRAM_TRIGGER = 'security-discoverInTimeline-histogramTrigger', } -export enum DiscoverInTimelineAction { +export enum EsqlInTimelineAction { VIS_FILTER_ACTION = 'security-discoverInTimeline-visFilterAction', } diff --git a/x-pack/plugins/security_solution/public/actions/discover_in_timeline/vis_apply_filter.ts b/x-pack/plugins/security_solution/public/actions/discover_in_timeline/vis_apply_filter.ts index 5b6d2f547c491..8c3f9e0214a63 100644 --- a/x-pack/plugins/security_solution/public/actions/discover_in_timeline/vis_apply_filter.ts +++ b/x-pack/plugins/security_solution/public/actions/discover_in_timeline/vis_apply_filter.ts @@ -9,7 +9,7 @@ import { createFilterAction } from '@kbn/unified-search-plugin/public'; import type { History } from 'history'; import type { SecurityAppStore } from '../../common/store'; import type { StartServices } from '../../types'; -import { DiscoverInTimelineTrigger, DiscoverInTimelineAction } from '../constants'; +import { EsqlInTimelineTrigger, EsqlInTimelineAction } from '../constants'; const createDiscoverHistogramCustomFilterAction = ( store: SecurityAppStore, @@ -20,8 +20,8 @@ const createDiscoverHistogramCustomFilterAction = ( services.customDataService.query.filterManager, services.customDataService.query.timefilter.timefilter, services.theme, - DiscoverInTimelineAction.VIS_FILTER_ACTION, - DiscoverInTimelineAction.VIS_FILTER_ACTION + EsqlInTimelineAction.VIS_FILTER_ACTION, + EsqlInTimelineAction.VIS_FILTER_ACTION ); services.uiActions.registerAction(histogramApplyFilter); @@ -34,7 +34,7 @@ const createDiscoverHistogramCustomTrigger = ( services: StartServices ) => { services.uiActions.registerTrigger({ - id: DiscoverInTimelineTrigger.HISTOGRAM_TRIGGER, + id: EsqlInTimelineTrigger.HISTOGRAM_TRIGGER, }); }; @@ -47,8 +47,5 @@ export const registerDiscoverHistogramActions = ( const histogramApplyFilter = createDiscoverHistogramCustomFilterAction(store, history, services); - services.uiActions.attachAction( - DiscoverInTimelineTrigger.HISTOGRAM_TRIGGER, - histogramApplyFilter.id - ); + services.uiActions.attachAction(EsqlInTimelineTrigger.HISTOGRAM_TRIGGER, histogramApplyFilter.id); }; diff --git a/x-pack/plugins/security_solution/public/actions/types.ts b/x-pack/plugins/security_solution/public/actions/types.ts index 582c63c467360..3450f6796ce27 100644 --- a/x-pack/plugins/security_solution/public/actions/types.ts +++ b/x-pack/plugins/security_solution/public/actions/types.ts @@ -7,7 +7,7 @@ import type { CellAction, CellActionExecutionContext, CellActionFactory } from '@kbn/cell-actions'; import type { QueryOperator } from '../../common/types'; -export { DiscoverInTimelineAction, DiscoverInTimelineTrigger } from './constants'; +export { EsqlInTimelineTrigger, EsqlInTimelineAction } from './constants'; export interface AndFilter { field: string; value: string | string[]; diff --git a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/alerts/use_signal_index.test.tsx b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/alerts/use_signal_index.test.tsx index 8966232ef2b53..f4849978fa206 100644 --- a/x-pack/plugins/security_solution/public/detections/containers/detection_engine/alerts/use_signal_index.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/containers/detection_engine/alerts/use_signal_index.test.tsx @@ -15,7 +15,7 @@ import { useAppToasts } from '../../../../common/hooks/use_app_toasts'; jest.mock('./api'); jest.mock('../../../../common/hooks/use_app_toasts'); jest.mock('../../../../common/components/user_privileges/endpoint/use_endpoint_privileges'); -jest.mock('../../../../timelines/components/timeline/discover_tab_content'); +jest.mock('../../../../timelines/components/timeline/esql_tab_content'); describe('useSignalIndex', () => { let appToastsMock: jest.Mocked>; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/__mocks__/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/__mocks__/index.tsx similarity index 65% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/__mocks__/index.tsx rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/__mocks__/index.tsx index 728f24b11015e..b3820c62d92b9 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/__mocks__/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/__mocks__/index.tsx @@ -5,9 +5,9 @@ * 2.0. */ -import { MockDiscoverTabContent } from '../mocks/discover_tab_content'; +import { MockEsqlTabContent } from '../mocks/esql_tab_content'; -export const DiscoverTabContent = MockDiscoverTabContent; +export const EsqlTabContent = MockEsqlTabContent; // eslint-disable-next-line import/no-default-export -export default DiscoverTabContent; +export default EsqlTabContent; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/customizations/mock.data.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/customizations/mock.data.ts similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/customizations/mock.data.ts rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/customizations/mock.data.ts diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/customizations/use_histogram_customizations.test.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/customizations/use_histogram_customizations.test.ts similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/customizations/use_histogram_customizations.test.ts rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/customizations/use_histogram_customizations.test.ts diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/customizations/use_histogram_customizations.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/customizations/use_histogram_customizations.tsx similarity index 94% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/customizations/use_histogram_customizations.tsx rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/customizations/use_histogram_customizations.tsx index 9ff69adbf4655..65a7f1a977696 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/customizations/use_histogram_customizations.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/customizations/use_histogram_customizations.tsx @@ -14,7 +14,7 @@ import type { CustomizationCallback } from '@kbn/discover-plugin/public'; import type { UnifiedHistogramContainerProps } from '@kbn/unified-histogram-plugin/public'; import { ACTION_GLOBAL_APPLY_FILTER } from '@kbn/unified-search-plugin/public'; import { useCallback } from 'react'; -import { DiscoverInTimelineTrigger } from '../../../../../actions/constants'; +import { EsqlInTimelineTrigger } from '../../../../../actions/constants'; import { useKibana } from '../../../../../common/lib/kibana'; export type WithPreventableEvent = T & { @@ -67,9 +67,7 @@ export const useHistogramCustomization = () => { } if (filters && filters.length > 0) { - const applyFilterTrigger = uiActions.getTrigger( - DiscoverInTimelineTrigger.HISTOGRAM_TRIGGER - ); + const applyFilterTrigger = uiActions.getTrigger(EsqlInTimelineTrigger.HISTOGRAM_TRIGGER); await applyFilterTrigger.exec({ filters, diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/customizations/use_search_bar_customizations.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/customizations/use_search_bar_customizations.tsx similarity index 75% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/customizations/use_search_bar_customizations.tsx rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/customizations/use_search_bar_customizations.tsx index c748357bb24b8..0e74125e5ada4 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/customizations/use_search_bar_customizations.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/customizations/use_search_bar_customizations.tsx @@ -6,18 +6,16 @@ */ import type { CustomizationCallback } from '@kbn/discover-plugin/public'; -import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use_experimental_features'; import { useGetStatefulQueryBar } from '../use_get_stateful_query_bar'; export const useSearchBarCustomizations = () => { const { CustomStatefulTopNavKqlQueryBar } = useGetStatefulQueryBar(); - const isDiscoverInTimelineEnabled = useIsExperimentalFeatureEnabled('discoverInTimeline'); const setSearchBarCustomizations: CustomizationCallback = ({ customizations }) => { customizations.set({ id: 'search_bar', CustomSearchBar: CustomStatefulTopNavKqlQueryBar, - hideDataViewPicker: isDiscoverInTimelineEnabled, + hideDataViewPicker: true, }); }; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/customizations/use_set_discover_customizations.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/customizations/use_set_discover_customizations.ts similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/customizations/use_set_discover_customizations.ts rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/customizations/use_set_discover_customizations.ts diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/index.test.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/index.test.tsx rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/index.test.tsx diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/index.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/index.tsx rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/index.tsx diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/mocks/discover_tab_content.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/mocks/esql_tab_content.tsx similarity index 85% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/mocks/discover_tab_content.tsx rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/mocks/esql_tab_content.tsx index d49c197250bc3..aaa1104233a3a 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/mocks/discover_tab_content.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/mocks/esql_tab_content.tsx @@ -8,10 +8,10 @@ import React from 'react'; import { EmbeddedDiscoverContainer } from '../styles'; -export function MockDiscoverTabContent() { +export function MockEsqlTabContent() { return ( - {'Mock Discover Tab Content'} + {'Mock ESQL Tab Content'} ); } diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/mocks/index.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/mocks/index.ts similarity index 75% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/mocks/index.ts rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/mocks/index.ts index b77dbfd0d1e79..91fced5a4b2b0 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/mocks/index.ts +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/mocks/index.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { DiscoverInTimelineTrigger } from '../../../../../actions/constants'; -export { MockDiscoverTabContent } from './discover_tab_content'; +import { EsqlInTimelineTrigger } from '../../../../../actions/constants'; +export { MockEsqlTabContent } from './esql_tab_content'; export const mockApplyFilterTrigger = { exec: jest.fn().mockResolvedValue(undefined), @@ -16,7 +16,7 @@ export const mockPreventDefault = jest.fn(); export const mockUIActionsGetTrigger = jest.fn().mockImplementation((triggerName: string) => { switch (triggerName) { - case DiscoverInTimelineTrigger.HISTOGRAM_TRIGGER: + case EsqlInTimelineTrigger.HISTOGRAM_TRIGGER: return mockApplyFilterTrigger; default: return undefined; diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/styles.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/styles.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/styles.tsx rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/styles.tsx diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/translations.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/translations.ts similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/translations.ts rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/translations.ts diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/use_discover_state.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/use_discover_state.ts similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/use_discover_state.ts rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/use_discover_state.ts diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/use_get_stateful_query_bar.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/use_get_stateful_query_bar.test.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/use_get_stateful_query_bar.test.tsx rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/use_get_stateful_query_bar.test.tsx diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/use_get_stateful_query_bar.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/use_get_stateful_query_bar.tsx similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/use_get_stateful_query_bar.tsx rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/use_get_stateful_query_bar.tsx diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/utils/index.test.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/utils/index.test.ts similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/utils/index.test.ts rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/utils/index.test.ts diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/utils/index.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/utils/index.ts similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/utils/index.ts rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/utils/index.ts diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/utils/test_utils.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/utils/test_utils.ts similarity index 100% rename from x-pack/plugins/security_solution/public/timelines/components/timeline/discover_tab_content/utils/test_utils.ts rename to x-pack/plugins/security_solution/public/timelines/components/timeline/esql_tab_content/utils/test_utils.ts diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/tabs_content/index.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/tabs_content/index.tsx index 71c41b5dd5c9f..2109420b5d6aa 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/tabs_content/index.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/tabs_content/index.tsx @@ -15,8 +15,8 @@ import { useDispatch } from 'react-redux'; import styled from 'styled-components'; import { FormattedMessage } from '@kbn/i18n-react'; +import { useKibana } from '../../../../common/lib/kibana'; import { useAssistantTelemetry } from '../../../../assistant/use_assistant_telemetry'; -import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features'; import { useConversationStore } from '../../../../assistant/use_conversation_store'; import { useAssistantAvailability } from '../../../../assistant/use_assistant_availability'; import type { SessionViewConfig } from '../../../../../common/types'; @@ -88,6 +88,7 @@ const GraphTab = tabWithSuspense(lazy(() => import('../graph_tab_content'))); const NotesTab = tabWithSuspense(lazy(() => import('../notes_tab_content'))); const PinnedTab = tabWithSuspense(lazy(() => import('../pinned_tab_content'))); const SessionTab = tabWithSuspense(lazy(() => import('../session_tab_content'))); +const EsqlTab = tabWithSuspense(lazy(() => import('../esql_tab_content'))); interface BasicTimelineTab { renderCellValue: (props: CellValueElementProps) => React.ReactNode; rowRenderers: RowRenderer[]; @@ -132,6 +133,7 @@ const ActiveTimelineTab = memo( setConversationId, showTimeline, }) => { + const isEsqlSettingEnabled = useKibana().services.configSettings.ESQLEnabled; const { hasAssistantPrivilege } = useAssistantAvailability(); const getTab = useCallback( (tab: TimelineTabs) => { @@ -179,6 +181,14 @@ const ActiveTimelineTab = memo( timelineId={timelineId} /> + {isEsqlSettingEnabled && ( + + + + )} = ({ sessionViewConfig, timelineDescription, }) => { - const isDiscoverInTimelineEnabled = useIsExperimentalFeatureEnabled('discoverInTimeline'); + const isEsqlSettingEnabled = useKibana().services.configSettings.ESQLEnabled; const { hasAssistantPrivilege } = useAssistantAvailability(); const dispatch = useDispatch(); const getActiveTab = useMemo(() => getActiveTabSelector(), []); @@ -360,13 +370,13 @@ const TabsContentComponent: React.FC = ({ } }, [activeTab, conversationId, reportAssistantInvoked, setActiveTab]); - const setDiscoverAsActiveTab = useCallback(() => { + const setEsqlAsActiveTab = useCallback(() => { dispatch( initializeTimelineSettings({ id: timelineId, }) ); - setActiveTab(TimelineTabs.discover); + setActiveTab(TimelineTabs.esql); }, [setActiveTab, dispatch, timelineId]); useEffect(() => { @@ -389,13 +399,13 @@ const TabsContentComponent: React.FC = ({ {i18n.QUERY_TAB} {showTimeline && } - {isDiscoverInTimelineEnabled && ( + {isEsqlSettingEnabled && ( {i18n.DISCOVER_ESQL_IN_TIMELINE_TAB} { @@ -34,7 +33,7 @@ describe.skip( login(); visitWithTimeRange(ALERTS_URL); createNewTimeline(); - gotToDiscoverTab(); + gotToEsqlTab(); updateDateRangeInLocalDatePickers(DISCOVER_CONTAINER, INITIAL_START_DATE, INITIAL_END_DATE); waitForDiscoverGridToLoad(); }); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/discover/discover_timeline_state_integration.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/esql/discover_timeline_state_integration.cy.ts similarity index 97% rename from x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/discover/discover_timeline_state_integration.cy.ts rename to x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/esql/discover_timeline_state_integration.cy.ts index 71b268e090b56..d1a446df25a5a 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/discover/discover_timeline_state_integration.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/esql/discover_timeline_state_integration.cy.ts @@ -34,7 +34,7 @@ import { addDescriptionToTimeline, addNameToTimeline, createNewTimeline, - gotToDiscoverTab, + gotToEsqlTab, openTimelineById, openTimelineFromSettings, waitForTimelineChanges, @@ -60,11 +60,9 @@ const TIMELINE_RESPONSE_SAVED_OBJECT_ID_PATH = 'response.body.data.persistTimeline.timeline.savedObjectId'; const esqlQuery = 'from auditbeat-* | where ecs.version == "8.0.0"'; -// TODO: reuse or remove this tests when ESQL tab will be added -describe.skip( +describe( 'Discover Timeline State Integration', { - env: { ftrConfig: { enableExperimental: ['discoverInTimeline'] } }, tags: ['@ess', '@brokenInServerless'], // ESQL and test involving STACK_MANAGEMENT_PAGE are broken in serverless }, @@ -109,14 +107,14 @@ describe.skip( login(); visitWithTimeRange(ALERTS_URL); createNewTimeline(); - gotToDiscoverTab(); + gotToEsqlTab(); updateDateRangeInLocalDatePickers(DISCOVER_CONTAINER, INITIAL_START_DATE, INITIAL_END_DATE); }); context('save/restore', () => { it('should be able create an empty timeline with default discover state', () => { addNameToTimeline('Timerange timeline'); createNewTimeline(); - gotToDiscoverTab(); + gotToEsqlTab(); cy.get(GET_LOCAL_SHOW_DATES_BUTTON(DISCOVER_CONTAINER)).should( 'contain.text', `Last 15 minutes` @@ -143,7 +141,7 @@ describe.skip( openTimelineFromSettings(); openTimelineById(timelineId); cy.get(LOADING_INDICATOR).should('not.exist'); - gotToDiscoverTab(); + gotToEsqlTab(); verifyDiscoverEsqlQuery(esqlQuery); cy.get(GET_DISCOVER_DATA_GRID_CELL_HEADER(column1)).should('exist'); cy.get(GET_DISCOVER_DATA_GRID_CELL_HEADER(column2)).should('exist'); @@ -193,7 +191,7 @@ describe.skip( openTimelineFromSettings(); openTimelineById(timelineId); cy.get(LOADING_INDICATOR).should('not.exist'); - gotToDiscoverTab(); + gotToEsqlTab(); cy.get(DISCOVER_DATA_VIEW_SWITCHER.BTN).should('not.exist'); }); }); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/discover/discover_state.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/esql/esql_state.cy.ts similarity index 87% rename from x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/discover/discover_state.cy.ts rename to x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/esql/esql_state.cy.ts index 06c934083cd88..ef79bf8bf4d48 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/discover/discover_state.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/esql/esql_state.cy.ts @@ -20,11 +20,7 @@ import { import { updateDateRangeInLocalDatePickers } from '../../../../tasks/date_picker'; import { login } from '../../../../tasks/login'; import { visitWithTimeRange } from '../../../../tasks/navigation'; -import { - createNewTimeline, - gotToDiscoverTab, - openActiveTimeline, -} from '../../../../tasks/timeline'; +import { createNewTimeline, gotToEsqlTab, openActiveTimeline } from '../../../../tasks/timeline'; import { ALERTS_URL } from '../../../../urls/navigation'; import { ALERTS, CSP_FINDINGS } from '../../../../screens/security_header'; @@ -33,11 +29,9 @@ const INITIAL_END_DATE = 'Jan 19, 2024 @ 20:33:29.186'; const DEFAULT_ESQL_QUERY = 'from .alerts-security.alerts-default,apm-*-transaction*,auditbeat-*,endgame-*,filebeat-*,logs-*,packetbeat-*,traces-apm*,winlogbeat-*,-*elastic-cloud-logs-* | limit 10'; -// TODO: reuse or remove this tests when ESQL tab will be added -describe.skip( - 'Discover State', +describe( + 'Timeline Discover ESQL State', { - env: { ftrConfig: { enableExperimental: ['discoverInTimeline'] } }, tags: ['@ess'], }, () => { @@ -45,7 +39,7 @@ describe.skip( login(); visitWithTimeRange(ALERTS_URL); createNewTimeline(); - gotToDiscoverTab(); + gotToEsqlTab(); updateDateRangeInLocalDatePickers(DISCOVER_CONTAINER, INITIAL_START_DATE, INITIAL_END_DATE); }); it('should not allow the dataview to be changed', () => { @@ -61,7 +55,7 @@ describe.skip( navigateFromHeaderTo(CSP_FINDINGS); navigateFromHeaderTo(ALERTS); openActiveTimeline(); - gotToDiscoverTab(); + gotToEsqlTab(); verifyDiscoverEsqlQuery(esqlQuery); }); @@ -71,7 +65,7 @@ describe.skip( navigateFromHeaderTo(CSP_FINDINGS); navigateFromHeaderTo(ALERTS); openActiveTimeline(); - gotToDiscoverTab(); + gotToEsqlTab(); cy.get(GET_DISCOVER_DATA_GRID_CELL_HEADER('host.name')).should('exist'); cy.get(GET_DISCOVER_DATA_GRID_CELL_HEADER('user.name')).should('exist'); }); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/discover/search_filter.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/esql/search_filter.cy.ts similarity index 86% rename from x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/discover/search_filter.cy.ts rename to x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/esql/search_filter.cy.ts index cfe3ca421de36..1e3539ab58527 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/discover/search_filter.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/esql/search_filter.cy.ts @@ -23,7 +23,7 @@ import { addFieldToTable, convertNBSPToSP, } from '../../../../tasks/discover'; -import { createNewTimeline, gotToDiscoverTab } from '../../../../tasks/timeline'; +import { createNewTimeline, gotToEsqlTab } from '../../../../tasks/timeline'; import { login } from '../../../../tasks/login'; import { visitWithTimeRange } from '../../../../tasks/navigation'; import { ALERTS_URL } from '../../../../urls/navigation'; @@ -33,12 +33,9 @@ const INITIAL_END_DATE = 'Jan 19, 2024 @ 20:33:29.186'; const NEW_START_DATE = 'Jan 18, 2023 @ 20:33:29.186'; const esqlQuery = 'from auditbeat-* | where ecs.version == "8.0.0"'; -// Failing: See https://github.com/elastic/kibana/issues/167186 -// TODO: reuse or remove this tests when ESQL tab will be added -describe.skip( - 'Basic discover search and filter operations', +describe( + 'Basic esql search and filter operations', { - env: { ftrConfig: { enableExperimental: ['discoverInTimeline'] } }, tags: ['@ess'], }, () => { @@ -46,7 +43,7 @@ describe.skip( login(); visitWithTimeRange(ALERTS_URL); createNewTimeline(); - gotToDiscoverTab(); + gotToEsqlTab(); updateDateRangeInLocalDatePickers(DISCOVER_CONTAINER, INITIAL_START_DATE, INITIAL_END_DATE); }); @@ -63,7 +60,7 @@ describe.skip( }); context('navigation', () => { - it('should removed the query when back is pressed after adding a query', () => { + it('should remove the query when back is pressed after adding a query', () => { addDiscoverEsqlQuery(esqlQuery); submitDiscoverSearchBar(); cy.get(DISCOVER_ESQL_INPUT_TEXT_CONTAINER).then((subj) => { diff --git a/x-pack/test/security_solution_cypress/cypress/screens/timeline.ts b/x-pack/test/security_solution_cypress/cypress/screens/timeline.ts index 78b25d890c9c7..2c89a0a5877bd 100644 --- a/x-pack/test/security_solution_cypress/cypress/screens/timeline.ts +++ b/x-pack/test/security_solution_cypress/cypress/screens/timeline.ts @@ -341,7 +341,7 @@ export const GET_TIMELINE_HEADER = (fieldName: string) => { return `[data-test-subj="timeline"] [data-test-subj="header-text-${fieldName}"]`; }; -export const DISCOVER_TAB = getDataTestSubjectSelector('timelineTabs-discover'); +export const ESQL_TAB = getDataTestSubjectSelector('timelineTabs-esql'); export const TIMELINE_DATE_PICKER_CONTAINER = getDataTestSubjectSelector( 'timeline-date-picker-container' diff --git a/x-pack/test/security_solution_cypress/cypress/tasks/discover.ts b/x-pack/test/security_solution_cypress/cypress/tasks/discover.ts index e5d835bbe8c53..899acc1ff12cf 100644 --- a/x-pack/test/security_solution_cypress/cypress/tasks/discover.ts +++ b/x-pack/test/security_solution_cypress/cypress/tasks/discover.ts @@ -18,6 +18,7 @@ import { DISCOVER_ESQL_EDITABLE_INPUT, } from '../screens/discover'; import { GET_LOCAL_SEARCH_BAR_SUBMIT_BUTTON } from '../screens/search_bar'; +import { gotToEsqlTab } from './timeline'; export const switchDataViewTo = (dataviewName: string) => { openDataViewSwitcher(); @@ -44,9 +45,12 @@ export const waitForDiscoverGridToLoad = () => { cy.get(DISCOVER_FIELD_LIST_LOADING).should('not.exist'); }; -export const selectCurrentDiscoverEsqlQuery = (discoverEsqlInput = DISCOVER_ESQL_INPUT) => { - cy.get(discoverEsqlInput).click(); - cy.get(discoverEsqlInput).focused(); +export const selectCurrentDiscoverEsqlQuery = ( + discoverEsqlInput = DISCOVER_ESQL_EDITABLE_INPUT +) => { + gotToEsqlTab(); + cy.get(discoverEsqlInput).should('be.visible').click(); + cy.get(discoverEsqlInput).should('be.focused'); cy.get(discoverEsqlInput).type(Cypress.platform === 'darwin' ? '{cmd+a}' : '{ctrl+a}'); }; diff --git a/x-pack/test/security_solution_cypress/cypress/tasks/timeline.ts b/x-pack/test/security_solution_cypress/cypress/tasks/timeline.ts index a0e81d1f244f7..2dc4447e75ffd 100644 --- a/x-pack/test/security_solution_cypress/cypress/tasks/timeline.ts +++ b/x-pack/test/security_solution_cypress/cypress/tasks/timeline.ts @@ -83,7 +83,7 @@ import { TIMELINE_QUERY, PROVIDER_BADGE, PROVIDER_BADGE_DELETE, - DISCOVER_TAB, + ESQL_TAB, OPEN_TIMELINE_MODAL_TIMELINE_NAMES, OPEN_TIMELINE_MODAL_SEARCH_BAR, OPEN_TIMELINE_MODAL, @@ -140,9 +140,9 @@ export const goToNotesTab = (): Cypress.Chainable> => { return cy.get(NOTES_TAB_BUTTON); }; -export const gotToDiscoverTab = () => { +export const gotToEsqlTab = () => { recurse( - () => cy.get(DISCOVER_TAB).click(), + () => cy.get(ESQL_TAB).should('be.visible').click({ force: true }), ($el) => expect($el).to.have.class('euiTab-isSelected'), { delay: 500, @@ -314,8 +314,8 @@ export const createNewTimeline = () => { cy.get(TIMELINE_SETTINGS_ICON).filter(':visible').click(); cy.get(TIMELINE_SETTINGS_ICON).should('be.visible'); // eslint-disable-next-line cypress/no-unnecessary-waiting - cy.wait(300); - cy.get(CREATE_NEW_TIMELINE).eq(0).should('be.visible').click(); + cy.wait(1000); + cy.get(CREATE_NEW_TIMELINE).eq(0).should('be.visible').click({ force: true }); }; export const openCreateTimelineOptionsPopover = () => { From 79e5c1e547f404b9f82f7f83016b7ae7502193ae Mon Sep 17 00:00:00 2001 From: Larry Gregory Date: Thu, 12 Oct 2023 15:44:02 -0400 Subject: [PATCH 05/11] Unskip Spaces a11y tests (#168705) ## Summary Unskips Spaces a11y tests that are no longer failing. Also updates CODEOWNERS to properly assign ownership of our a11y tests. Resolves https://github.com/elastic/kibana/issues/144155 --- .github/CODEOWNERS | 4 ++++ x-pack/test/accessibility/apps/spaces.ts | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index bd7585c307486..fb5ce6ad466e0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1095,6 +1095,10 @@ x-pack/plugins/cloud_integrations/cloud_full_story/server/config.ts @elastic/kib /test/interactive_setup_api_integration/ @elastic/kibana-security /test/interactive_setup_functional/ @elastic/kibana-security /test/plugin_functional/test_suites/core_plugins/rendering.ts @elastic/kibana-security +/x-pack/test/accessibility/apps/login_page.ts @elastic/kibana-security +/x-pack/test/accessibility/apps/roles.ts @elastic/kibana-security +/x-pack/test/accessibility/apps/spaces.ts @elastic/kibana-security +/x-pack/test/accessibility/apps/users.ts @elastic/kibana-security /x-pack/test/api_integration/apis/security/ @elastic/kibana-security /x-pack/test/api_integration/apis/spaces/ @elastic/kibana-security /x-pack/test/ui_capabilities/ @elastic/kibana-security diff --git a/x-pack/test/accessibility/apps/spaces.ts b/x-pack/test/accessibility/apps/spaces.ts index 2a4923a15d08c..622b1b3cefd64 100644 --- a/x-pack/test/accessibility/apps/spaces.ts +++ b/x-pack/test/accessibility/apps/spaces.ts @@ -85,9 +85,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); // creating space b and making it the current space so space selector page gets displayed when space b gets deleted - // Skipped due to an a11y violation - // https://github.com/elastic/kibana/issues/144155 - describe.skip('Create Space B and Verify', async () => { + describe('Create Space B and Verify', async () => { it('a11y test for delete space button', async () => { await PageObjects.spaceSelector.clickCreateSpace(); await PageObjects.spaceSelector.clickEnterSpaceName(); From eefc2752e80bf8feaa5bcaa0de69954cb5f5d607 Mon Sep 17 00:00:00 2001 From: Rickyanto Ang Date: Thu, 12 Oct 2023 13:05:49 -0700 Subject: [PATCH 06/11] [Cloud Security][FTR] FTR for GCP Orgs (#168314) ## Summary This PR adds FTRs for GCP Organization option --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .../public/common/constants.ts | 4 + .../csp_boxed_radio_group.tsx | 3 +- .../fleet_extensions/gcp_credential_form.tsx | 3 + .../fleet_extensions/policy_template_form.tsx | 2 + .../components/fleet_extensions/utils.ts | 1 + .../config.ts | 2 +- .../add_cis_integration_form_page.ts | 82 ++++++++++++++ .../page_objects/index.ts | 2 + .../pages/cis_integration.ts | 107 ++++++++++++++++++ .../pages/index.ts | 1 + 10 files changed, 205 insertions(+), 2 deletions(-) create mode 100644 x-pack/test/cloud_security_posture_functional/page_objects/add_cis_integration_form_page.ts create mode 100644 x-pack/test/cloud_security_posture_functional/pages/cis_integration.ts diff --git a/x-pack/plugins/cloud_security_posture/public/common/constants.ts b/x-pack/plugins/cloud_security_posture/public/common/constants.ts index 9f267e07569c2..7641745b897f4 100644 --- a/x-pack/plugins/cloud_security_posture/public/common/constants.ts +++ b/x-pack/plugins/cloud_security_posture/public/common/constants.ts @@ -63,6 +63,7 @@ export interface CloudPostureIntegrationProps { icon?: string; tooltip?: string; isBeta?: boolean; + testId?: string; }>; } @@ -85,6 +86,7 @@ export const cloudPostureIntegrations: CloudPostureIntegrations = { defaultMessage: 'CIS AWS', }), icon: 'logoAWS', + testId: 'cisAwsTestId', }, { type: CLOUDBEAT_GCP, @@ -95,6 +97,7 @@ export const cloudPostureIntegrations: CloudPostureIntegrations = { defaultMessage: 'CIS GCP', }), icon: googleCloudLogo, + testId: 'cisGcpTestId', }, // needs to be a function that disables/enabled based on integration version { @@ -108,6 +111,7 @@ export const cloudPostureIntegrations: CloudPostureIntegrations = { disabled: false, isBeta: true, icon: 'logoAzure', + testId: 'cisAzureTestId', }, ], }, diff --git a/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/csp_boxed_radio_group.tsx b/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/csp_boxed_radio_group.tsx index 9a50658a6a1f3..829d148097889 100644 --- a/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/csp_boxed_radio_group.tsx +++ b/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/csp_boxed_radio_group.tsx @@ -24,6 +24,7 @@ export interface CspRadioOption { icon?: string; tooltip?: string; isBeta?: boolean; + testId?: string; } export const RadioGroup = ({ @@ -34,7 +35,6 @@ export const RadioGroup = ({ onChange, }: CspRadioGroupProps) => { const { euiTheme } = useEuiTheme(); - return (
=> [ { id: SETUP_ACCESS_CLOUD_SHELL, @@ -240,6 +241,7 @@ const getSetupFormatOptions = (): Array<{ defaultMessage: 'Google Cloud Shell', }), disabled: false, + testId: 'gcpGoogleCloudShellOptionTestId', }, { id: SETUP_ACCESS_MANUAL, @@ -247,6 +249,7 @@ const getSetupFormatOptions = (): Array<{ defaultMessage: 'Manual', }), disabled: false, + testId: 'gcpManualOptionTestId', }, ]; diff --git a/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/policy_template_form.tsx b/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/policy_template_form.tsx index 9d1c52a0c1ee3..a4ec591d51c75 100644 --- a/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/policy_template_form.tsx +++ b/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/policy_template_form.tsx @@ -127,12 +127,14 @@ const getGcpAccountTypeOptions = (isGcpOrgDisabled: boolean): CspRadioGroupProps defaultMessage: 'Supported from integration version 1.6.0 and above', }) : undefined, + testId: 'gcpOrganizationAccountTestId', }, { id: GCP_SINGLE_ACCOUNT, label: i18n.translate('xpack.csp.fleetIntegration.gcpAccountType.gcpSingleAccountLabel', { defaultMessage: 'Single Account', }), + testId: 'gcpSingleAccountTestId', }, ]; diff --git a/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/utils.ts b/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/utils.ts index 9db4c9bf22a75..148a482714a10 100644 --- a/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/utils.ts +++ b/x-pack/plugins/cloud_security_posture/public/components/fleet_extensions/utils.ts @@ -225,6 +225,7 @@ export const getPolicyTemplateInputOptions = (policyTemplate: CloudSecurityPolic icon: o.icon, disabled: o.disabled, isBeta: o.isBeta, + testId: o.testId, })); export const getMaxPackageName = ( diff --git a/x-pack/test/cloud_security_posture_functional/config.ts b/x-pack/test/cloud_security_posture_functional/config.ts index 05f1477d84af1..53d87d2378db5 100644 --- a/x-pack/test/cloud_security_posture_functional/config.ts +++ b/x-pack/test/cloud_security_posture_functional/config.ts @@ -38,7 +38,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { * 2. merge the updated version number change to kibana */ `--xpack.fleet.packages.0.name=cloud_security_posture`, - `--xpack.fleet.packages.0.version=1.5.0`, + `--xpack.fleet.packages.0.version=1.6.0`, // `--xpack.fleet.registryUrl=https://localhost:8080`, ], }, diff --git a/x-pack/test/cloud_security_posture_functional/page_objects/add_cis_integration_form_page.ts b/x-pack/test/cloud_security_posture_functional/page_objects/add_cis_integration_form_page.ts new file mode 100644 index 0000000000000..924a2ae6c0dca --- /dev/null +++ b/x-pack/test/cloud_security_posture_functional/page_objects/add_cis_integration_form_page.ts @@ -0,0 +1,82 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { FtrProviderContext } from '../ftr_provider_context'; + +export function AddCisIntegrationFormPageProvider({ + getService, + getPageObjects, +}: FtrProviderContext) { + const testSubjects = getService('testSubjects'); + const PageObjects = getPageObjects(['common', 'header']); + + const cisGcp = { + getIntegrationFormEntirePage: () => testSubjects.find('dataCollectionSetupStep'), + + getIntegrationPolicyTable: () => testSubjects.find('integrationPolicyTable'), + + getIntegrationFormEditPage: () => testSubjects.find('editPackagePolicy_page'), + + findOptionInPage: async (text: string) => { + await PageObjects.header.waitUntilLoadingHasFinished(); + const optionToBeClicked = await testSubjects.find(text); + return await optionToBeClicked; + }, + + clickOptionButton: async (text: string) => { + const optionToBeClicked = await cisGcp.findOptionInPage(text); + await optionToBeClicked.click(); + }, + + clickSaveButton: async () => { + const optionToBeClicked = await cisGcp.findOptionInPage('createPackagePolicySaveButton'); + await optionToBeClicked.click(); + }, + + getPostInstallModal: async () => { + return await testSubjects.find('confirmModalTitleText'); + }, + + isPostInstallGoogleCloudShellModal: async (isOrg: boolean, orgID?: string, prjID?: string) => { + const googleCloudShellModal = await testSubjects.find('postInstallGoogleCloudShellModal'); + const googleCloudShellModalVisibleText = await googleCloudShellModal.getVisibleText(); + const stringProjectId = prjID ? prjID : ''; + const stringOrganizationId = orgID ? `ORG_ID=${orgID}` : 'ORG_ID='; + const orgIdExist = googleCloudShellModalVisibleText.includes(stringOrganizationId); + const prjIdExist = googleCloudShellModalVisibleText.includes(stringProjectId); + + if (isOrg) { + return orgIdExist === true && prjIdExist === true; + } else { + return orgIdExist === false && prjIdExist === true; + } + }, + + checkGcpFieldExist: async (text: string) => { + const field = await testSubjects.findAll(text); + return field.length; + }, + + fillInTextField: async (selector: string, text: string) => { + const test = await testSubjects.find(selector); + await test.type(text); + }, + }; + + const navigateToAddIntegrationCspmPage = async () => { + await PageObjects.common.navigateToUrl( + 'fleet', // Defined in Security Solution plugin + 'integrations/cloud_security_posture/add-integration/cspm', + { shouldUseHashForSubUrl: false } + ); + }; + + return { + cisGcp, + navigateToAddIntegrationCspmPage, + }; +} diff --git a/x-pack/test/cloud_security_posture_functional/page_objects/index.ts b/x-pack/test/cloud_security_posture_functional/page_objects/index.ts index 36dbf1bdc0fe9..84a75d27e4e2a 100644 --- a/x-pack/test/cloud_security_posture_functional/page_objects/index.ts +++ b/x-pack/test/cloud_security_posture_functional/page_objects/index.ts @@ -8,11 +8,13 @@ import { pageObjects as xpackFunctionalPageObjects } from '../../functional/page_objects'; import { FindingsPageProvider } from './findings_page'; import { CspDashboardPageProvider } from './csp_dashboard_page'; +import { AddCisIntegrationFormPageProvider } from './add_cis_integration_form_page'; import { VulnerabilityDashboardPageProvider } from './vulnerability_dashboard_page_object'; export const cloudSecurityPosturePageObjects = { findings: FindingsPageProvider, cloudPostureDashboard: CspDashboardPageProvider, + cisAddIntegration: AddCisIntegrationFormPageProvider, vulnerabilityDashboard: VulnerabilityDashboardPageProvider, }; export const pageObjects = { diff --git a/x-pack/test/cloud_security_posture_functional/pages/cis_integration.ts b/x-pack/test/cloud_security_posture_functional/pages/cis_integration.ts new file mode 100644 index 0000000000000..5935fc49b06a0 --- /dev/null +++ b/x-pack/test/cloud_security_posture_functional/pages/cis_integration.ts @@ -0,0 +1,107 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; +import type { FtrProviderContext } from '../ftr_provider_context'; + +const CIS_GCP_OPTION_TEST_ID = 'cisGcpTestId'; +const GCP_ORGANIZATION_TEST_ID = 'gcpOrganizationAccountTestId'; +const GCP_SINGLE_ACCOUNT_TEST_ID = 'gcpSingleAccountTestId'; +const GCP_CLOUD_SHELL_TEST_ID = 'gcpGoogleCloudShellOptionTestId'; +const GCP_MANUAL_TEST_ID = 'gcpManualOptionTestId'; +const PRJ_ID_TEST_ID = 'project_id_test_id'; +const ORG_ID_TEST_ID = 'organization_id_test_id'; +const CREDENTIALS_TYPE_TEST_ID = 'credentials_type_test_id'; + +// eslint-disable-next-line import/no-default-export +export default function (providerContext: FtrProviderContext) { + const { getPageObjects, getService } = providerContext; + const pageObjects = getPageObjects(['cloudPostureDashboard', 'cisAddIntegration', 'header']); + const kibanaServer = getService('kibanaServer'); + + describe('Test adding Cloud Security Posture Integrations', function () { + this.tags(['cloud_security_posture_cis_integration']); + let cisIntegrationGcp: typeof pageObjects.cisAddIntegration.cisGcp; + let cisIntegration: typeof pageObjects.cisAddIntegration; + + beforeEach(async () => { + cisIntegration = pageObjects.cisAddIntegration; + cisIntegrationGcp = pageObjects.cisAddIntegration.cisGcp; + + await cisIntegration.navigateToAddIntegrationCspmPage(); + }); + + after(async () => { + await kibanaServer.savedObjects.cleanStandardList(); + }); + + describe('CIS_GCP Organization', () => { + it('Switch between Manual and Google cloud shell', async () => { + await cisIntegrationGcp.clickOptionButton(CIS_GCP_OPTION_TEST_ID); + await cisIntegrationGcp.clickOptionButton(GCP_ORGANIZATION_TEST_ID); + await cisIntegrationGcp.clickOptionButton(GCP_MANUAL_TEST_ID); + /* Check for existing fields. In Manual, Credential field should be visible */ + expect((await cisIntegrationGcp.checkGcpFieldExist(PRJ_ID_TEST_ID)) === 1).to.be(true); + expect((await cisIntegrationGcp.checkGcpFieldExist(ORG_ID_TEST_ID)) === 1).to.be(true); + expect((await cisIntegrationGcp.checkGcpFieldExist(CREDENTIALS_TYPE_TEST_ID)) === 1).to.be( + true + ); + + await cisIntegrationGcp.clickOptionButton(GCP_CLOUD_SHELL_TEST_ID); + /* Check for existing fields. In Google Cloud Shell, Credential field should NOT be visible */ + expect((await cisIntegrationGcp.checkGcpFieldExist(PRJ_ID_TEST_ID)) === 1).to.be(true); + expect((await cisIntegrationGcp.checkGcpFieldExist(ORG_ID_TEST_ID)) === 1).to.be(true); + expect((await cisIntegrationGcp.checkGcpFieldExist(CREDENTIALS_TYPE_TEST_ID)) === 0).to.be( + true + ); + }); + + it('Post Installation Google Cloud Shell modal pops up after user clicks on Save button when adding integration, when there are no Project ID or Organization ID provided, it should use default value', async () => { + await cisIntegrationGcp.clickOptionButton(CIS_GCP_OPTION_TEST_ID); + await cisIntegrationGcp.clickOptionButton(GCP_ORGANIZATION_TEST_ID); + await cisIntegrationGcp.clickOptionButton(GCP_CLOUD_SHELL_TEST_ID); + await cisIntegrationGcp.clickSaveButton(); + pageObjects.header.waitUntilLoadingHasFinished(); + expect((await cisIntegrationGcp.isPostInstallGoogleCloudShellModal(true)) === true).to.be( + true + ); + }); + + it('Post Installation Google Cloud Shell modal pops up after user clicks on Save button when adding integration, when there are Project ID or Organization ID provided, it should use that value', async () => { + const projectName = 'PRJ_NAME_TEST'; + const organizationName = 'ORG_NAME_TEST'; + await cisIntegrationGcp.clickOptionButton(CIS_GCP_OPTION_TEST_ID); + await cisIntegrationGcp.clickOptionButton(GCP_ORGANIZATION_TEST_ID); + await cisIntegrationGcp.clickOptionButton(GCP_CLOUD_SHELL_TEST_ID); + await cisIntegrationGcp.fillInTextField('project_id_test_id', projectName); + await cisIntegrationGcp.fillInTextField('organization_id_test_id', organizationName); + + await cisIntegrationGcp.clickSaveButton(); + pageObjects.header.waitUntilLoadingHasFinished(); + expect( + (await cisIntegrationGcp.isPostInstallGoogleCloudShellModal( + true, + organizationName, + projectName + )) === true + ).to.be(true); + }); + + it('Organization ID field on cloud shell command should only be shown if user chose Google Cloud Shell, if user chose Single Account it shouldn not show up', async () => { + await cisIntegrationGcp.clickOptionButton(CIS_GCP_OPTION_TEST_ID); + await cisIntegrationGcp.clickOptionButton(GCP_SINGLE_ACCOUNT_TEST_ID); + await cisIntegrationGcp.clickOptionButton(GCP_CLOUD_SHELL_TEST_ID); + + await cisIntegrationGcp.clickSaveButton(); + pageObjects.header.waitUntilLoadingHasFinished(); + expect((await cisIntegrationGcp.isPostInstallGoogleCloudShellModal(false)) === true).to.be( + true + ); + }); + }); + }); +} diff --git a/x-pack/test/cloud_security_posture_functional/pages/index.ts b/x-pack/test/cloud_security_posture_functional/pages/index.ts index c1bcdaea38cf8..9d4e17ec0c88c 100644 --- a/x-pack/test/cloud_security_posture_functional/pages/index.ts +++ b/x-pack/test/cloud_security_posture_functional/pages/index.ts @@ -15,5 +15,6 @@ export default function ({ loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./findings_alerts')); loadTestFile(require.resolve('./compliance_dashboard')); loadTestFile(require.resolve('./vulnerability_dashboard')); + loadTestFile(require.resolve('./cis_integration')); }); } From adc9d43c84afa86138cb9666369a3abc03eb80a0 Mon Sep 17 00:00:00 2001 From: Kevin Logan <56395104+kevinlog@users.noreply.github.com> Date: Thu, 12 Oct 2023 16:07:49 -0400 Subject: [PATCH 07/11] [EDR Workflows] Add defend workflows cypress tests to flaky test runner (#168723) ## Summary Adds defend workflows tests to the flaky test runner, see example runs below from https://ci-stats.kibana.dev/trigger_flaky_test_runner/1 Select defend tests: image Regular: image Serverless: image Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .buildkite/pipelines/flaky_tests/groups.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.buildkite/pipelines/flaky_tests/groups.json b/.buildkite/pipelines/flaky_tests/groups.json index 2d715fcd8f27d..1a5799a862850 100644 --- a/.buildkite/pipelines/flaky_tests/groups.json +++ b/.buildkite/pipelines/flaky_tests/groups.json @@ -24,6 +24,14 @@ "key": "cypress/security_serverless_explore", "name": "[Serverless] Security Solution Explore - Cypress" }, + { + "key": "cypress/defend_workflows", + "name": "Security Solution Defend Workflows - Cypress" + }, + { + "key": "cypress/defend_workflows_serverless", + "name": "[Serverless] Security Solution Defend Workflows - Cypress" + }, { "key": "cypress/osquery_cypress", "name": "Osquery - Cypress" From 30cc89d0eac15942df7aef1746695ca0fc761c68 Mon Sep 17 00:00:00 2001 From: Rodney Norris Date: Thu, 12 Oct 2023 15:14:04 -0500 Subject: [PATCH 08/11] serverless_search: removing errant nbsp from go snippets (#168630) ## Summary Removing nbsp characters that somehow got into the golang snippets. --- .../details_page/details_page_overview/languages.ts | 6 +++--- .../public/application/components/languages/go.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/x-pack/plugins/index_management/public/application/sections/home/index_list/details_page/details_page_overview/languages.ts b/x-pack/plugins/index_management/public/application/sections/home/index_list/details_page/details_page_overview/languages.ts index 838efe28580c0..9904f7cbb70c7 100644 --- a/x-pack/plugins/index_management/public/application/sections/home/index_list/details_page/details_page_overview/languages.ts +++ b/x-pack/plugins/index_management/public/application/sections/home/index_list/details_page/details_page_overview/languages.ts @@ -69,10 +69,10 @@ export const goDefinition: LanguageDefinition = { "fmt" "log" "strings" -​ + "github.com/elastic/elasticsearch-serverless-go" ) -​ + func main() { cfg := elasticsearch.Config{ Address: "${url}", @@ -88,7 +88,7 @@ func main() { { "index": { "_id": "1"}} {"name": "foo", "title": "bar"}\n\`)). Do(context.Background()) - ​ + fmt.Println(res, err) }`, }; diff --git a/x-pack/plugins/serverless_search/public/application/components/languages/go.ts b/x-pack/plugins/serverless_search/public/application/components/languages/go.ts index 0ef4dc483ad53..d92195ad6d82e 100644 --- a/x-pack/plugins/serverless_search/public/application/components/languages/go.ts +++ b/x-pack/plugins/serverless_search/public/application/components/languages/go.ts @@ -23,7 +23,7 @@ fmt.Println(searchResp, err)`, "fmt" "log" "strings" -​ + "github.com/elastic/elasticsearch-serverless-go" ) @@ -69,10 +69,10 @@ fmt.Println(ingestResult, err)`, "fmt" "log" "strings" -​ + "github.com/elastic/elasticsearch-serverless-go" ) -​ + func main() { cfg := elasticsearch.Config{ Address: "${url}", @@ -88,7 +88,7 @@ func main() { { "index": { "_id": "1"}} {"name": "foo", "title": "bar"}\n\`)). Do(context.Background()) - ​ + fmt.Println(res, err) }`, installClient: 'go get -u github.com/elastic/elasticsearch-serverless-go@latest', From 60f530f873521ecf2eeeda490f4ed047025f6670 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 12 Oct 2023 21:35:31 +0100 Subject: [PATCH 09/11] skip flaky suite (#168427) --- .../automated_response_actions.cy.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/public/management/cypress/e2e/automated_response_actions/automated_response_actions.cy.ts b/x-pack/plugins/security_solution/public/management/cypress/e2e/automated_response_actions/automated_response_actions.cy.ts index a671b1c855f84..4186317a18e26 100644 --- a/x-pack/plugins/security_solution/public/management/cypress/e2e/automated_response_actions/automated_response_actions.cy.ts +++ b/x-pack/plugins/security_solution/public/management/cypress/e2e/automated_response_actions/automated_response_actions.cy.ts @@ -66,7 +66,8 @@ describe( disableExpandableFlyoutAdvancedSettings(); }); - describe('From alerts', () => { + // FLAKY: https://github.com/elastic/kibana/issues/168427 + describe.skip('From alerts', () => { let ruleId: string; let ruleName: string; @@ -83,7 +84,7 @@ describe( } }); - it.skip('should have generated endpoint and rule', () => { + it('should have generated endpoint and rule', () => { loadPage(APP_ENDPOINTS_PATH); cy.contains(createdHost.hostname).should('exist'); From a07fa0f75c881e048e2b9ec3d445f17b4ea5cd12 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 12 Oct 2023 21:37:14 +0100 Subject: [PATCH 10/11] skip flaky suite (#168284) --- .../management/cypress/e2e/endpoint_list/endpoints.cy.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/security_solution/public/management/cypress/e2e/endpoint_list/endpoints.cy.ts b/x-pack/plugins/security_solution/public/management/cypress/e2e/endpoint_list/endpoints.cy.ts index 0c6c64afad492..8e8c989612cbe 100644 --- a/x-pack/plugins/security_solution/public/management/cypress/e2e/endpoint_list/endpoints.cy.ts +++ b/x-pack/plugins/security_solution/public/management/cypress/e2e/endpoint_list/endpoints.cy.ts @@ -32,7 +32,8 @@ import { createEndpointHost } from '../../tasks/create_endpoint_host'; import { deleteAllLoadedEndpointData } from '../../tasks/delete_all_endpoint_data'; import { enableAllPolicyProtections } from '../../tasks/endpoint_policy'; -describe('Endpoints page', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => { +// FLAKY: https://github.com/elastic/kibana/issues/168284 +describe.skip('Endpoints page', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => { let indexedPolicy: IndexedFleetEndpointPolicyResponse; let policy: PolicyData; let createdHost: CreateAndEnrollEndpointHostResponse; From c1098b58b18bdb9536bd360ae26c02a60dff1dfe Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Thu, 12 Oct 2023 21:45:26 +0100 Subject: [PATCH 11/11] skip flaky suite (#168742) --- x-pack/plugins/osquery/cypress/e2e/all/custom_space.cy.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/osquery/cypress/e2e/all/custom_space.cy.ts b/x-pack/plugins/osquery/cypress/e2e/all/custom_space.cy.ts index 0c46fbf074966..bdcacf9cf4615 100644 --- a/x-pack/plugins/osquery/cypress/e2e/all/custom_space.cy.ts +++ b/x-pack/plugins/osquery/cypress/e2e/all/custom_space.cy.ts @@ -20,7 +20,8 @@ const testSpaces = [ { name: 'default', tags: ['@ess', '@serverless'] }, { name: 'custom-spaces', tags: ['@ess'] }, ]; -describe('ALL - Custom space', () => { +// FLAKY: https://github.com/elastic/kibana/issues/168742 +describe.skip('ALL - Custom space', () => { testSpaces.forEach((testSpace) => { describe(`[${testSpace.name}]`, { tags: testSpace.tags }, () => { let packName: string;