From ac706059e92ce3232112a2d3651b6b796f996fe4 Mon Sep 17 00:00:00 2001 From: Bharat Pasupula Date: Wed, 4 Dec 2024 08:12:18 +0100 Subject: [PATCH 1/6] Add serverless availability cypress test --- .../automatic_import/feature_complete.cy.ts | 20 +++++++++++++++++++ .../feature_essentials.cy.ts | 9 ++++----- .../cypress/screens/automatic_import.ts | 9 +++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 x-pack/test/security_solution_cypress/cypress/e2e/automatic_import/feature_complete.cy.ts rename x-pack/test/security_solution_cypress/cypress/e2e/{ai_assistant => automatic_import}/feature_essentials.cy.ts (71%) create mode 100644 x-pack/test/security_solution_cypress/cypress/screens/automatic_import.ts diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/automatic_import/feature_complete.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/automatic_import/feature_complete.cy.ts new file mode 100644 index 0000000000000..2798142d631f8 --- /dev/null +++ b/x-pack/test/security_solution_cypress/cypress/e2e/automatic_import/feature_complete.cy.ts @@ -0,0 +1,20 @@ +/* + * 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 { ASSISTANT_BUTTON, CREATE_INTEGRATION_LANDING_PAGE } from '../../screens/automatic_import'; +import { login } from '../../tasks/login'; + +describe('App Features for Security Complete', { tags: ['@serverless'] }, () => { + beforeEach(() => { + login(); + }); + + it('should have have Automatic Import available', () => { + cy.visit(CREATE_INTEGRATION_LANDING_PAGE); + cy.get(ASSISTANT_BUTTON).should('be.visible'); + }); +}); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/ai_assistant/feature_essentials.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/automatic_import/feature_essentials.cy.ts similarity index 71% rename from x-pack/test/security_solution_cypress/cypress/e2e/ai_assistant/feature_essentials.cy.ts rename to x-pack/test/security_solution_cypress/cypress/e2e/automatic_import/feature_essentials.cy.ts index b16ea50043c17..2145b849ba121 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/ai_assistant/feature_essentials.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/automatic_import/feature_essentials.cy.ts @@ -5,9 +5,8 @@ * 2.0. */ -import { AI_ASSISTANT_BUTTON } from '../../screens/ai_assistant'; +import { ASSISTANT_BUTTON, CREATE_INTEGRATION_LANDING_PAGE } from '../../screens/automatic_import'; import { login } from '../../tasks/login'; -import { visitGetStartedPage } from '../../tasks/navigation'; describe( 'App Features for Security Essentials', @@ -27,9 +26,9 @@ describe( login(); }); - it('should not have AI Assistant available', () => { - visitGetStartedPage(); - cy.get(AI_ASSISTANT_BUTTON).should('not.exist'); + it('should not have Automatic Import available', () => { + cy.visit(CREATE_INTEGRATION_LANDING_PAGE); + cy.get(ASSISTANT_BUTTON).should('not.exist'); }); } ); diff --git a/x-pack/test/security_solution_cypress/cypress/screens/automatic_import.ts b/x-pack/test/security_solution_cypress/cypress/screens/automatic_import.ts new file mode 100644 index 0000000000000..eca10339dd010 --- /dev/null +++ b/x-pack/test/security_solution_cypress/cypress/screens/automatic_import.ts @@ -0,0 +1,9 @@ +/* + * 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 const CREATE_INTEGRATION_LANDING_PAGE = '/app/integrations/create'; +export const ASSISTANT_BUTTON = 'assistantButton'; From 9a534d0039bb2efd7760de07f2394d1a036d7067 Mon Sep 17 00:00:00 2001 From: Bharat Pasupula Date: Wed, 4 Dec 2024 09:57:09 +0100 Subject: [PATCH 2/6] Add automatic import serverless tests to buildkite --- .../security_serverless_automatic_import.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .buildkite/scripts/steps/functional/security_serverless_automatic_import.sh diff --git a/.buildkite/scripts/steps/functional/security_serverless_automatic_import.sh b/.buildkite/scripts/steps/functional/security_serverless_automatic_import.sh new file mode 100644 index 0000000000000..823ee6dd67bb7 --- /dev/null +++ b/.buildkite/scripts/steps/functional/security_serverless_automatic_import.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/steps/functional/common.sh + +export JOB=kibana-security-solution-chrome +export KIBANA_INSTALL_DIR=${KIBANA_BUILD_LOCATION} + +echo "--- Automatic Import Cypress Tests on Serverless" + +cd x-pack/test/security_solution_cypress + +set +e +BK_ANALYTICS_API_KEY=$(vault_get security-solution-ci sec-sol-cypress-bk-api-key) + +BK_ANALYTICS_API_KEY=$BK_ANALYTICS_API_KEY yarn cypress:automatic_import:run:serverless; status=$?; yarn junit:merge || :; exit $status From 5a41d4c5277ce1d5f01b0c3d83ec54656f0ae435 Mon Sep 17 00:00:00 2001 From: Bharat Pasupula Date: Wed, 4 Dec 2024 11:13:18 +0100 Subject: [PATCH 3/6] add bk yml --- .../security_solution/automatic_import.yml | 20 +++++++++++++++++++ .../pipelines/pull_request/pipeline.ts | 3 +++ 2 files changed, 23 insertions(+) create mode 100644 .buildkite/pipelines/pull_request/security_solution/automatic_import.yml diff --git a/.buildkite/pipelines/pull_request/security_solution/automatic_import.yml b/.buildkite/pipelines/pull_request/security_solution/automatic_import.yml new file mode 100644 index 0000000000000..867238fbde99b --- /dev/null +++ b/.buildkite/pipelines/pull_request/security_solution/automatic_import.yml @@ -0,0 +1,20 @@ +steps: + - command: .buildkite/scripts/steps/functional/security_serverless_automatic_import.sh + label: 'Serverless Automatic Import - Security Solution Cypress Tests' + agents: + machineType: n2-standard-4 + preemptible: true + depends_on: + - build + - quick_checks + - checks + - linting + - linting_with_types + - check_types + - check_oas_snapshot + timeout_in_minutes: 60 + parallelism: 1 + retry: + automatic: + - exit_status: '-1' + limit: 1 diff --git a/.buildkite/scripts/pipelines/pull_request/pipeline.ts b/.buildkite/scripts/pipelines/pull_request/pipeline.ts index 6b805d540c254..06f4bd10cb265 100644 --- a/.buildkite/scripts/pipelines/pull_request/pipeline.ts +++ b/.buildkite/scripts/pipelines/pull_request/pipeline.ts @@ -240,6 +240,9 @@ const getPipeline = (filename: string, removeSteps = true) => { pipeline.push( getPipeline('.buildkite/pipelines/pull_request/security_solution/ai_assistant.yml') ); + pipeline.push( + getPipeline('.buildkite/pipelines/pull_request/security_solution/automatic_import.yml') + ); pipeline.push( getPipeline('.buildkite/pipelines/pull_request/security_solution/detection_engine.yml') ); From ccb7e23b69ff1d71b22b6c069a02449c2f098ea8 Mon Sep 17 00:00:00 2001 From: Bharat Pasupula Date: Wed, 4 Dec 2024 11:21:59 +0100 Subject: [PATCH 4/6] restore --- .../e2e/ai_assistant/feature_essentials.cy.ts | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 x-pack/test/security_solution_cypress/cypress/e2e/ai_assistant/feature_essentials.cy.ts diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/ai_assistant/feature_essentials.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/ai_assistant/feature_essentials.cy.ts new file mode 100644 index 0000000000000..b16ea50043c17 --- /dev/null +++ b/x-pack/test/security_solution_cypress/cypress/e2e/ai_assistant/feature_essentials.cy.ts @@ -0,0 +1,35 @@ +/* + * 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 { AI_ASSISTANT_BUTTON } from '../../screens/ai_assistant'; +import { login } from '../../tasks/login'; +import { visitGetStartedPage } from '../../tasks/navigation'; + +describe( + 'App Features for Security Essentials', + { + tags: ['@serverless'], + env: { + ftrConfig: { + productTypes: [ + { product_line: 'security', product_tier: 'essentials' }, + { product_line: 'endpoint', product_tier: 'essentials' }, + ], + }, + }, + }, + () => { + beforeEach(() => { + login(); + }); + + it('should not have AI Assistant available', () => { + visitGetStartedPage(); + cy.get(AI_ASSISTANT_BUTTON).should('not.exist'); + }); + } +); From 291ba26e297c0c3f4a660fe2a0f5bbe61a354fe3 Mon Sep 17 00:00:00 2001 From: Bharat Pasupula Date: Wed, 4 Dec 2024 12:08:42 +0100 Subject: [PATCH 5/6] add cypress config --- .../automatic_import/feature_complete.cy.ts | 20 ------------------- .../security_solution_cypress/package.json | 1 + 2 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 x-pack/test/security_solution_cypress/cypress/e2e/automatic_import/feature_complete.cy.ts diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/automatic_import/feature_complete.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/automatic_import/feature_complete.cy.ts deleted file mode 100644 index 2798142d631f8..0000000000000 --- a/x-pack/test/security_solution_cypress/cypress/e2e/automatic_import/feature_complete.cy.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { ASSISTANT_BUTTON, CREATE_INTEGRATION_LANDING_PAGE } from '../../screens/automatic_import'; -import { login } from '../../tasks/login'; - -describe('App Features for Security Complete', { tags: ['@serverless'] }, () => { - beforeEach(() => { - login(); - }); - - it('should have have Automatic Import available', () => { - cy.visit(CREATE_INTEGRATION_LANDING_PAGE); - cy.get(ASSISTANT_BUTTON).should('be.visible'); - }); -}); diff --git a/x-pack/test/security_solution_cypress/package.json b/x-pack/test/security_solution_cypress/package.json index c7bc7fe1d94a0..68d7454b62e51 100644 --- a/x-pack/test/security_solution_cypress/package.json +++ b/x-pack/test/security_solution_cypress/package.json @@ -33,6 +33,7 @@ "cypress:detection_engine:run:serverless": "yarn cypress:serverless --spec './cypress/e2e/detection_response/detection_engine/!(exceptions)/**/*.cy.ts'", "cypress:detection_engine:exceptions:run:serverless": "yarn cypress:serverless --spec './cypress/e2e/detection_response/detection_engine/exceptions/**/*.cy.ts'", "cypress:ai_assistant:run:serverless": "yarn cypress:serverless --spec './cypress/e2e/ai_assistant/**/*.cy.ts'", + "cypress:automatic_import:run:serverless": "yarn cypress:serverless --spec './cypress/e2e/automatic_import/**/*.cy.ts'", "cypress:investigations:run:serverless": "yarn cypress:serverless --spec './cypress/e2e/investigations/**/*.cy.ts'", "cypress:explore:run:serverless": "yarn cypress:serverless --spec './cypress/e2e/explore/**/*.cy.ts'", "cypress:changed-specs-only:serverless": "yarn cypress:serverless --changed-specs-only --env burn=5", From 96374b35d5f7773ee4e90c9217c893a686484a30 Mon Sep 17 00:00:00 2001 From: Bharat Pasupula Date: Thu, 5 Dec 2024 19:22:38 +0100 Subject: [PATCH 6/6] Add codeowners --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6c70346b65ced..64aa61b31e9f5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2146,6 +2146,7 @@ x-pack/test_serverless/functional/test_suites/security/index.mki_only.ts @elasti /x-pack/plugins/security_solution/public/attack_discovery @elastic/security-generative-ai /x-pack/test/security_solution_cypress/cypress/e2e/ai_assistant @elastic/security-generative-ai /x-pack/plugins/security_solution_ess/public/upselling/pages/attack_discovery @elastic/security-generative-ai +/x-pack/test/security_solution_cypress/cypress/e2e/automatic_import @elastic/security-scalability # Security Solution cross teams ownership /x-pack/test/security_solution_cypress/cypress/fixtures @elastic/security-detections-response @elastic/security-threat-hunting