diff --git a/.buildkite/ftr_security_serverless_configs.yml b/.buildkite/ftr_security_serverless_configs.yml index 15127a304c79b..4fac2c698bbd0 100644 --- a/.buildkite/ftr_security_serverless_configs.yml +++ b/.buildkite/ftr_security_serverless_configs.yml @@ -14,7 +14,7 @@ disabled: - x-pack/test/security_solution_cypress/ai4dsoc_serverless_config.ts # Playwright - - x-pack/test/security_solution_playwright/serverless_config.ts + - x-pack/solutions/security/test/security_solution_playwright/serverless_config.ts # MKI only configs files - x-pack/test_serverless/functional/test_suites/security/config.mki_only.ts diff --git a/.buildkite/ftr_security_stateful_configs.yml b/.buildkite/ftr_security_stateful_configs.yml index 9e6745623c198..43be321cdef68 100644 --- a/.buildkite/ftr_security_stateful_configs.yml +++ b/.buildkite/ftr_security_stateful_configs.yml @@ -28,7 +28,7 @@ disabled: - x-pack/test/security_solution_cypress/config.ts # Playwright - - x-pack/test/security_solution_playwright/playwright.config.ts + - x-pack/solutions/security/test/security_solution_playwright/playwright.config.ts # Gen AI Evals run weekly via their own pipeline - x-pack/test/security_solution_api_integration/test_suites/genai/evaluations/trial_license_complete_tier/configs/ess.config.ts diff --git a/.buildkite/scripts/steps/functional/security_serverless_playwright.sh b/.buildkite/scripts/steps/functional/security_serverless_playwright.sh index 3b68702eb3467..ea403ff400fb6 100755 --- a/.buildkite/scripts/steps/functional/security_serverless_playwright.sh +++ b/.buildkite/scripts/steps/functional/security_serverless_playwright.sh @@ -9,6 +9,6 @@ export KIBANA_INSTALL_DIR=${KIBANA_BUILD_LOCATION} echo "--- SERVERLESS - Security Solution Playwright Tests" -cd x-pack/test/security_solution_playwright +cd x-pack/solutions/security/test/security_solution_playwright yarn run:serverless; exit_code=$?; exit $exit_code diff --git a/.buildkite/scripts/steps/functional/security_solution_playwright.sh b/.buildkite/scripts/steps/functional/security_solution_playwright.sh index 30729cfef6afe..1f061ad82ad16 100755 --- a/.buildkite/scripts/steps/functional/security_solution_playwright.sh +++ b/.buildkite/scripts/steps/functional/security_solution_playwright.sh @@ -9,6 +9,6 @@ export KIBANA_INSTALL_DIR=${KIBANA_BUILD_LOCATION} echo "--- ESS - Security Solution Playwright Tests" -cd x-pack/test/security_solution_playwright +cd x-pack/solutions/security/test/security_solution_playwright yarn run:ess; exit_code=$?; exit $exit_code \ No newline at end of file diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index af04a85c0d96e..ef7afc5649341 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2448,7 +2448,7 @@ x-pack/test/security_solution_api_integration/test_suites/sources @elastic/secur /x-pack/test/security_solution_cypress/cypress/tasks/login.ts @elastic/security-engineering-productivity /x-pack/test/security_solution_cypress/cypress/tasks/api_calls/common.ts @elastic/security-engineering-productivity /x-pack/test/security_solution_cypress/es_archives @elastic/security-engineering-productivity -/x-pack/test/security_solution_playwright @elastic/security-engineering-productivity +/x-pack/solutions/security/test/security_solution_playwright @elastic/security-engineering-productivity /x-pack/solutions/security/plugins/security_solution/scripts/run_cypress @MadameSheema @patrykkopycinski @maximpn @banderror ## Security Solution sub teams - Cloud Security Posture diff --git a/.gitignore b/.gitignore index 92bac88052df2..862af89622edb 100644 --- a/.gitignore +++ b/.gitignore @@ -166,11 +166,11 @@ oas_docs/output/kibana.new.yaml oas_docs/output/kibana.serverless.new.yaml # Security Solution Playwright -x-pack/test/security_solution_playwright/test-results/ -x-pack/test/security_solution_playwright/playwright-report/ -x-pack/test/security_solution_playwright/blob-report/ -x-pack/test/security_solution_playwright/playwright/.cache/ -x-pack/test/security_solution_playwright/.auth/ -x-pack/test/security_solution_playwright/.env +x-pack/solutions/security/test/security_solution_playwright/test-results/ +x-pack/solutions/security/test/security_solution_playwright/playwright-report/ +x-pack/solutions/security/test/security_solution_playwright/blob-report/ +x-pack/solutions/security/test/security_solution_playwright/playwright/.cache/ +x-pack/solutions/security/test/security_solution_playwright/.auth/ +x-pack/solutions/security/test/security_solution_playwright/.env .codeql .dependency-graph-log.json diff --git a/x-pack/test/security_solution_playwright/api_utils/api_key.ts b/x-pack/solutions/security/test/security_solution_playwright/api_utils/api_key.ts similarity index 100% rename from x-pack/test/security_solution_playwright/api_utils/api_key.ts rename to x-pack/solutions/security/test/security_solution_playwright/api_utils/api_key.ts diff --git a/x-pack/test/security_solution_playwright/api_utils/documents.ts b/x-pack/solutions/security/test/security_solution_playwright/api_utils/documents.ts similarity index 100% rename from x-pack/test/security_solution_playwright/api_utils/documents.ts rename to x-pack/solutions/security/test/security_solution_playwright/api_utils/documents.ts diff --git a/x-pack/test/security_solution_playwright/api_utils/headers.ts b/x-pack/solutions/security/test/security_solution_playwright/api_utils/headers.ts similarity index 100% rename from x-pack/test/security_solution_playwright/api_utils/headers.ts rename to x-pack/solutions/security/test/security_solution_playwright/api_utils/headers.ts diff --git a/x-pack/test/security_solution_playwright/api_utils/rules.ts b/x-pack/solutions/security/test/security_solution_playwright/api_utils/rules.ts similarity index 60% rename from x-pack/test/security_solution_playwright/api_utils/rules.ts rename to x-pack/solutions/security/test/security_solution_playwright/api_utils/rules.ts index 0c6679472b22d..67cda3ec268d6 100644 --- a/x-pack/test/security_solution_playwright/api_utils/rules.ts +++ b/x-pack/solutions/security/test/security_solution_playwright/api_utils/rules.ts @@ -9,10 +9,35 @@ import { DETECTION_ENGINE_RULES_BULK_ACTION, DETECTION_ENGINE_RULES_URL, } from '@kbn/security-solution-plugin/common/constants'; +import type { QueryRuleCreateProps } from '@kbn/security-solution-plugin/common/api/detection_engine'; + import { APIRequestContext } from '@playwright/test'; -import { getRuleForAlertTesting } from '../../common/utils/security_solution'; import { getCommonHeadersWithApiVersion } from './headers'; +/** + * This is a typical signal testing rule that is easy for most basic testing of output of alerts. + * It starts out in an enabled true state. The 'from' is set very far back to test the basics of signal + * creation and testing by getting all the alerts at once. + * @param ruleId The optional ruleId which is rule-1 by default. + * @param enabled Enables the rule on creation or not. Defaulted to true. + */ +export const getRuleForAlertTesting = ( + index: string[], + ruleId = 'rule-1', + enabled = true +): QueryRuleCreateProps => ({ + name: 'Alert Testing Query', + description: 'Tests a simple query', + enabled, + risk_score: 1, + rule_id: ruleId, + severity: 'high', + index, + type: 'query', + query: '*:*', + from: '1900-01-01T00:00:00.000Z', +}); + const indexes = [ 'apm-*-transaction*', 'auditbeat-*', diff --git a/x-pack/test/security_solution_playwright/es_archives/auditbeat_single/data.json b/x-pack/solutions/security/test/security_solution_playwright/es_archives/auditbeat_single/data.json similarity index 100% rename from x-pack/test/security_solution_playwright/es_archives/auditbeat_single/data.json rename to x-pack/solutions/security/test/security_solution_playwright/es_archives/auditbeat_single/data.json diff --git a/x-pack/test/security_solution_playwright/es_archives/auditbeat_single/mappings.json b/x-pack/solutions/security/test/security_solution_playwright/es_archives/auditbeat_single/mappings.json similarity index 100% rename from x-pack/test/security_solution_playwright/es_archives/auditbeat_single/mappings.json rename to x-pack/solutions/security/test/security_solution_playwright/es_archives/auditbeat_single/mappings.json diff --git a/x-pack/test/security_solution_playwright/fixtures/es_archiver.ts b/x-pack/solutions/security/test/security_solution_playwright/fixtures/es_archiver.ts similarity index 100% rename from x-pack/test/security_solution_playwright/fixtures/es_archiver.ts rename to x-pack/solutions/security/test/security_solution_playwright/fixtures/es_archiver.ts diff --git a/x-pack/test/security_solution_playwright/fixtures/saml.ts b/x-pack/solutions/security/test/security_solution_playwright/fixtures/saml.ts similarity index 100% rename from x-pack/test/security_solution_playwright/fixtures/saml.ts rename to x-pack/solutions/security/test/security_solution_playwright/fixtures/saml.ts diff --git a/x-pack/test/security_solution_playwright/index.d.ts b/x-pack/solutions/security/test/security_solution_playwright/index.d.ts similarity index 100% rename from x-pack/test/security_solution_playwright/index.d.ts rename to x-pack/solutions/security/test/security_solution_playwright/index.d.ts diff --git a/x-pack/solutions/security/test/security_solution_playwright/package.json b/x-pack/solutions/security/test/security_solution_playwright/package.json new file mode 100644 index 0000000000000..28d247c18d0c4 --- /dev/null +++ b/x-pack/solutions/security/test/security_solution_playwright/package.json @@ -0,0 +1,15 @@ +{ + "author": "Elastic", + "name": "security_solution_playwright", + "version": "1.0.0", + "private": true, + "license": "Elastic License 2.0", + "scripts": { + "playwright:open": "node ../../plugins/security_solution/scripts/run_playwright/start_playwright open --config-file ../../test/security_solution_playwright/playwright.config.ts", + "playwright:run": "node ../../plugins/security_solution/scripts/run_playwright/start_playwright run --config-file ../../test/security_solution_playwright/playwright.config.ts", + "open:ess": "npm run playwright:open -- --ftr-config-file ../../../../test/security_solution_cypress/cli_config", + "run:ess": "npm run playwright:run -- --ftr-config-file ../../../../test/security_solution_cypress/cli_config", + "open:serverless": "npm run playwright:open -- --ftr-config-file ../../../../test/security_solution_cypress/serverless_config", + "run:serverless": "npm run playwright:run -- --ftr-config-file ../../../../test/security_solution_cypress/serverless_config" + } +} \ No newline at end of file diff --git a/x-pack/test/security_solution_playwright/page_objects/entity_analytics_management_po.ts b/x-pack/solutions/security/test/security_solution_playwright/page_objects/entity_analytics_management_po.ts similarity index 100% rename from x-pack/test/security_solution_playwright/page_objects/entity_analytics_management_po.ts rename to x-pack/solutions/security/test/security_solution_playwright/page_objects/entity_analytics_management_po.ts diff --git a/x-pack/test/security_solution_playwright/page_objects/entity_analytics_po.ts b/x-pack/solutions/security/test/security_solution_playwright/page_objects/entity_analytics_po.ts similarity index 100% rename from x-pack/test/security_solution_playwright/page_objects/entity_analytics_po.ts rename to x-pack/solutions/security/test/security_solution_playwright/page_objects/entity_analytics_po.ts diff --git a/x-pack/test/security_solution_playwright/page_objects/page_factory.ts b/x-pack/solutions/security/test/security_solution_playwright/page_objects/page_factory.ts similarity index 100% rename from x-pack/test/security_solution_playwright/page_objects/page_factory.ts rename to x-pack/solutions/security/test/security_solution_playwright/page_objects/page_factory.ts diff --git a/x-pack/test/security_solution_playwright/page_objects/rule_details_page_po.ts b/x-pack/solutions/security/test/security_solution_playwright/page_objects/rule_details_page_po.ts similarity index 100% rename from x-pack/test/security_solution_playwright/page_objects/rule_details_page_po.ts rename to x-pack/solutions/security/test/security_solution_playwright/page_objects/rule_details_page_po.ts diff --git a/x-pack/test/security_solution_playwright/page_objects/rule_management_po.ts b/x-pack/solutions/security/test/security_solution_playwright/page_objects/rule_management_po.ts similarity index 100% rename from x-pack/test/security_solution_playwright/page_objects/rule_management_po.ts rename to x-pack/solutions/security/test/security_solution_playwright/page_objects/rule_management_po.ts diff --git a/x-pack/test/security_solution_playwright/playwright.config.ts b/x-pack/solutions/security/test/security_solution_playwright/playwright.config.ts similarity index 100% rename from x-pack/test/security_solution_playwright/playwright.config.ts rename to x-pack/solutions/security/test/security_solution_playwright/playwright.config.ts diff --git a/x-pack/test/security_solution_playwright/tests/enable_risk_score_redirect.spec.ts b/x-pack/solutions/security/test/security_solution_playwright/tests/enable_risk_score_redirect.spec.ts similarity index 100% rename from x-pack/test/security_solution_playwright/tests/enable_risk_score_redirect.spec.ts rename to x-pack/solutions/security/test/security_solution_playwright/tests/enable_risk_score_redirect.spec.ts diff --git a/x-pack/test/security_solution_playwright/tests/manual_rule_run.spec.ts b/x-pack/solutions/security/test/security_solution_playwright/tests/manual_rule_run.spec.ts similarity index 100% rename from x-pack/test/security_solution_playwright/tests/manual_rule_run.spec.ts rename to x-pack/solutions/security/test/security_solution_playwright/tests/manual_rule_run.spec.ts diff --git a/x-pack/test/security_solution_playwright/tests/setup/login_ess.ts b/x-pack/solutions/security/test/security_solution_playwright/tests/setup/login_ess.ts similarity index 100% rename from x-pack/test/security_solution_playwright/tests/setup/login_ess.ts rename to x-pack/solutions/security/test/security_solution_playwright/tests/setup/login_ess.ts diff --git a/x-pack/test/security_solution_playwright/tests/setup/login_serverless.ts b/x-pack/solutions/security/test/security_solution_playwright/tests/setup/login_serverless.ts similarity index 100% rename from x-pack/test/security_solution_playwright/tests/setup/login_serverless.ts rename to x-pack/solutions/security/test/security_solution_playwright/tests/setup/login_serverless.ts diff --git a/x-pack/solutions/security/test/security_solution_playwright/tsconfig.json b/x-pack/solutions/security/test/security_solution_playwright/tsconfig.json new file mode 100644 index 0000000000000..fe323588c318c --- /dev/null +++ b/x-pack/solutions/security/test/security_solution_playwright/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../../../tsconfig.base.json", + "compilerOptions": { + "types": ["node"], + "outDir": "target/types" + }, + "include": ["index.d.ts"], + "kbn_references": [], + "exclude": [ + "target/**/*" + ] +} diff --git a/x-pack/solutions/security/test/tsconfig.json b/x-pack/solutions/security/test/tsconfig.json index be2de8ad73d56..c13a30bf1f0df 100644 --- a/x-pack/solutions/security/test/tsconfig.json +++ b/x-pack/solutions/security/test/tsconfig.json @@ -48,5 +48,6 @@ "@kbn/core-saved-objects-server", "@kbn/session-view-plugin", "@kbn/repo-info", + "@kbn/es-archiver", ] } diff --git a/x-pack/test/security_solution_playwright/package.json b/x-pack/test/security_solution_playwright/package.json deleted file mode 100644 index a974a43ae2335..0000000000000 --- a/x-pack/test/security_solution_playwright/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "author": "Elastic", - "name": "security_solution_playwright", - "version": "1.0.0", - "private": true, - "license": "Elastic License 2.0", - "scripts": { - "playwright:open": "node ../../solutions/security/plugins/security_solution/scripts/run_playwright/start_playwright open --config-file ../../test/security_solution_playwright/playwright.config.ts", - "playwright:run": "node ../../solutions/security/plugins/security_solution/scripts/run_playwright/start_playwright run --config-file ../../test/security_solution_playwright/playwright.config.ts", - "open:ess": "npm run playwright:open -- --ftr-config-file ../security_solution_cypress/cli_config", - "run:ess": "npm run playwright:run -- --ftr-config-file ../security_solution_cypress/cli_config", - "open:serverless": "npm run playwright:open -- --ftr-config-file ../security_solution_cypress/serverless_config", - "run:serverless": "npm run playwright:run -- --ftr-config-file ../security_solution_cypress/serverless_config" - } -} \ No newline at end of file diff --git a/x-pack/test/security_solution_playwright/tsconfig.json b/x-pack/test/security_solution_playwright/tsconfig.json deleted file mode 100644 index ec4474cbef181..0000000000000 --- a/x-pack/test/security_solution_playwright/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../tsconfig.base.json", - "compilerOptions": { - "types": ["node"], - "outDir": "target/types" - }, - "include": ["index.d.ts"], - "kbn_references": [ - { - "path": "../../solutions/security/plugins/security_solution/tsconfig.json", - "force": true - }, - ], - "exclude": [ - "target/**/*" - ] -} diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index d61f3530061a0..f5caf84a4fc2d 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -31,7 +31,6 @@ "@kbn/spaces-plugin", "@kbn/task-manager-plugin", "@kbn/test", - "@kbn/repo-info", "@kbn/tooling-log", "@kbn/dev-utils", "@kbn/ftr-common-functional-services", @@ -40,8 +39,6 @@ "@kbn/rule-data-utils", "@kbn/test-subj-selector", "@kbn/rison", - "@kbn/data-views-plugin", - "@kbn/es-archiver", "@kbn/es-query", "@kbn/core-http-common", "@kbn/dataset-quality-plugin",