From 5145d76fb1159b7a574eafaacbcf57e51cf00273 Mon Sep 17 00:00:00 2001 From: Bharat Pasupula <123897612+bhapas@users.noreply.github.com> Date: Thu, 5 Dec 2024 21:25:07 +0100 Subject: [PATCH] [Automatic Import] Add serverless availability cypress test (#202872) --- .../security_solution/automatic_import.yml | 20 +++++++++++ .../pipelines/pull_request/pipeline.ts | 3 ++ .../security_serverless_automatic_import.sh | 17 ++++++++++ .github/CODEOWNERS | 1 + .../automatic_import/feature_essentials.cy.ts | 34 +++++++++++++++++++ .../cypress/screens/automatic_import.ts | 9 +++++ .../security_solution_cypress/package.json | 1 + 7 files changed, 85 insertions(+) create mode 100644 .buildkite/pipelines/pull_request/security_solution/automatic_import.yml create mode 100644 .buildkite/scripts/steps/functional/security_serverless_automatic_import.sh create mode 100644 x-pack/test/security_solution_cypress/cypress/e2e/automatic_import/feature_essentials.cy.ts create mode 100644 x-pack/test/security_solution_cypress/cypress/screens/automatic_import.ts 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 ad71f70258a23..e4a0617579cf5 100644 --- a/.buildkite/scripts/pipelines/pull_request/pipeline.ts +++ b/.buildkite/scripts/pipelines/pull_request/pipeline.ts @@ -266,6 +266,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') ); 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 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1bf4354a52401..210ef172b78ea 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2148,6 +2148,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 diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/automatic_import/feature_essentials.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/automatic_import/feature_essentials.cy.ts new file mode 100644 index 0000000000000..2145b849ba121 --- /dev/null +++ b/x-pack/test/security_solution_cypress/cypress/e2e/automatic_import/feature_essentials.cy.ts @@ -0,0 +1,34 @@ +/* + * 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 Essentials', + { + tags: ['@serverless'], + env: { + ftrConfig: { + productTypes: [ + { product_line: 'security', product_tier: 'essentials' }, + { product_line: 'endpoint', product_tier: 'essentials' }, + ], + }, + }, + }, + () => { + beforeEach(() => { + login(); + }); + + 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'; 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",