From bb7cce6d7b0cf5cc4a28648dd846b5328080df7f Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Wed, 25 Jun 2025 20:04:29 +0300 Subject: [PATCH] [ska] relocate x-pack/test/cases_api_integration (#225056) ## Summary Part of https://github.com/elastic/kibana-team/issues/1503 This PR is mostly about moving tests from x-pack/test/cases_api_integration and updating related imports Before: ``` x-pack/test/ | - cases_api_integration/ ``` After: ``` x-pack/platform/test/ | - cases_api_integration/ x-pack/solutions/security/test/ | - cases_api_integration/ ``` --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .buildkite/ftr_platform_stateful_configs.yml | 10 +- .buildkite/ftr_security_stateful_configs.yml | 2 + .eslintrc.js | 3 +- .github/CODEOWNERS | 9 +- package.json | 6 +- tsconfig.base.json | 12 +- .../shared/cases/common/constants/index.ts | 2 +- .../cases_api_integration/common/config.ts | 7 +- ...ingle_case_user_actions_one_comment.ndjson | 0 ..._case_with_connector_update_to_none.ndjson | 0 .../common/ftr_provider_context.d.ts | 0 .../common/lib/alerts.ts | 43 - .../common/lib/api/attachments.ts | 0 .../common/lib/api/case.ts | 14 - .../common/lib/api/configuration.ts | 0 .../common/lib/api/connectors.ts | 10 +- .../common/lib/api/files.ts | 0 .../common/lib/api/helpers.ts | 0 .../common/lib/api/index.ts | 52 - .../common/lib/api/omit.ts | 0 .../common/lib/api/telemetry.ts | 0 .../common/lib/api/user_actions.ts | 0 .../common/lib/api/user_profiles.ts | 0 .../common/lib/authentication/index.ts | 0 .../common/lib/authentication/roles.ts | 0 .../common/lib/authentication/spaces.ts | 0 .../common/lib/authentication/types.ts | 0 .../common/lib/authentication/users.ts | 0 .../common/lib/constants.ts | 0 .../cases_api_integration/common/lib/mock.ts | 0 .../common/lib/validation.ts | 0 .../common/plugins/cases/kibana.jsonc | 0 .../common/plugins/cases/package.json | 0 .../server/attachments/external_reference.ts | 0 .../server/attachments/persistable_state.ts | 0 .../plugins/cases/server/files/index.ts | 0 .../common/plugins/cases/server/index.ts | 0 .../common/plugins/cases/server/plugin.ts | 0 .../common/plugins/cases/server/routes.ts | 0 .../common/plugins/cases/tsconfig.json | 2 +- .../common/plugins/observability/kibana.jsonc | 0 .../common/plugins/observability/package.json | 0 .../plugins/observability/server/index.ts | 0 .../plugins/observability/server/plugin.ts | 0 .../plugins/observability}/tsconfig.json | 2 +- .../plugins/security_solution/kibana.jsonc | 0 .../plugins/security_solution/package.json | 0 .../plugins/security_solution/server/index.ts | 0 .../security_solution/server/plugin.ts | 0 .../plugins/security_solution}/tsconfig.json | 2 +- .../cases_api_integration/common/roles.ts | 951 ++++++++++++++++++ .../cases_api_integration/common/services.ts | 0 .../cases_api_integration/common/users.ts | 331 ++++++ .../security_and_spaces/config_basic.ts | 0 .../config_no_public_base_url.ts | 0 .../security_and_spaces/config_trial.ts | 0 .../config_trial_common.ts | 0 .../registered_persistable_state_basic.ts | 2 +- .../tests/basic/cases/assignees.ts | 0 .../tests/basic/cases/push_case.ts | 0 .../tests/basic/configure/get_connectors.ts | 2 +- .../security_and_spaces/tests/basic/index.ts | 0 .../basic/internal/suggest_user_profiles.ts | 0 .../alerts/get_alerts_attached_to_case.ts | 0 .../tests/common/alerts/get_cases.ts | 0 .../external_references.ts | 2 +- .../persistable_state.ts | 2 +- .../tests/common/cases/bulk_create_cases.ts | 2 +- .../common/cases/categories/get_categories.ts | 0 .../tests/common/cases/find_cases.ts | 0 .../tests/common/cases/get_case.ts | 0 .../tests/common/cases/import_export.ts | 2 +- .../tests/common/cases/migrations.ts | 0 .../tests/common/cases/post_case.ts | 0 .../common/cases/reporters/get_reporters.ts | 0 .../tests/common/cases/resolve_case.ts | 0 .../tests/common/cases/tags/get_tags.ts | 0 .../tests/common/comments/find_comments.ts | 0 .../tests/common/comments/get_comment.ts | 0 .../tests/common/comments/migrations.ts | 0 .../tests/common/comments/patch_comment.ts | 0 .../tests/common/configure/get_configure.ts | 0 .../tests/common/configure/migrations.ts | 0 .../tests/common/configure/patch_configure.ts | 2 +- .../tests/common/configure/post_configure.ts | 2 +- .../tests/common/files/post_file.ts | 0 .../security_and_spaces/tests/common/index.ts | 7 - .../tests/common/index_common_trial/index.ts | 0 .../internal/bulk_delete_file_attachments.ts | 4 +- .../common/internal/bulk_get_attachments.ts | 0 .../tests/common/internal/bulk_get_cases.ts | 0 .../common/internal/find_user_actions.ts | 0 .../tests/common/internal/get_connectors.ts | 0 .../internal/metrics/get_case_metrics.ts | 0 .../metrics/get_case_metrics_actions.ts | 0 .../metrics/get_case_metrics_alerts.ts | 0 .../metrics/get_case_metrics_connectors.ts | 2 +- .../internal/metrics/get_cases_metrics.ts | 0 .../common/internal/replace_custom_field.ts | 0 .../tests/common/internal/search_cases.ts | 0 .../common/internal/user_actions_get_users.ts | 0 .../common/kibana_alerting_cases_index.ts | 0 .../tests/common/migrations.ts | 0 .../tests/common/telemetry.ts | 0 .../common/user_actions/find_user_actions.ts | 0 .../user_actions/get_user_action_stats.ts | 0 .../tests/common/user_actions/migrations.ts | 0 .../tests/no_public_base_url/index.ts | 0 .../tests/no_public_base_url/push.ts | 4 +- .../registered_persistable_state_trial.ts | 2 +- .../tests/trial/cases/assignees.ts | 0 .../tests/trial/cases/find_cases.ts | 0 .../tests/trial/cases/patch_case.ts | 0 .../tests/trial/cases/post_case.ts | 0 .../cases/user_actions/find_user_actions.ts | 2 +- .../tests/trial/configure/get_configure.ts | 2 +- .../tests/trial/configure/get_connectors.ts | 4 +- .../tests/trial/configure/index.ts | 0 .../tests/trial/configure/patch_configure.ts | 2 +- .../tests/trial/configure/post_configure.ts | 2 +- .../trial/connectors/cases/cases_connector.ts | 4 +- .../trial/create_comment_sub_privilege.ts | 0 .../tests/trial/delete_sub_privilege.ts | 0 .../security_and_spaces/tests/trial/index.ts | 1 - .../internal/bulk_delete_file_attachments.ts | 4 +- .../tests/trial/internal/get_connectors.ts | 2 +- .../trial/internal/get_user_action_stats.ts | 2 +- .../tests/trial/internal/observables.ts | 0 .../tests/trial/internal/similar_cases.ts | 0 .../trial/internal/suggest_user_profiles.ts | 0 .../trial/internal/user_actions_get_users.ts | 0 .../tests/trial/user_profiles/get_current.ts | 0 .../spaces_only/config.ts | 0 .../tests/common/alerts/get_cases.ts | 0 .../tests/common/cases/delete_cases.ts | 0 .../tests/common/cases/find_cases.ts | 0 .../tests/common/cases/get_case.ts | 0 .../tests/common/cases/patch_cases.ts | 0 .../tests/common/cases/post_case.ts | 0 .../common/cases/reporters/get_reporters.ts | 0 .../tests/common/cases/tags/get_tags.ts | 0 .../tests/common/comments/delete_comment.ts | 0 .../tests/common/comments/find_comments.ts | 0 .../tests/common/comments/get_comment.ts | 0 .../tests/common/comments/patch_comment.ts | 0 .../tests/common/comments/post_comment.ts | 0 .../tests/common/configure/get_configure.ts | 0 .../tests/common/configure/patch_configure.ts | 0 .../tests/common/configure/post_configure.ts | 0 .../tests/common/files/post_file.ts | 0 .../spaces_only/tests/common/index.ts | 0 .../internal/bulk_create_attachments.ts | 0 .../common/internal/suggest_user_profiles.ts | 0 .../tests/common/metrics/get_cases_metrics.ts | 0 .../tests/trial/cases/push_case.ts | 2 +- .../tests/trial/configure/get_configure.ts | 2 +- .../tests/trial/configure/get_connectors.ts | 6 +- .../tests/trial/configure/index.ts | 0 .../tests/trial/configure/patch_configure.ts | 2 +- .../tests/trial/configure/post_configure.ts | 2 +- .../spaces_only/tests/trial/index.ts | 0 x-pack/platform/test/tsconfig.json | 6 + .../common/lib/alerts.ts | 51 + .../cases_api_integration/common/lib/api.ts | 62 ++ .../security_and_spaces/config_trial.ts | 16 + .../config_trial_common.ts | 16 + .../tests/common/cases/delete_cases.ts | 36 +- .../tests/common/cases/patch_cases.ts | 13 +- .../common/client/update_alert_status.ts | 9 +- .../tests/common/comments/delete_comment.ts | 21 +- .../tests/common/comments/delete_comments.ts | 21 +- .../tests/common/comments/post_comment.ts | 15 +- .../security_and_spaces/tests/common/index.ts | 27 + .../tests/common/index_common_trial/index.ts | 30 + .../internal/bulk_create_attachments.ts | 19 +- .../tests/trial/cases/push_case.ts | 13 +- .../security_and_spaces/tests/trial/index.ts | 31 + x-pack/solutions/security/test/tsconfig.json | 1 + .../apis/cases/bulk_get_user_profiles.ts | 6 +- .../apis/cases/common/roles.ts | 2 +- .../apis/cases/common/users.ts | 2 +- .../test/api_integration/apis/cases/files.ts | 14 +- .../test/api_integration/apis/cases/index.ts | 4 +- .../api_integration/apis/cases/privileges.ts | 8 +- .../apis/cases/suggest_user_profiles.ts | 6 +- .../security_solution/cases_privileges.ts | 13 +- x-pack/test/functional/services/cases/api.ts | 6 +- .../apps/cases/common/roles.ts | 2 +- .../apps/cases/common/users.ts | 2 +- .../apps/cases/group1/create_case_form.ts | 4 +- .../apps/cases/group1/sub_privileges.ts | 8 +- .../apps/cases/group1/view_case.ts | 4 +- .../apps/cases/group2/attachment_framework.ts | 2 +- .../apps/cases/group2/list_view.ts | 4 +- .../apps/triggers_actions_ui/logs_list.ts | 9 +- .../shared/global_rule_event_log_list.ts | 9 +- .../observability_cases/list_view.ts | 4 +- .../security_cases/list_view.ts | 4 +- .../response_ops_docs/stack_cases/index.ts | 4 +- .../add_actions.ts | 3 +- .../detections_response/utils/cases.ts | 23 + .../tsconfig.json | 1 + x-pack/test/tsconfig.json | 4 - yarn.lock | 6 +- 204 files changed, 1755 insertions(+), 318 deletions(-) rename x-pack/{ => platform}/test/cases_api_integration/common/config.ts (93%) rename x-pack/{ => platform}/test/cases_api_integration/common/fixtures/saved_object_exports/single_case_user_actions_one_comment.ndjson (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/fixtures/saved_object_exports/single_case_with_connector_update_to_none.ndjson (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/ftr_provider_context.d.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/alerts.ts (78%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/api/attachments.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/api/case.ts (89%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/api/configuration.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/api/connectors.ts (97%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/api/files.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/api/helpers.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/api/index.ts (94%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/api/omit.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/api/telemetry.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/api/user_actions.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/api/user_profiles.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/authentication/index.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/authentication/roles.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/authentication/spaces.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/authentication/types.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/authentication/users.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/constants.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/mock.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/lib/validation.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/cases/kibana.jsonc (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/cases/package.json (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/cases/server/attachments/external_reference.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/cases/server/attachments/persistable_state.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/cases/server/files/index.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/cases/server/index.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/cases/server/plugin.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/cases/server/routes.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/cases/tsconfig.json (89%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/observability/kibana.jsonc (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/observability/package.json (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/observability/server/index.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/observability/server/plugin.ts (100%) rename x-pack/{test/cases_api_integration/common/plugins/security_solution => platform/test/cases_api_integration/common/plugins/observability}/tsconfig.json (86%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/security_solution/kibana.jsonc (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/security_solution/package.json (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/security_solution/server/index.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/common/plugins/security_solution/server/plugin.ts (100%) rename x-pack/{test/cases_api_integration/common/plugins/observability => platform/test/cases_api_integration/common/plugins/security_solution}/tsconfig.json (86%) create mode 100644 x-pack/platform/test/cases_api_integration/common/roles.ts rename x-pack/{ => platform}/test/cases_api_integration/common/services.ts (100%) create mode 100644 x-pack/platform/test/cases_api_integration/common/users.ts rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/config_basic.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/config_no_public_base_url.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/config_trial.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/config_trial_common.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/basic/attachments_framework/registered_persistable_state_basic.ts (94%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/basic/cases/assignees.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/basic/cases/push_case.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/basic/configure/get_connectors.ts (94%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/basic/index.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/basic/internal/suggest_user_profiles.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/alerts/get_alerts_attached_to_case.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/alerts/get_cases.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/attachments_framework/external_references.ts (99%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/attachments_framework/persistable_state.ts (99%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/cases/bulk_create_cases.ts (98%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/cases/categories/get_categories.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/cases/find_cases.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/cases/get_case.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/cases/import_export.ts (98%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/cases/migrations.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/cases/post_case.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/cases/reporters/get_reporters.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/cases/resolve_case.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/cases/tags/get_tags.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/comments/find_comments.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/comments/get_comment.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/comments/migrations.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/comments/patch_comment.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/configure/get_configure.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/configure/migrations.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/configure/patch_configure.ts (99%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/configure/post_configure.ts (99%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/files/post_file.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/index.ts (88%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/index_common_trial/index.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_delete_file_attachments.ts (99%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_get_attachments.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_get_cases.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/internal/find_user_actions.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/internal/get_connectors.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_actions.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_alerts.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_connectors.ts (97%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_cases_metrics.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/internal/replace_custom_field.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/internal/search_cases.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/internal/user_actions_get_users.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/kibana_alerting_cases_index.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/migrations.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/telemetry.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/user_actions/find_user_actions.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/user_actions/get_user_action_stats.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/common/user_actions/migrations.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/no_public_base_url/index.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/no_public_base_url/push.ts (94%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/attachments_framework/registered_persistable_state_trial.ts (95%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/cases/assignees.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/cases/find_cases.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/cases/patch_case.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/cases/post_case.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/cases/user_actions/find_user_actions.ts (96%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_configure.ts (96%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_connectors.ts (97%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/configure/index.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/configure/patch_configure.ts (97%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/configure/post_configure.ts (96%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/connectors/cases/cases_connector.ts (99%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/create_comment_sub_privilege.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/delete_sub_privilege.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/index.ts (98%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/internal/bulk_delete_file_attachments.ts (96%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/internal/get_connectors.ts (99%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/internal/get_user_action_stats.ts (97%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/internal/observables.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/internal/similar_cases.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/internal/suggest_user_profiles.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/internal/user_actions_get_users.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/security_and_spaces/tests/trial/user_profiles/get_current.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/config.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/alerts/get_cases.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/cases/delete_cases.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/cases/find_cases.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/cases/get_case.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/cases/patch_cases.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/cases/post_case.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/cases/reporters/get_reporters.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/cases/tags/get_tags.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/comments/delete_comment.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/comments/find_comments.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/comments/get_comment.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/comments/patch_comment.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/comments/post_comment.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/configure/get_configure.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/configure/patch_configure.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/configure/post_configure.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/files/post_file.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/index.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/internal/bulk_create_attachments.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/internal/suggest_user_profiles.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/common/metrics/get_cases_metrics.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/trial/cases/push_case.ts (95%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/trial/configure/get_configure.ts (97%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/trial/configure/get_connectors.ts (97%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/trial/configure/index.ts (100%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/trial/configure/patch_configure.ts (97%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/trial/configure/post_configure.ts (96%) rename x-pack/{ => platform}/test/cases_api_integration/spaces_only/tests/trial/index.ts (100%) create mode 100644 x-pack/solutions/security/test/cases_api_integration/common/lib/alerts.ts create mode 100644 x-pack/solutions/security/test/cases_api_integration/common/lib/api.ts create mode 100644 x-pack/solutions/security/test/cases_api_integration/security_and_spaces/config_trial.ts create mode 100644 x-pack/solutions/security/test/cases_api_integration/security_and_spaces/config_trial_common.ts rename x-pack/{ => solutions/security}/test/cases_api_integration/security_and_spaces/tests/common/cases/delete_cases.ts (95%) rename x-pack/{ => solutions/security}/test/cases_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts (99%) rename x-pack/{ => solutions/security}/test/cases_api_integration/security_and_spaces/tests/common/client/update_alert_status.ts (93%) rename x-pack/{ => solutions/security}/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comment.ts (95%) rename x-pack/{ => solutions/security}/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comments.ts (96%) rename x-pack/{ => solutions/security}/test/cases_api_integration/security_and_spaces/tests/common/comments/post_comment.ts (98%) create mode 100644 x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/index.ts create mode 100644 x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/index_common_trial/index.ts rename x-pack/{ => solutions/security}/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_create_attachments.ts (98%) rename x-pack/{ => solutions/security}/test/cases_api_integration/security_and_spaces/tests/trial/cases/push_case.ts (98%) create mode 100644 x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/trial/index.ts create mode 100644 x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/cases.ts diff --git a/.buildkite/ftr_platform_stateful_configs.yml b/.buildkite/ftr_platform_stateful_configs.yml index c14339547f59..63c29e80d926 100644 --- a/.buildkite/ftr_platform_stateful_configs.yml +++ b/.buildkite/ftr_platform_stateful_configs.yml @@ -158,11 +158,11 @@ enabled: - x-pack/test/api_integration/apis/cases/config.ts - x-pack/test/api_integration/apis/security/config.ts - x-pack/test/banners_functional/config.ts - - x-pack/test/cases_api_integration/security_and_spaces/config_basic.ts - - x-pack/test/cases_api_integration/security_and_spaces/config_trial.ts - - x-pack/test/cases_api_integration/security_and_spaces/config_trial_common.ts - - x-pack/test/cases_api_integration/security_and_spaces/config_no_public_base_url.ts - - x-pack/test/cases_api_integration/spaces_only/config.ts + - x-pack/platform/test/cases_api_integration/security_and_spaces/config_basic.ts + - x-pack/platform/test/cases_api_integration/security_and_spaces/config_trial.ts + - x-pack/platform/test/cases_api_integration/security_and_spaces/config_trial_common.ts + - x-pack/platform/test/cases_api_integration/security_and_spaces/config_no_public_base_url.ts + - x-pack/platform/test/cases_api_integration/spaces_only/config.ts - x-pack/test/disable_ems/config.ts - x-pack/test/examples/config.ts - x-pack/test/fleet_api_integration/config.agent.ts diff --git a/.buildkite/ftr_security_stateful_configs.yml b/.buildkite/ftr_security_stateful_configs.yml index ed898c8bbe6b..6e26b5022bc3 100644 --- a/.buildkite/ftr_security_stateful_configs.yml +++ b/.buildkite/ftr_security_stateful_configs.yml @@ -123,3 +123,5 @@ enabled: - x-pack/solutions/security/test/alerting_api_integration/security_and_spaces/group1/config.ts - x-pack/solutions/security/test/alerting_api_integration/security_and_spaces/group2/config.ts - x-pack/solutions/security/test/alerting_api_integration/security_and_spaces/group2/config_non_dedicated_task_runner.ts + - x-pack/solutions/security/test/cases_api_integration/security_and_spaces/config_trial.ts + - x-pack/solutions/security/test/cases_api_integration/security_and_spaces/config_trial_common.ts diff --git a/.eslintrc.js b/.eslintrc.js index 90ee44bdbefe..fff0e3a9d62f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1806,7 +1806,8 @@ module.exports = { 'x-pack/platform/packages/shared/kbn-alerting-comparators/**/*.{ts, tsx}', 'x-pack/platform/plugins/shared/embeddable_alerts_table/**/*.{ts,tsx}', 'x-pack/platform/test/alerting_api_integration/**/*.{ts, tsx}', - 'x-pack/test/cases_api_integration/**/*.{ts, tsx}', + 'x-pack/platform/test/cases_api_integration/**/*.{ts, tsx}', + 'x-pack/solutions/**/test/cases_api_integration/**/*.{ts, tsx}', 'x-pack/test/rule_registry/**/*.{ts, tsx}', 'x-pack/test/api_integration/apis/cases/**/*.{ts, tsx}', ], diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a281585b9d7b..c12fcb9cba29 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -977,6 +977,9 @@ x-pack/platform/test/alerting_api_integration/common/plugins/alerts_restricted @ x-pack/platform/test/alerting_api_integration/common/plugins/task_manager_fixture @elastic/response-ops x-pack/platform/test/alerting_api_integration/packages/helpers @elastic/response-ops x-pack/platform/test/api_integration/apis/entity_manager/fixture_plugin @elastic/obs-entities +x-pack/platform/test/cases_api_integration/common/plugins/cases @elastic/response-ops +x-pack/platform/test/cases_api_integration/common/plugins/observability @elastic/response-ops +x-pack/platform/test/cases_api_integration/common/plugins/security_solution @elastic/response-ops x-pack/platform/test/encrypted_saved_objects_api_integration/plugins/api_consumer_plugin @elastic/kibana-security x-pack/platform/test/plugin_api_integration/plugins/elasticsearch_client @elastic/kibana-core x-pack/platform/test/plugin_api_integration/plugins/event_log @elastic/response-ops @@ -1095,9 +1098,6 @@ x-pack/solutions/security/plugins/session_view @elastic/kibana-cloud-security-po x-pack/solutions/security/test x-pack/test x-pack/test_serverless -x-pack/test/cases_api_integration/common/plugins/cases @elastic/response-ops -x-pack/test/cases_api_integration/common/plugins/observability @elastic/response-ops -x-pack/test/cases_api_integration/common/plugins/security_solution @elastic/response-ops x-pack/test/cloud_integration/plugins/saml_provider @elastic/kibana-core x-pack/test/functional_cors/plugins/kibana_cors_test @elastic/kibana-security x-pack/test/functional_embedded/plugins/iframe_embedded @elastic/kibana-core @@ -2136,7 +2136,8 @@ x-pack/platform/plugins/private/cloud_integrations/cloud_full_story/server/confi /x-pack/platform/test/task_manager_claimer_update_by_query/ @elastic/response-ops /docs/user/alerting/ @elastic/response-ops /docs/management/connectors/ @elastic/response-ops -/x-pack/test/cases_api_integration/ @elastic/response-ops +/x-pack/platform/test/cases_api_integration/ @elastic/response-ops +/x-pack/solutions/security/test/cases_api_integration/ @elastic/response-ops /x-pack/test/functional/services/cases/ @elastic/response-ops @elastic/kibana-cases /x-pack/test/functional_with_es_ssl/apps/cases/ @elastic/response-ops @elastic/kibana-cases /x-pack/test/api_integration/apis/cases/ @elastic/response-ops @elastic/kibana-cases diff --git a/package.json b/package.json index 712067001448..c15cc5fa4229 100644 --- a/package.json +++ b/package.json @@ -218,7 +218,7 @@ "@kbn/calculate-auto": "link:src/platform/packages/shared/kbn-calculate-auto", "@kbn/calculate-width-from-char-count": "link:src/platform/packages/shared/kbn-calculate-width-from-char-count", "@kbn/canvas-plugin": "link:x-pack/platform/plugins/private/canvas", - "@kbn/cases-api-integration-test-plugin": "link:x-pack/test/cases_api_integration/common/plugins/cases", + "@kbn/cases-api-integration-test-plugin": "link:x-pack/platform/test/cases_api_integration/common/plugins/cases", "@kbn/cases-components": "link:src/platform/packages/shared/kbn-cases-components", "@kbn/cases-plugin": "link:x-pack/platform/plugins/shared/cases", "@kbn/cbor": "link:src/platform/packages/shared/kbn-cbor", @@ -727,7 +727,7 @@ "@kbn/observability-ai-server": "link:x-pack/solutions/observability/packages/observability-ai/observability-ai-server", "@kbn/observability-alert-details": "link:x-pack/solutions/observability/packages/alert-details", "@kbn/observability-alerting-test-data": "link:x-pack/solutions/observability/packages/alerting-test-data", - "@kbn/observability-fixtures-plugin": "link:x-pack/test/cases_api_integration/common/plugins/observability", + "@kbn/observability-fixtures-plugin": "link:x-pack/platform/test/cases_api_integration/common/plugins/observability", "@kbn/observability-get-padded-alert-time-range-util": "link:x-pack/solutions/observability/packages/get-padded-alert-time-range-util", "@kbn/observability-logs-explorer-plugin": "link:x-pack/solutions/observability/plugins/observability_logs_explorer", "@kbn/observability-onboarding-plugin": "link:x-pack/solutions/observability/plugins/observability_onboarding", @@ -873,7 +873,7 @@ "@kbn/security-solution-distribution-bar": "link:x-pack/solutions/security/packages/distribution-bar", "@kbn/security-solution-ess": "link:x-pack/solutions/security/plugins/security_solution_ess", "@kbn/security-solution-features": "link:x-pack/solutions/security/packages/features", - "@kbn/security-solution-fixtures-plugin": "link:x-pack/test/cases_api_integration/common/plugins/security_solution", + "@kbn/security-solution-fixtures-plugin": "link:x-pack/platform/test/cases_api_integration/common/plugins/security_solution", "@kbn/security-solution-navigation": "link:x-pack/solutions/security/packages/navigation", "@kbn/security-solution-plugin": "link:x-pack/solutions/security/plugins/security_solution", "@kbn/security-solution-serverless": "link:x-pack/solutions/security/plugins/security_solution_serverless", diff --git a/tsconfig.base.json b/tsconfig.base.json index 21c8e4f48b09..379300c206a1 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -138,8 +138,8 @@ "@kbn/canvas-plugin/*": ["x-pack/platform/plugins/private/canvas/*"], "@kbn/capture-oas-snapshot-cli": ["packages/kbn-capture-oas-snapshot-cli"], "@kbn/capture-oas-snapshot-cli/*": ["packages/kbn-capture-oas-snapshot-cli/*"], - "@kbn/cases-api-integration-test-plugin": ["x-pack/test/cases_api_integration/common/plugins/cases"], - "@kbn/cases-api-integration-test-plugin/*": ["x-pack/test/cases_api_integration/common/plugins/cases/*"], + "@kbn/cases-api-integration-test-plugin": ["x-pack/platform/test/cases_api_integration/common/plugins/cases"], + "@kbn/cases-api-integration-test-plugin/*": ["x-pack/platform/test/cases_api_integration/common/plugins/cases/*"], "@kbn/cases-components": ["src/platform/packages/shared/kbn-cases-components"], "@kbn/cases-components/*": ["src/platform/packages/shared/kbn-cases-components/*"], "@kbn/cases-plugin": ["x-pack/platform/plugins/shared/cases"], @@ -1380,8 +1380,8 @@ "@kbn/observability-alert-details/*": ["x-pack/solutions/observability/packages/alert-details/*"], "@kbn/observability-alerting-test-data": ["x-pack/solutions/observability/packages/alerting-test-data"], "@kbn/observability-alerting-test-data/*": ["x-pack/solutions/observability/packages/alerting-test-data/*"], - "@kbn/observability-fixtures-plugin": ["x-pack/test/cases_api_integration/common/plugins/observability"], - "@kbn/observability-fixtures-plugin/*": ["x-pack/test/cases_api_integration/common/plugins/observability/*"], + "@kbn/observability-fixtures-plugin": ["x-pack/platform/test/cases_api_integration/common/plugins/observability"], + "@kbn/observability-fixtures-plugin/*": ["x-pack/platform/test/cases_api_integration/common/plugins/observability/*"], "@kbn/observability-get-padded-alert-time-range-util": ["x-pack/solutions/observability/packages/get-padded-alert-time-range-util"], "@kbn/observability-get-padded-alert-time-range-util/*": ["x-pack/solutions/observability/packages/get-padded-alert-time-range-util/*"], "@kbn/observability-logs-explorer-plugin": ["x-pack/solutions/observability/plugins/observability_logs_explorer"], @@ -1726,8 +1726,8 @@ "@kbn/security-solution-ess/*": ["x-pack/solutions/security/plugins/security_solution_ess/*"], "@kbn/security-solution-features": ["x-pack/solutions/security/packages/features"], "@kbn/security-solution-features/*": ["x-pack/solutions/security/packages/features/*"], - "@kbn/security-solution-fixtures-plugin": ["x-pack/test/cases_api_integration/common/plugins/security_solution"], - "@kbn/security-solution-fixtures-plugin/*": ["x-pack/test/cases_api_integration/common/plugins/security_solution/*"], + "@kbn/security-solution-fixtures-plugin": ["x-pack/platform/test/cases_api_integration/common/plugins/security_solution"], + "@kbn/security-solution-fixtures-plugin/*": ["x-pack/platform/test/cases_api_integration/common/plugins/security_solution/*"], "@kbn/security-solution-navigation": ["x-pack/solutions/security/packages/navigation"], "@kbn/security-solution-navigation/*": ["x-pack/solutions/security/packages/navigation/*"], "@kbn/security-solution-plugin": ["x-pack/solutions/security/plugins/security_solution"], diff --git a/x-pack/platform/plugins/shared/cases/common/constants/index.ts b/x-pack/platform/plugins/shared/cases/common/constants/index.ts index 1729c3592933..f87aea29e54c 100644 --- a/x-pack/platform/plugins/shared/cases/common/constants/index.ts +++ b/x-pack/platform/plugins/shared/cases/common/constants/index.ts @@ -34,7 +34,7 @@ export const CASE_ID_INCREMENTER_SAVED_OBJECT = 'cases-incrementing-id' as const export const CASES_UI_SETTING_ID_DISPLAY_INCREMENTAL_ID = 'cases:incrementalIdDisplay:enabled'; /** - * If more values are added here please also add them here: x-pack/test/cases_api_integration/common/plugins + * If more values are added here please also add them here: x-pack/platform/test/cases_api_integration/common/plugins */ export const SAVED_OBJECT_TYPES = [ CASE_SAVED_OBJECT, diff --git a/x-pack/test/cases_api_integration/common/config.ts b/x-pack/platform/test/cases_api_integration/common/config.ts similarity index 93% rename from x-pack/test/cases_api_integration/common/config.ts rename to x-pack/platform/test/cases_api_integration/common/config.ts index 1b11f6d519db..5ecf335b6eb7 100644 --- a/x-pack/test/cases_api_integration/common/config.ts +++ b/x-pack/platform/test/cases_api_integration/common/config.ts @@ -12,7 +12,7 @@ import type { FtrConfigProviderContext } from '@kbn/test'; import { findTestPluginPaths } from '@kbn/test'; import { ScoutTestRunConfigCategory } from '@kbn/scout-info'; -import { getAllExternalServiceSimulatorPaths } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib/actions_simulations_utils'; +import { getAllExternalServiceSimulatorPaths } from '../../alerting_api_integration/common/lib/actions_simulations_utils'; import { services } from './services'; interface CreateTestConfigOptions { @@ -93,10 +93,7 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions) .map((key) => `--xpack.${key}.enabled=false`), ...findTestPluginPaths([ path.resolve(__dirname, 'plugins'), - path.resolve( - __dirname, - '../../../platform/test/alerting_api_integration/common/plugins' - ), + path.resolve(__dirname, '../../alerting_api_integration/common/plugins'), ]), `--xpack.actions.preconfigured=${JSON.stringify({ 'preconfigured-servicenow': { diff --git a/x-pack/test/cases_api_integration/common/fixtures/saved_object_exports/single_case_user_actions_one_comment.ndjson b/x-pack/platform/test/cases_api_integration/common/fixtures/saved_object_exports/single_case_user_actions_one_comment.ndjson similarity index 100% rename from x-pack/test/cases_api_integration/common/fixtures/saved_object_exports/single_case_user_actions_one_comment.ndjson rename to x-pack/platform/test/cases_api_integration/common/fixtures/saved_object_exports/single_case_user_actions_one_comment.ndjson diff --git a/x-pack/test/cases_api_integration/common/fixtures/saved_object_exports/single_case_with_connector_update_to_none.ndjson b/x-pack/platform/test/cases_api_integration/common/fixtures/saved_object_exports/single_case_with_connector_update_to_none.ndjson similarity index 100% rename from x-pack/test/cases_api_integration/common/fixtures/saved_object_exports/single_case_with_connector_update_to_none.ndjson rename to x-pack/platform/test/cases_api_integration/common/fixtures/saved_object_exports/single_case_with_connector_update_to_none.ndjson diff --git a/x-pack/test/cases_api_integration/common/ftr_provider_context.d.ts b/x-pack/platform/test/cases_api_integration/common/ftr_provider_context.d.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/ftr_provider_context.d.ts rename to x-pack/platform/test/cases_api_integration/common/ftr_provider_context.d.ts diff --git a/x-pack/test/cases_api_integration/common/lib/alerts.ts b/x-pack/platform/test/cases_api_integration/common/lib/alerts.ts similarity index 78% rename from x-pack/test/cases_api_integration/common/lib/alerts.ts rename to x-pack/platform/test/cases_api_integration/common/lib/alerts.ts index 7579d9dc4d77..25f336a1fa5b 100644 --- a/x-pack/test/cases_api_integration/common/lib/alerts.ts +++ b/x-pack/platform/test/cases_api_integration/common/lib/alerts.ts @@ -7,22 +7,9 @@ import expect from '@kbn/expect'; import type SuperTest from 'supertest'; -import type { estypes } from '@elastic/elasticsearch'; -import type { ToolingLog } from '@kbn/tooling-log'; -import { DETECTION_ENGINE_QUERY_SIGNALS_URL } from '@kbn/security-solution-plugin/common/constants'; -import type { DetectionAlert } from '@kbn/security-solution-plugin/common/api/detection_engine'; -import type { RiskEnrichmentFields } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/utils/enrichments/types'; import type { Case } from '@kbn/cases-plugin/common'; import { AttachmentType } from '@kbn/cases-plugin/common'; import { ALERT_CASE_IDS } from '@kbn/rule-data-utils'; -import { - getRuleForAlertTesting, - createRule, - waitForRuleSuccess, - waitForAlertsToBePresent, - getAlertsByIds, - getQueryAlertIds, -} from '../../../common/utils/security_solution'; import { superUser } from './authentication/users'; import type { User } from './authentication/types'; import { getSpaceUrlPrefix } from './api/helpers'; @@ -30,36 +17,6 @@ import { createCase, deleteCases } from './api/case'; import { createComment, deleteAllComments } from './api'; import { postCaseReq } from './mock'; -export const createSecuritySolutionAlerts = async ( - supertest: SuperTest.Agent, - log: ToolingLog, - numberOfSignals: number = 1 -): Promise> => { - const rule = { - ...getRuleForAlertTesting(['auditbeat-*']), - query: 'process.executable: "/usr/bin/sudo"', - }; - const { id } = await createRule(supertest, log, rule); - await waitForRuleSuccess({ supertest, log, id }); - await waitForAlertsToBePresent(supertest, log, numberOfSignals, [id]); - const signals = await getAlertsByIds(supertest, log, [id]); - - return signals; -}; - -export const getSecuritySolutionAlerts = async ( - supertest: SuperTest.Agent, - alertIds: string[] -): Promise> => { - const { body: updatedAlert } = await supertest - .post(DETECTION_ENGINE_QUERY_SIGNALS_URL) - .set('kbn-xsrf', 'true') - .send(getQueryAlertIds(alertIds)) - .expect(200); - - return updatedAlert; -}; - interface AlertResponse { 'kibana.alert.case_ids'?: string[]; } diff --git a/x-pack/test/cases_api_integration/common/lib/api/attachments.ts b/x-pack/platform/test/cases_api_integration/common/lib/api/attachments.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/api/attachments.ts rename to x-pack/platform/test/cases_api_integration/common/lib/api/attachments.ts diff --git a/x-pack/test/cases_api_integration/common/lib/api/case.ts b/x-pack/platform/test/cases_api_integration/common/lib/api/case.ts similarity index 89% rename from x-pack/test/cases_api_integration/common/lib/api/case.ts rename to x-pack/platform/test/cases_api_integration/common/lib/api/case.ts index 66e0a00de9b0..24f969d485fe 100644 --- a/x-pack/test/cases_api_integration/common/lib/api/case.ts +++ b/x-pack/platform/test/cases_api_integration/common/lib/api/case.ts @@ -13,12 +13,10 @@ import type { CasesPatchRequest, } from '@kbn/cases-plugin/common/types/api'; import type SuperTest from 'supertest'; -import type { ToolingLog } from '@kbn/tooling-log'; import type { User } from '../authentication/types'; import { superUser } from '../authentication/users'; import { getSpaceUrlPrefix, setupAuth } from './helpers'; -import { waitFor } from '../../../../common/utils/security_solution/detections_response'; export const createCase = async ( supertest: SuperTest.Agent, @@ -41,18 +39,6 @@ export const createCase = async ( return theCase; }; -export const waitForCases = async (supertest: SuperTest.Agent, log: ToolingLog): Promise => { - await waitFor( - async () => { - const response = await getCases(supertest); - const cases = response; - return cases != null && cases.cases.length > 0 && cases?.cases[0]?.totalAlerts > 0; - }, - 'waitForCaseToAttachAlert', - log - ); -}; - export const getCases = async ( supertest: SuperTest.Agent, expectedHttpCode: number = 200, diff --git a/x-pack/test/cases_api_integration/common/lib/api/configuration.ts b/x-pack/platform/test/cases_api_integration/common/lib/api/configuration.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/api/configuration.ts rename to x-pack/platform/test/cases_api_integration/common/lib/api/configuration.ts diff --git a/x-pack/test/cases_api_integration/common/lib/api/connectors.ts b/x-pack/platform/test/cases_api_integration/common/lib/api/connectors.ts similarity index 97% rename from x-pack/test/cases_api_integration/common/lib/api/connectors.ts rename to x-pack/platform/test/cases_api_integration/common/lib/api/connectors.ts index 8a37f841f0aa..f885c68f9386 100644 --- a/x-pack/test/cases_api_integration/common/lib/api/connectors.ts +++ b/x-pack/platform/test/cases_api_integration/common/lib/api/connectors.ts @@ -16,10 +16,6 @@ import type { ActionTypeExecutorResult, FindActionResult, } from '@kbn/actions-plugin/server/types'; -import { - getServiceNowServer, - RecordingServiceNowSimulator, -} from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib/actions_simulations_utils'; import type { Case, CaseConnector, @@ -31,7 +27,11 @@ import type { GetCaseConnectorsResponse, } from '@kbn/cases-plugin/common/types/api'; import { camelCase, mapKeys } from 'lodash'; -import type { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { + getServiceNowServer, + RecordingServiceNowSimulator, +} from '../../../../alerting_api_integration/common/lib/actions_simulations_utils'; +import type { ObjectRemover as ActionsRemover } from '../../../../alerting_api_integration/common/lib'; import type { User } from '../authentication/types'; import { superUser } from '../authentication/users'; import { getPostCaseRequest } from '../mock'; diff --git a/x-pack/test/cases_api_integration/common/lib/api/files.ts b/x-pack/platform/test/cases_api_integration/common/lib/api/files.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/api/files.ts rename to x-pack/platform/test/cases_api_integration/common/lib/api/files.ts diff --git a/x-pack/test/cases_api_integration/common/lib/api/helpers.ts b/x-pack/platform/test/cases_api_integration/common/lib/api/helpers.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/api/helpers.ts rename to x-pack/platform/test/cases_api_integration/common/lib/api/helpers.ts diff --git a/x-pack/test/cases_api_integration/common/lib/api/index.ts b/x-pack/platform/test/cases_api_integration/common/lib/api/index.ts similarity index 94% rename from x-pack/test/cases_api_integration/common/lib/api/index.ts rename to x-pack/platform/test/cases_api_integration/common/lib/api/index.ts index 97e3e9de53d3..ccb63fc2c49b 100644 --- a/x-pack/test/cases_api_integration/common/lib/api/index.ts +++ b/x-pack/platform/test/cases_api_integration/common/lib/api/index.ts @@ -28,7 +28,6 @@ import { } from '@kbn/cases-plugin/common/constants'; import type { CaseMetricsFeature } from '@kbn/cases-plugin/common'; import type { SingleCaseMetricsResponse, CasesMetricsResponse } from '@kbn/cases-plugin/common'; -import type { SignalHit } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/types'; import type { CasePersistedAttributes } from '@kbn/cases-plugin/server/common/types/case'; import type { SavedObjectsRawDocSource } from '@kbn/core/server'; import type { ConfigurationPersistedAttributes } from '@kbn/cases-plugin/server/common/types/configure'; @@ -76,57 +75,6 @@ export * from './telemetry'; export { getSpaceUrlPrefix } from './helpers'; -function toArray(input: T | T[]): T[] { - if (Array.isArray(input)) { - return input; - } - return [input]; -} - -/** - * Query Elasticsearch for a set of signals within a set of indices - */ -// TODO: fix this to use new API/schema -export const getSignalsWithES = async ({ - es, - indices, - ids, -}: { - es: Client; - indices: string | string[]; - ids: string | string[]; -}): Promise>>> => { - const signals: TransportResult, unknown> = await es.search( - { - index: indices, - size: 10000, - query: { - bool: { - filter: [ - { - ids: { - values: toArray(ids), - }, - }, - ], - }, - }, - }, - { meta: true } - ); - - return signals.body.hits.hits.reduce((acc, hit) => { - let indexMap = acc.get(hit._index); - if (indexMap === undefined) { - indexMap = new Map>([[hit._id!, hit]]); - } else { - indexMap.set(hit._id!, hit); - } - acc.set(hit._index, indexMap); - return acc; - }, new Map>>()); -}; - interface SetStatusCasesParams { id: string; version: string; diff --git a/x-pack/test/cases_api_integration/common/lib/api/omit.ts b/x-pack/platform/test/cases_api_integration/common/lib/api/omit.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/api/omit.ts rename to x-pack/platform/test/cases_api_integration/common/lib/api/omit.ts diff --git a/x-pack/test/cases_api_integration/common/lib/api/telemetry.ts b/x-pack/platform/test/cases_api_integration/common/lib/api/telemetry.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/api/telemetry.ts rename to x-pack/platform/test/cases_api_integration/common/lib/api/telemetry.ts diff --git a/x-pack/test/cases_api_integration/common/lib/api/user_actions.ts b/x-pack/platform/test/cases_api_integration/common/lib/api/user_actions.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/api/user_actions.ts rename to x-pack/platform/test/cases_api_integration/common/lib/api/user_actions.ts diff --git a/x-pack/test/cases_api_integration/common/lib/api/user_profiles.ts b/x-pack/platform/test/cases_api_integration/common/lib/api/user_profiles.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/api/user_profiles.ts rename to x-pack/platform/test/cases_api_integration/common/lib/api/user_profiles.ts diff --git a/x-pack/test/cases_api_integration/common/lib/authentication/index.ts b/x-pack/platform/test/cases_api_integration/common/lib/authentication/index.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/authentication/index.ts rename to x-pack/platform/test/cases_api_integration/common/lib/authentication/index.ts diff --git a/x-pack/test/cases_api_integration/common/lib/authentication/roles.ts b/x-pack/platform/test/cases_api_integration/common/lib/authentication/roles.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/authentication/roles.ts rename to x-pack/platform/test/cases_api_integration/common/lib/authentication/roles.ts diff --git a/x-pack/test/cases_api_integration/common/lib/authentication/spaces.ts b/x-pack/platform/test/cases_api_integration/common/lib/authentication/spaces.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/authentication/spaces.ts rename to x-pack/platform/test/cases_api_integration/common/lib/authentication/spaces.ts diff --git a/x-pack/test/cases_api_integration/common/lib/authentication/types.ts b/x-pack/platform/test/cases_api_integration/common/lib/authentication/types.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/authentication/types.ts rename to x-pack/platform/test/cases_api_integration/common/lib/authentication/types.ts diff --git a/x-pack/test/cases_api_integration/common/lib/authentication/users.ts b/x-pack/platform/test/cases_api_integration/common/lib/authentication/users.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/authentication/users.ts rename to x-pack/platform/test/cases_api_integration/common/lib/authentication/users.ts diff --git a/x-pack/test/cases_api_integration/common/lib/constants.ts b/x-pack/platform/test/cases_api_integration/common/lib/constants.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/constants.ts rename to x-pack/platform/test/cases_api_integration/common/lib/constants.ts diff --git a/x-pack/test/cases_api_integration/common/lib/mock.ts b/x-pack/platform/test/cases_api_integration/common/lib/mock.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/mock.ts rename to x-pack/platform/test/cases_api_integration/common/lib/mock.ts diff --git a/x-pack/test/cases_api_integration/common/lib/validation.ts b/x-pack/platform/test/cases_api_integration/common/lib/validation.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/lib/validation.ts rename to x-pack/platform/test/cases_api_integration/common/lib/validation.ts diff --git a/x-pack/test/cases_api_integration/common/plugins/cases/kibana.jsonc b/x-pack/platform/test/cases_api_integration/common/plugins/cases/kibana.jsonc similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/cases/kibana.jsonc rename to x-pack/platform/test/cases_api_integration/common/plugins/cases/kibana.jsonc diff --git a/x-pack/test/cases_api_integration/common/plugins/cases/package.json b/x-pack/platform/test/cases_api_integration/common/plugins/cases/package.json similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/cases/package.json rename to x-pack/platform/test/cases_api_integration/common/plugins/cases/package.json diff --git a/x-pack/test/cases_api_integration/common/plugins/cases/server/attachments/external_reference.ts b/x-pack/platform/test/cases_api_integration/common/plugins/cases/server/attachments/external_reference.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/cases/server/attachments/external_reference.ts rename to x-pack/platform/test/cases_api_integration/common/plugins/cases/server/attachments/external_reference.ts diff --git a/x-pack/test/cases_api_integration/common/plugins/cases/server/attachments/persistable_state.ts b/x-pack/platform/test/cases_api_integration/common/plugins/cases/server/attachments/persistable_state.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/cases/server/attachments/persistable_state.ts rename to x-pack/platform/test/cases_api_integration/common/plugins/cases/server/attachments/persistable_state.ts diff --git a/x-pack/test/cases_api_integration/common/plugins/cases/server/files/index.ts b/x-pack/platform/test/cases_api_integration/common/plugins/cases/server/files/index.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/cases/server/files/index.ts rename to x-pack/platform/test/cases_api_integration/common/plugins/cases/server/files/index.ts diff --git a/x-pack/test/cases_api_integration/common/plugins/cases/server/index.ts b/x-pack/platform/test/cases_api_integration/common/plugins/cases/server/index.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/cases/server/index.ts rename to x-pack/platform/test/cases_api_integration/common/plugins/cases/server/index.ts diff --git a/x-pack/test/cases_api_integration/common/plugins/cases/server/plugin.ts b/x-pack/platform/test/cases_api_integration/common/plugins/cases/server/plugin.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/cases/server/plugin.ts rename to x-pack/platform/test/cases_api_integration/common/plugins/cases/server/plugin.ts diff --git a/x-pack/test/cases_api_integration/common/plugins/cases/server/routes.ts b/x-pack/platform/test/cases_api_integration/common/plugins/cases/server/routes.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/cases/server/routes.ts rename to x-pack/platform/test/cases_api_integration/common/plugins/cases/server/routes.ts diff --git a/x-pack/test/cases_api_integration/common/plugins/cases/tsconfig.json b/x-pack/platform/test/cases_api_integration/common/plugins/cases/tsconfig.json similarity index 89% rename from x-pack/test/cases_api_integration/common/plugins/cases/tsconfig.json rename to x-pack/platform/test/cases_api_integration/common/plugins/cases/tsconfig.json index 72a20bd3f40d..adad80262d84 100644 --- a/x-pack/test/cases_api_integration/common/plugins/cases/tsconfig.json +++ b/x-pack/platform/test/cases_api_integration/common/plugins/cases/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../../../tsconfig.base.json", + "extends": "../../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "isolatedModules": true diff --git a/x-pack/test/cases_api_integration/common/plugins/observability/kibana.jsonc b/x-pack/platform/test/cases_api_integration/common/plugins/observability/kibana.jsonc similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/observability/kibana.jsonc rename to x-pack/platform/test/cases_api_integration/common/plugins/observability/kibana.jsonc diff --git a/x-pack/test/cases_api_integration/common/plugins/observability/package.json b/x-pack/platform/test/cases_api_integration/common/plugins/observability/package.json similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/observability/package.json rename to x-pack/platform/test/cases_api_integration/common/plugins/observability/package.json diff --git a/x-pack/test/cases_api_integration/common/plugins/observability/server/index.ts b/x-pack/platform/test/cases_api_integration/common/plugins/observability/server/index.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/observability/server/index.ts rename to x-pack/platform/test/cases_api_integration/common/plugins/observability/server/index.ts diff --git a/x-pack/test/cases_api_integration/common/plugins/observability/server/plugin.ts b/x-pack/platform/test/cases_api_integration/common/plugins/observability/server/plugin.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/observability/server/plugin.ts rename to x-pack/platform/test/cases_api_integration/common/plugins/observability/server/plugin.ts diff --git a/x-pack/test/cases_api_integration/common/plugins/security_solution/tsconfig.json b/x-pack/platform/test/cases_api_integration/common/plugins/observability/tsconfig.json similarity index 86% rename from x-pack/test/cases_api_integration/common/plugins/security_solution/tsconfig.json rename to x-pack/platform/test/cases_api_integration/common/plugins/observability/tsconfig.json index 78b4caaf4bf9..642157557985 100644 --- a/x-pack/test/cases_api_integration/common/plugins/security_solution/tsconfig.json +++ b/x-pack/platform/test/cases_api_integration/common/plugins/observability/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../../../tsconfig.base.json", + "extends": "../../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "isolatedModules": true diff --git a/x-pack/test/cases_api_integration/common/plugins/security_solution/kibana.jsonc b/x-pack/platform/test/cases_api_integration/common/plugins/security_solution/kibana.jsonc similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/security_solution/kibana.jsonc rename to x-pack/platform/test/cases_api_integration/common/plugins/security_solution/kibana.jsonc diff --git a/x-pack/test/cases_api_integration/common/plugins/security_solution/package.json b/x-pack/platform/test/cases_api_integration/common/plugins/security_solution/package.json similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/security_solution/package.json rename to x-pack/platform/test/cases_api_integration/common/plugins/security_solution/package.json diff --git a/x-pack/test/cases_api_integration/common/plugins/security_solution/server/index.ts b/x-pack/platform/test/cases_api_integration/common/plugins/security_solution/server/index.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/security_solution/server/index.ts rename to x-pack/platform/test/cases_api_integration/common/plugins/security_solution/server/index.ts diff --git a/x-pack/test/cases_api_integration/common/plugins/security_solution/server/plugin.ts b/x-pack/platform/test/cases_api_integration/common/plugins/security_solution/server/plugin.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/plugins/security_solution/server/plugin.ts rename to x-pack/platform/test/cases_api_integration/common/plugins/security_solution/server/plugin.ts diff --git a/x-pack/test/cases_api_integration/common/plugins/observability/tsconfig.json b/x-pack/platform/test/cases_api_integration/common/plugins/security_solution/tsconfig.json similarity index 86% rename from x-pack/test/cases_api_integration/common/plugins/observability/tsconfig.json rename to x-pack/platform/test/cases_api_integration/common/plugins/security_solution/tsconfig.json index 78b4caaf4bf9..642157557985 100644 --- a/x-pack/test/cases_api_integration/common/plugins/observability/tsconfig.json +++ b/x-pack/platform/test/cases_api_integration/common/plugins/security_solution/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../../../../tsconfig.base.json", + "extends": "../../../../../../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", "isolatedModules": true diff --git a/x-pack/platform/test/cases_api_integration/common/roles.ts b/x-pack/platform/test/cases_api_integration/common/roles.ts new file mode 100644 index 000000000000..10bc3abfd847 --- /dev/null +++ b/x-pack/platform/test/cases_api_integration/common/roles.ts @@ -0,0 +1,951 @@ +/* + * 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 { Role } from './lib/authentication/types'; + +/** + * Roles for Cases in Security Solution + */ + +export const secAllCasesOnlyDelete: Role = { + name: 'sec_all_cases_only_delete_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['all'], + securitySolutionCases: ['cases_delete'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const secAllCasesOnlyReadDelete: Role = { + name: 'sec_all_cases_only_read_delete_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['all'], + securitySolutionCases: ['read', 'cases_delete'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const secAllCasesNoDelete: Role = { + name: 'sec_all_cases_no_delete_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['all'], + securitySolutionCases: ['minimal_all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const secAll: Role = { + name: 'sec_all_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['all'], + securitySolutionCases: ['all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const secCasesV2All: Role = { + name: 'sec_cases_v2_all_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['all'], + securitySolutionCasesV2: ['all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const secCasesV3All: Role = { + name: 'sec_cases_v3_all_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['all'], + securitySolutionCasesV3: ['all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const secCasesV2NoReopenWithCreateComment: Role = { + name: 'sec_cases_v2_no_reopen_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['all'], + securitySolutionCasesV2: ['read', 'update', 'create', 'cases_delete', 'create_comment'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const secCasesV2NoCreateCommentWithReopen: Role = { + name: 'sec_cases_v2_create_comment_no_reopen_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['all'], + securitySolutionCasesV2: ['read', 'update', 'create', 'delete', 'case_reopen'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const secAllSpace1: Role = { + name: 'sec_all_role_space1_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['all'], + securitySolutionCases: ['all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['space1'], + }, + ], + }, +}; + +export const secAllCasesRead: Role = { + name: 'sec_all_cases_read_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['all'], + securitySolutionCases: ['read'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const secAllCasesNone: Role = { + name: 'sec_all_cases_none_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const secReadCasesAll: Role = { + name: 'sec_read_cases_all_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['read'], + securitySolutionCases: ['all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const secReadCasesRead: Role = { + name: 'sec_read_cases_read_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['read'], + securitySolutionCases: ['read'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const secRead: Role = { + name: 'sec_read_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['read'], + securitySolutionCases: ['read'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const secReadCasesNone: Role = { + name: 'sec_read_cases_none_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: ['read'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const secNone: Role = { + name: 'sec_none_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + siem: [], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +/** + * Roles for Cases in the stack + */ + +export const casesOnlyDelete: Role = { + name: 'cases_only_delete_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + generalCases: ['cases_delete'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const casesOnlyReadDelete: Role = { + name: 'cases_only_read_delete_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + generalCases: ['read', 'cases_delete'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const casesNoDelete: Role = { + name: 'cases_no_delete_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + generalCases: ['minimal_all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const casesAll: Role = { + name: 'cases_all_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + generalCases: ['all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const casesV2All: Role = { + name: 'cases_v2_all_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { + generalCasesV2: ['all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + }, + ], + }, +}; + +export const casesV3All: Role = { + name: 'cases_v3_all_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { + generalCasesV3: ['all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + }, + ], + }, +}; + +export const casesV3NoAssignee: Role = { + name: 'cases_v3_no_assignee_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { + generalCasesV3: ['minimal_read', 'cases_delete', 'case_reopen', 'create_comment'], + actions: ['all'], + actionsSimulators: ['all'], + }, + }, + ], + }, +}; + +export const casesV3ReadAndAssignee: Role = { + name: 'cases_v3_read_assignee_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { + generalCasesV3: ['minimal_read', 'cases_assign'], + actions: ['all'], + actionsSimulators: ['all'], + }, + }, + ], + }, +}; + +export const casesV2NoReopenWithCreateComment: Role = { + name: 'cases_v2_no_reopen_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { + generalCasesV2: ['read', 'update', 'create', 'cases_delete', 'create_comment'], + actions: ['all'], + actionsSimulators: ['all'], + }, + }, + ], + }, +}; + +export const casesV2NoCreateCommentWithReopen: Role = { + name: 'cases_v2_no_create_comment_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { + generalCasesV2: ['read', 'update', 'create', 'cases_delete', 'case_reopen'], + actions: ['all'], + actionsSimulators: ['all'], + }, + }, + ], + }, +}; + +export const casesRead: Role = { + name: 'cases_read_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + generalCases: ['read'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +/** + * Roles for Cases in Observability + */ + +export const obsCasesOnlyDelete: Role = { + name: 'obs_cases_only_delete_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + observabilityCases: ['cases_delete'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const obsCasesOnlyReadDelete: Role = { + name: 'obs_cases_only_read_delete_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + observabilityCases: ['read', 'cases_delete'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const obsCasesNoDelete: Role = { + name: 'obs_cases_no_delete_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + observabilityCases: ['minimal_all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const obsCasesAll: Role = { + name: 'obs_cases_all_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + observabilityCases: ['all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const obsCasesV2All: Role = { + name: 'obs_cases_v2_all_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { + observabilityCasesV2: ['all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + }, + ], + }, +}; + +export const obsCasesV3All: Role = { + name: 'obs_cases_v3_all_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { + observabilityCasesV3: ['all'], + actions: ['all'], + actionsSimulators: ['all'], + }, + }, + ], + }, +}; + +export const obsCasesV2NoReopenWithCreateComment: Role = { + name: 'obs_cases_v2_no_reopen_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { + observabilityCasesV2: [ + 'read', + 'cases_update', + 'create', + 'cases_delete', + 'create_comment', + ], + actions: ['all'], + actionsSimulators: ['all'], + }, + }, + ], + }, +}; + +export const obsCasesV2NoCreateCommentWithReopen: Role = { + name: 'obs_cases_v2_no_create_comment_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + spaces: ['*'], + base: [], + feature: { + observabilityCasesV2: ['read', 'update', 'create', 'cases_delete', 'case_reopen'], + actions: ['all'], + actionsSimulators: ['all'], + }, + }, + ], + }, +}; + +export const obsCasesRead: Role = { + name: 'obs_cases_read_role_api_int', + privileges: { + elasticsearch: { + indices: [ + { + names: ['*'], + privileges: ['all'], + }, + ], + }, + kibana: [ + { + feature: { + observabilityCases: ['read'], + actions: ['all'], + actionsSimulators: ['all'], + }, + spaces: ['*'], + }, + ], + }, +}; + +export const roles = [ + secAllCasesOnlyDelete, + secAllCasesOnlyReadDelete, + secAllCasesNoDelete, + secAll, + secCasesV2All, + secCasesV3All, + secCasesV2NoReopenWithCreateComment, + secCasesV2NoCreateCommentWithReopen, + secAllSpace1, + secAllCasesRead, + secAllCasesNone, + secReadCasesAll, + secReadCasesRead, + secReadCasesNone, + secRead, + casesOnlyDelete, + casesOnlyReadDelete, + casesNoDelete, + casesAll, + casesV2All, + casesV3All, + casesV3NoAssignee, + casesV3ReadAndAssignee, + casesV2NoReopenWithCreateComment, + casesV2NoCreateCommentWithReopen, + casesRead, + obsCasesOnlyDelete, + obsCasesOnlyReadDelete, + obsCasesNoDelete, + obsCasesAll, + obsCasesV2All, + obsCasesV3All, + obsCasesV2NoReopenWithCreateComment, + obsCasesV2NoCreateCommentWithReopen, + obsCasesRead, +]; diff --git a/x-pack/test/cases_api_integration/common/services.ts b/x-pack/platform/test/cases_api_integration/common/services.ts similarity index 100% rename from x-pack/test/cases_api_integration/common/services.ts rename to x-pack/platform/test/cases_api_integration/common/services.ts diff --git a/x-pack/platform/test/cases_api_integration/common/users.ts b/x-pack/platform/test/cases_api_integration/common/users.ts new file mode 100644 index 000000000000..d5668bdf6e12 --- /dev/null +++ b/x-pack/platform/test/cases_api_integration/common/users.ts @@ -0,0 +1,331 @@ +/* + * 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 { User } from './lib/authentication/types'; +import { + casesAll, + casesV2All, + casesV3All, + casesV3NoAssignee, + casesV3ReadAndAssignee, + casesNoDelete, + casesOnlyDelete, + casesOnlyReadDelete, + casesRead, + obsCasesAll, + obsCasesV2All, + obsCasesV3All, + obsCasesNoDelete, + obsCasesOnlyDelete, + obsCasesOnlyReadDelete, + obsCasesRead, + secAll, + secCasesV2All, + secCasesV3All, + secAllCasesNoDelete, + secAllCasesNone, + secAllCasesOnlyDelete, + secAllCasesOnlyReadDelete, + secAllCasesRead, + secAllSpace1, + secRead, + secReadCasesAll, + secReadCasesNone, + secReadCasesRead, + secNone, + casesV2NoReopenWithCreateComment, + obsCasesV2NoReopenWithCreateComment, + secCasesV2NoReopenWithCreateComment, + secCasesV2NoCreateCommentWithReopen, + casesV2NoCreateCommentWithReopen, + obsCasesV2NoCreateCommentWithReopen, +} from './roles'; + +/** + * Users for Cases in Security Solution + */ + +export const secAllCasesOnlyDeleteUser: User = { + username: 'sec_all_cases_only_delete_user_api_int', + password: 'password', + roles: [secAllCasesOnlyDelete.name], +}; + +export const secAllCasesOnlyReadDeleteUser: User = { + username: 'sec_all_cases_only_read_delete_user_api_int', + password: 'password', + roles: [secAllCasesOnlyReadDelete.name], +}; + +export const secAllCasesNoDeleteUser: User = { + username: 'sec_all_cases_no_delete_user_api_int', + password: 'password', + roles: [secAllCasesNoDelete.name], +}; + +export const secAllUser: User = { + username: 'sec_all_user_api_int', + password: 'password', + roles: [secAll.name], +}; + +export const secCasesV2AllUser: User = { + username: 'sec_cases_v2_all_user_api_int', + password: 'password', + roles: [secCasesV2All.name], +}; + +export const secCasesV3AllUser: User = { + username: 'sec_cases_v3_all_user_api_int', + password: 'password', + roles: [secCasesV3All.name], +}; + +export const secCasesV2NoReopenWithCreateCommentUser: User = { + username: 'sec_cases_v2_no_reopen_with_create_comment_user_api_int', + password: 'password', + roles: [secCasesV2NoReopenWithCreateComment.name], +}; + +export const secCasesV2NoCreateCommentWithReopenUser: User = { + username: 'sec_cases_v2_no_create_comment_with_reopen_user_api_int', + password: 'password', + roles: [secCasesV2NoCreateCommentWithReopen.name], +}; + +export const secAllSpace1User: User = { + username: 'sec_all_space1_user_api_int', + password: 'password', + roles: [secAllSpace1.name], +}; + +export const secAllCasesReadUser: User = { + username: 'sec_all_cases_read_user_api_int', + password: 'password', + roles: [secAllCasesRead.name], +}; + +export const secAllCasesNoneUser: User = { + username: 'sec_all_cases_none_user_api_int', + password: 'password', + roles: [secAllCasesNone.name], +}; + +export const secReadCasesAllUser: User = { + username: 'sec_read_cases_all_user_api_int', + password: 'password', + roles: [secReadCasesAll.name], +}; + +export const secReadCasesReadUser: User = { + username: 'sec_read_cases_read_user_api_int', + password: 'password', + roles: [secReadCasesRead.name], +}; + +export const secReadUser: User = { + username: 'sec_read_user_api_int', + password: 'password', + roles: [secRead.name], +}; + +export const secNoneUser: User = { + username: 'sec_none_user_api_int', + password: 'password', + roles: [secNone.name], +}; + +export const secReadCasesNoneUser: User = { + username: 'sec_read_cases_none_user_api_int', + password: 'password', + roles: [secReadCasesNone.name], +}; + +/** + * Users for Cases in the Stack + */ + +export const casesOnlyDeleteUser: User = { + username: 'cases_only_delete_user_api_int', + password: 'password', + roles: [casesOnlyDelete.name], +}; + +export const casesOnlyReadDeleteUser: User = { + username: 'cases_only_read_delete_user_api_int', + password: 'password', + roles: [casesOnlyReadDelete.name], +}; + +export const casesNoDeleteUser: User = { + username: 'cases_no_delete_user_api_int', + password: 'password', + roles: [casesNoDelete.name], +}; + +export const casesAllUser: User = { + username: 'cases_all_user_api_int', + password: 'password', + roles: [casesAll.name], +}; + +export const casesV2AllUser: User = { + username: 'cases_v2_all_user_api_int', + password: 'password', + roles: [casesV2All.name], +}; + +export const casesV3AllUser: User = { + username: 'cases_v3_all_user_api_int', + password: 'password', + roles: [casesV3All.name], +}; + +export const casesV3NoAssigneeUser: User = { + username: 'cases_v3_no_assignee_user_api_int', + password: 'password', + roles: [casesV3NoAssignee.name], +}; + +export const casesV3ReadAndAssignUser: User = { + username: 'cases_v3_read_and_assignee_user_api_int', + password: 'password', + roles: [casesV3ReadAndAssignee.name], +}; + +export const casesV2NoReopenWithCreateCommentUser: User = { + username: 'cases_v2_no_reopen_with_create_comment_user_api_int', + password: 'password', + roles: [casesV2NoReopenWithCreateComment.name], +}; + +export const casesV2NoCreateCommentWithReopenUser: User = { + username: 'cases_v2_no_create_comment_with_reopen_user_api_int', + password: 'password', + roles: [casesV2NoCreateCommentWithReopen.name], +}; + +export const casesReadUser: User = { + username: 'cases_read_user_api_int', + password: 'password', + roles: [casesRead.name], +}; + +/** + * Users for Cases in Observability + */ + +export const obsCasesOnlyDeleteUser: User = { + username: 'obs_cases_only_delete_user_api_int', + password: 'password', + roles: [obsCasesOnlyDelete.name], +}; + +export const obsCasesOnlyReadDeleteUser: User = { + username: 'obs_cases_only_read_delete_user_api_int', + password: 'password', + roles: [obsCasesOnlyReadDelete.name], +}; + +export const obsCasesNoDeleteUser: User = { + username: 'obs_cases_no_delete_user_api_int', + password: 'password', + roles: [obsCasesNoDelete.name], +}; + +export const obsCasesAllUser: User = { + username: 'obs_cases_all_user_api_int', + password: 'password', + roles: [obsCasesAll.name], +}; + +export const obsCasesV2AllUser: User = { + username: 'obs_cases_v2_all_user_api_int', + password: 'password', + roles: [obsCasesV2All.name], +}; + +export const obsCasesV3AllUser: User = { + username: 'obs_cases_v3_all_user_api_int', + password: 'password', + roles: [obsCasesV3All.name], +}; + +export const obsCasesV2NoReopenWithCreateCommentUser: User = { + username: 'obs_cases_v2_no_reopen_with_create_comment_user_api_int', + password: 'password', + roles: [obsCasesV2NoReopenWithCreateComment.name], +}; + +export const obsCasesV2NoCreateCommentWithReopenUser: User = { + username: 'obs_cases_v2_no_create_comment_with_reopen_user_api_int', + password: 'password', + roles: [obsCasesV2NoCreateCommentWithReopen.name], +}; + +export const obsCasesReadUser: User = { + username: 'obs_cases_read_user_api_int', + password: 'password', + roles: [obsCasesRead.name], +}; + +/** + * Users for Observability and Security Solution + */ + +export const obsSecCasesAllUser: User = { + username: 'obs_sec_cases_all_user_api_int', + password: 'password', + roles: [obsCasesAll.name, secAll.name], +}; + +export const obsSecCasesReadUser: User = { + username: 'obs_sec_cases_read_user_api_int', + password: 'password', + roles: [obsCasesRead.name, secRead.name], +}; + +export const users = [ + secAllCasesOnlyDeleteUser, + secAllCasesOnlyReadDeleteUser, + secAllCasesNoDeleteUser, + secAllUser, + secCasesV2AllUser, + secCasesV3AllUser, + secCasesV2NoReopenWithCreateCommentUser, + secCasesV2NoCreateCommentWithReopenUser, + secAllSpace1User, + secAllCasesReadUser, + secAllCasesNoneUser, + secReadCasesAllUser, + secReadCasesReadUser, + secReadUser, + secNoneUser, + secReadCasesNoneUser, + casesOnlyDeleteUser, + casesOnlyReadDeleteUser, + casesNoDeleteUser, + casesAllUser, + casesV2AllUser, + casesV3AllUser, + casesV3NoAssigneeUser, + casesV3ReadAndAssignUser, + casesV2NoReopenWithCreateCommentUser, + casesV2NoCreateCommentWithReopenUser, + casesReadUser, + obsCasesOnlyDeleteUser, + obsCasesOnlyReadDeleteUser, + obsCasesNoDeleteUser, + obsCasesAllUser, + obsCasesV2AllUser, + obsCasesV3AllUser, + obsCasesV2NoReopenWithCreateCommentUser, + obsCasesV2NoCreateCommentWithReopenUser, + obsCasesReadUser, + obsSecCasesAllUser, + obsSecCasesReadUser, +]; diff --git a/x-pack/test/cases_api_integration/security_and_spaces/config_basic.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/config_basic.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/config_basic.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/config_basic.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/config_no_public_base_url.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/config_no_public_base_url.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/config_no_public_base_url.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/config_no_public_base_url.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/config_trial.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/config_trial.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/config_trial.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/config_trial.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/config_trial_common.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/config_trial_common.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/config_trial_common.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/config_trial_common.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/basic/attachments_framework/registered_persistable_state_basic.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/basic/attachments_framework/registered_persistable_state_basic.ts similarity index 94% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/basic/attachments_framework/registered_persistable_state_basic.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/basic/attachments_framework/registered_persistable_state_basic.ts index 27a7d1983147..c636fadc2578 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/basic/attachments_framework/registered_persistable_state_basic.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/basic/attachments_framework/registered_persistable_state_basic.ts @@ -15,7 +15,7 @@ export default ({ getService }: FtrProviderContext): void => { /** * Attachment types are being registered in - * x-pack/test/cases_api_integration/common/plugins/cases/server/plugin.ts + * x-pack/platform/test/cases_api_integration/common/plugins/cases/server/plugin.ts */ describe('Persistable state attachments', () => { // This test is intended to fail when new persistable state attachment types are registered. diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/basic/cases/assignees.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/basic/cases/assignees.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/basic/cases/assignees.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/basic/cases/assignees.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/basic/cases/push_case.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/basic/cases/push_case.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/basic/cases/push_case.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/basic/cases/push_case.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/basic/configure/get_connectors.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/basic/configure/get_connectors.ts similarity index 94% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/basic/configure/get_connectors.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/basic/configure/get_connectors.ts index 0995cbaaf068..81a5b81ff452 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/basic/configure/get_connectors.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/basic/configure/get_connectors.ts @@ -17,7 +17,7 @@ export default ({ getService }: FtrProviderContext): void => { describe('get_connectors', () => { /** * A ServiceNow preconfigured connector is registered here - * x-pack/test/cases_api_integration/common/config.ts + * x-pack/platform/test/cases_api_integration/common/config.ts * * The license for this test is set to basic. ServiceNow connectors * needs license >= platinum. The test below ensures diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/basic/index.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/basic/index.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/basic/index.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/basic/index.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/basic/internal/suggest_user_profiles.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/basic/internal/suggest_user_profiles.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/basic/internal/suggest_user_profiles.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/basic/internal/suggest_user_profiles.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/alerts/get_alerts_attached_to_case.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/alerts/get_alerts_attached_to_case.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/alerts/get_alerts_attached_to_case.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/alerts/get_alerts_attached_to_case.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/alerts/get_cases.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/alerts/get_cases.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/alerts/get_cases.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/alerts/get_cases.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/attachments_framework/external_references.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/attachments_framework/external_references.ts similarity index 99% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/attachments_framework/external_references.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/attachments_framework/external_references.ts index 15ee6115e701..662abf2f1146 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/attachments_framework/external_references.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/attachments_framework/external_references.ts @@ -41,7 +41,7 @@ export default ({ getService }: FtrProviderContext): void => { /** * Attachment types are being registered in - * x-pack/test/cases_api_integration/common/plugins/cases/server/plugin.ts + * x-pack/platform/test/cases_api_integration/common/plugins/cases/server/plugin.ts */ describe('External references', () => { afterEach(async () => { diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/attachments_framework/persistable_state.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/attachments_framework/persistable_state.ts similarity index 99% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/attachments_framework/persistable_state.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/attachments_framework/persistable_state.ts index 66703b80d0a9..0aa37bbcb46b 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/attachments_framework/persistable_state.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/attachments_framework/persistable_state.ts @@ -39,7 +39,7 @@ export default ({ getService }: FtrProviderContext): void => { /** * Attachment types are being registered in - * x-pack/test/cases_api_integration/common/plugins/cases/server/plugin.ts + * x-pack/platform/test/cases_api_integration/common/plugins/cases/server/plugin.ts */ describe('Persistable state attachments', () => { describe('references', () => { diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/bulk_create_cases.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/bulk_create_cases.ts similarity index 98% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/bulk_create_cases.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/bulk_create_cases.ts index 84ee905a9617..d3b8ce11c912 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/bulk_create_cases.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/bulk_create_cases.ts @@ -44,7 +44,7 @@ export default ({ getService }: FtrProviderContext): void => { * is to test the bulkCreate method of the cases client in * x-pack/platform/plugins/shared/cases/server/client/cases/bulk_create.ts * - * The test route is configured here x-pack/test/cases_api_integration/common/plugins/cases/server/routes.ts + * The test route is configured here x-pack/platform/test/cases_api_integration/common/plugins/cases/server/routes.ts */ describe('bulk_create_cases', () => { const bulkCreateCases = async ({ diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/categories/get_categories.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/categories/get_categories.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/categories/get_categories.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/categories/get_categories.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/find_cases.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/find_cases.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/find_cases.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/find_cases.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/get_case.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/get_case.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/get_case.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/get_case.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/import_export.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/import_export.ts similarity index 98% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/import_export.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/import_export.ts index 3686556d74f0..253129f1f116 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/import_export.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/import_export.ts @@ -31,7 +31,7 @@ import type { PushedUserAction, } from '@kbn/cases-plugin/common/types/domain'; import type { CasePostRequest } from '@kbn/cases-plugin/common'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import { deleteAllCaseItems, createCase, diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/migrations.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/migrations.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/migrations.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/migrations.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/post_case.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/post_case.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/post_case.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/post_case.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/reporters/get_reporters.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/reporters/get_reporters.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/reporters/get_reporters.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/reporters/get_reporters.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/resolve_case.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/resolve_case.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/resolve_case.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/resolve_case.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/tags/get_tags.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/tags/get_tags.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/tags/get_tags.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/cases/tags/get_tags.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/find_comments.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/comments/find_comments.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/find_comments.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/comments/find_comments.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/get_comment.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/comments/get_comment.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/get_comment.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/comments/get_comment.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/migrations.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/comments/migrations.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/migrations.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/comments/migrations.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/patch_comment.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/comments/patch_comment.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/patch_comment.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/comments/patch_comment.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/configure/get_configure.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/configure/get_configure.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/configure/get_configure.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/configure/get_configure.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/configure/migrations.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/configure/migrations.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/configure/migrations.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/configure/migrations.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/configure/patch_configure.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/configure/patch_configure.ts similarity index 99% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/configure/patch_configure.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/configure/patch_configure.ts index 87605919c6ef..b81ebddbdd7b 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/configure/patch_configure.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/configure/patch_configure.ts @@ -12,7 +12,7 @@ import { CustomFieldTypes, } from '@kbn/cases-plugin/common/types/domain'; import type { ConfigurationPatchRequest } from '@kbn/cases-plugin/common/types/api'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; import { diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/configure/post_configure.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/configure/post_configure.ts similarity index 99% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/configure/post_configure.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/configure/post_configure.ts index eafc59c5a9fe..361a3e516e8a 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/configure/post_configure.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/configure/post_configure.ts @@ -12,7 +12,7 @@ import { CustomFieldTypes, } from '@kbn/cases-plugin/common/types/domain'; import { MAX_CUSTOM_FIELD_LABEL_LENGTH } from '@kbn/cases-plugin/common/constants'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; import { diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/files/post_file.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/files/post_file.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/files/post_file.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/files/post_file.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/index.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/index.ts similarity index 88% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/index.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/index.ts index 4fad597b83a7..57869d753464 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/index.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/index.ts @@ -13,21 +13,15 @@ export default ({ loadTestFile }: FtrProviderContext): void => { /** * Public routes */ - loadTestFile(require.resolve('./client/update_alert_status')); - loadTestFile(require.resolve('./comments/delete_comment')); - loadTestFile(require.resolve('./comments/delete_comments')); loadTestFile(require.resolve('./comments/find_comments')); loadTestFile(require.resolve('./comments/get_comment')); loadTestFile(require.resolve('./comments/patch_comment')); - loadTestFile(require.resolve('./comments/post_comment')); loadTestFile(require.resolve('./files/post_file')); loadTestFile(require.resolve('./alerts/get_cases')); loadTestFile(require.resolve('./alerts/get_alerts_attached_to_case')); - loadTestFile(require.resolve('./cases/delete_cases')); loadTestFile(require.resolve('./cases/import_export')); loadTestFile(require.resolve('./cases/find_cases')); loadTestFile(require.resolve('./cases/get_case')); - loadTestFile(require.resolve('./cases/patch_cases')); loadTestFile(require.resolve('./cases/post_case')); loadTestFile(require.resolve('./cases/resolve_case')); loadTestFile(require.resolve('./cases/reporters/get_reporters')); @@ -47,7 +41,6 @@ export default ({ loadTestFile }: FtrProviderContext): void => { /** * Internal routes */ - loadTestFile(require.resolve('./internal/bulk_create_attachments')); loadTestFile(require.resolve('./internal/bulk_get_cases')); loadTestFile(require.resolve('./internal/bulk_get_attachments')); loadTestFile(require.resolve('./internal/get_connectors')); diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/index_common_trial/index.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/index_common_trial/index.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/index_common_trial/index.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/index_common_trial/index.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_delete_file_attachments.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_delete_file_attachments.ts similarity index 99% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_delete_file_attachments.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_delete_file_attachments.ts index 6ed8231e0d59..9ff5bde9ce5f 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_delete_file_attachments.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_delete_file_attachments.ts @@ -41,8 +41,8 @@ import { secAllUser, secReadUser, users as api_int_users, -} from '../../../../../api_integration/apis/cases/common/users'; -import { roles as api_int_roles } from '../../../../../api_integration/apis/cases/common/roles'; +} from '../../../../common/users'; +import { roles as api_int_roles } from '../../../../common/roles'; // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_get_attachments.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_get_attachments.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_get_attachments.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_get_attachments.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_get_cases.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_get_cases.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_get_cases.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_get_cases.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/find_user_actions.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/find_user_actions.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/find_user_actions.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/find_user_actions.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/get_connectors.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/get_connectors.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/get_connectors.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/get_connectors.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_actions.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_actions.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_actions.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_actions.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_alerts.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_alerts.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_alerts.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_alerts.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_connectors.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_connectors.ts similarity index 97% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_connectors.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_connectors.ts index 59bd343eb2e5..993caefe13a8 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_connectors.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_case_metrics_connectors.ts @@ -8,7 +8,7 @@ import expect from '@kbn/expect'; import { ConnectorTypes } from '@kbn/cases-plugin/common/types/domain'; import { CaseMetricsFeature } from '@kbn/cases-plugin/common'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../../alerting_api_integration/common/lib'; import { getPostCaseRequest } from '../../../../../common/lib/mock'; import type { FtrProviderContext } from '../../../../../common/ftr_provider_context'; diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_cases_metrics.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_cases_metrics.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_cases_metrics.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/metrics/get_cases_metrics.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/replace_custom_field.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/replace_custom_field.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/replace_custom_field.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/replace_custom_field.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/search_cases.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/search_cases.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/search_cases.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/search_cases.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/user_actions_get_users.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/user_actions_get_users.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/user_actions_get_users.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/internal/user_actions_get_users.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/kibana_alerting_cases_index.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/kibana_alerting_cases_index.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/kibana_alerting_cases_index.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/kibana_alerting_cases_index.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/migrations.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/migrations.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/migrations.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/migrations.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/telemetry.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/telemetry.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/telemetry.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/telemetry.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/user_actions/find_user_actions.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/user_actions/find_user_actions.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/user_actions/find_user_actions.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/user_actions/find_user_actions.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/user_actions/get_user_action_stats.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/user_actions/get_user_action_stats.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/user_actions/get_user_action_stats.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/user_actions/get_user_action_stats.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/user_actions/migrations.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/user_actions/migrations.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/user_actions/migrations.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/common/user_actions/migrations.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/no_public_base_url/index.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/no_public_base_url/index.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/no_public_base_url/index.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/no_public_base_url/index.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/no_public_base_url/push.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/no_public_base_url/push.ts similarity index 94% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/no_public_base_url/push.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/no_public_base_url/push.ts index c1f10bdfbfdf..6bf9eac8d842 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/no_public_base_url/push.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/no_public_base_url/push.ts @@ -6,8 +6,8 @@ */ import expect from '@kbn/expect'; -import type { RecordingServiceNowSimulator } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib/actions_simulations_utils'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import type { RecordingServiceNowSimulator } from '../../../../alerting_api_integration/common/lib/actions_simulations_utils'; +import { ObjectRemover as ActionsRemover } from '../../../../alerting_api_integration/common/lib'; import { arraysToEqual } from '../../../common/lib/validation'; import { postCommentUserReq, diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/attachments_framework/registered_persistable_state_trial.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/attachments_framework/registered_persistable_state_trial.ts similarity index 95% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/attachments_framework/registered_persistable_state_trial.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/attachments_framework/registered_persistable_state_trial.ts index f44a47e51922..cdab3aceda60 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/attachments_framework/registered_persistable_state_trial.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/attachments_framework/registered_persistable_state_trial.ts @@ -15,7 +15,7 @@ export default ({ getService }: FtrProviderContext): void => { /** * Attachment types are being registered in - * x-pack/test/cases_api_integration/common/plugins/cases/server/plugin.ts + * x-pack/platform/test/cases_api_integration/common/plugins/cases/server/plugin.ts */ describe('Persistable state attachments', () => { // This test is intended to fail when new persistable state attachment types are registered. diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/cases/assignees.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/cases/assignees.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/cases/assignees.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/cases/assignees.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/cases/find_cases.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/cases/find_cases.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/cases/find_cases.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/cases/find_cases.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/cases/patch_case.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/cases/patch_case.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/cases/patch_case.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/cases/patch_case.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/cases/post_case.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/cases/post_case.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/cases/post_case.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/cases/post_case.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/cases/user_actions/find_user_actions.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/cases/user_actions/find_user_actions.ts similarity index 96% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/cases/user_actions/find_user_actions.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/cases/user_actions/find_user_actions.ts index 36f2af51badf..47dbe696c38b 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/cases/user_actions/find_user_actions.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/cases/user_actions/find_user_actions.ts @@ -8,7 +8,7 @@ import type http from 'http'; import expect from '@kbn/expect'; import { UserActionTypes } from '@kbn/cases-plugin/common/types/domain'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../../alerting_api_integration/common/lib'; import { getPostCaseRequest } from '../../../../../common/lib/mock'; import { deleteAllCaseItems, diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_configure.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_configure.ts similarity index 96% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_configure.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_configure.ts index 7f2f5681bce0..4ed9f2b3b40a 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_configure.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_configure.ts @@ -8,7 +8,7 @@ import type http from 'http'; import expect from '@kbn/expect'; import type { ConnectorTypes } from '@kbn/cases-plugin/common/types/domain'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import type { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_connectors.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_connectors.ts similarity index 97% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_connectors.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_connectors.ts index 8088cf0c23ec..78773959d545 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_connectors.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/configure/get_connectors.ts @@ -6,7 +6,7 @@ */ import expect from '@kbn/expect'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; import { @@ -107,7 +107,7 @@ export default ({ getService }: FtrProviderContext): void => { }, /** * Preconfigured connectors are being registered here: - * x-pack/test/cases_api_integration/common/config.ts + * x-pack/platform/test/cases_api_integration/common/config.ts */ { actionTypeId: '.servicenow', diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/index.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/configure/index.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/index.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/configure/index.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/patch_configure.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/configure/patch_configure.ts similarity index 97% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/patch_configure.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/configure/patch_configure.ts index 5fdd3e380791..1fa4d7d7acbf 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/patch_configure.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/configure/patch_configure.ts @@ -8,7 +8,7 @@ import type http from 'http'; import expect from '@kbn/expect'; import type { ConnectorTypes } from '@kbn/cases-plugin/common/types/domain'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; import { diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/post_configure.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/configure/post_configure.ts similarity index 96% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/post_configure.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/configure/post_configure.ts index f1c9fecd5507..4a232aa5139c 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/configure/post_configure.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/configure/post_configure.ts @@ -8,7 +8,7 @@ import type http from 'http'; import expect from '@kbn/expect'; import type { ConnectorTypes } from '@kbn/cases-plugin/common/types/domain'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; import { diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/connectors/cases/cases_connector.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/connectors/cases/cases_connector.ts similarity index 99% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/connectors/cases/cases_connector.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/connectors/cases/cases_connector.ts index cfbd4db2cc7f..8bc12c9023e9 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/connectors/cases/cases_connector.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/connectors/cases/cases_connector.ts @@ -50,7 +50,7 @@ import { } from '../../../../../common/lib/api'; import { getPostCaseRequest, postCommentAlertReq } from '../../../../../common/lib/mock'; import type { FtrProviderContext } from '../../../../../common/ftr_provider_context'; -import { roles as api_int_roles } from '../../../../../../api_integration/apis/cases/common/roles'; +import { roles as api_int_roles } from '../../../../../common/roles'; import { casesAllUser, obsCasesAllUser, @@ -61,7 +61,7 @@ import { secAllSpace1User, secAllUser, users as api_int_users, -} from '../../../../../../api_integration/apis/cases/common/users'; +} from '../../../../../common/users'; import { createUsersAndRoles, deleteUsersAndRoles } from '../../../../../common/lib/authentication'; // eslint-disable-next-line import/no-default-export diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/create_comment_sub_privilege.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/create_comment_sub_privilege.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/create_comment_sub_privilege.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/create_comment_sub_privilege.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/delete_sub_privilege.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/delete_sub_privilege.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/delete_sub_privilege.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/delete_sub_privilege.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/index.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/index.ts similarity index 98% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/index.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/index.ts index 93955f631eef..37602386152c 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/index.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/index.ts @@ -27,7 +27,6 @@ export default ({ loadTestFile, getService }: FtrProviderContext): void => { }); // Trial - loadTestFile(require.resolve('./cases/push_case')); loadTestFile(require.resolve('./cases/user_actions/find_user_actions')); loadTestFile(require.resolve('./cases/assignees')); loadTestFile(require.resolve('./cases/find_cases')); diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/bulk_delete_file_attachments.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/bulk_delete_file_attachments.ts similarity index 96% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/bulk_delete_file_attachments.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/bulk_delete_file_attachments.ts index 33164b5c5fa5..471466326f9f 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/bulk_delete_file_attachments.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/bulk_delete_file_attachments.ts @@ -24,8 +24,8 @@ import { obsCasesOnlyReadDeleteUser, secAllCasesOnlyReadDeleteUser, users as api_int_users, -} from '../../../../../api_integration/apis/cases/common/users'; -import { roles as api_int_roles } from '../../../../../api_integration/apis/cases/common/roles'; +} from '../../../../common/users'; +import { roles as api_int_roles } from '../../../../common/roles'; // eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/get_connectors.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/get_connectors.ts similarity index 99% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/get_connectors.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/get_connectors.ts index 0121c705ba59..a64ec64842d6 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/get_connectors.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/get_connectors.ts @@ -14,7 +14,7 @@ import { CaseSeverity, CaseStatuses, } from '@kbn/cases-plugin/common/types/domain'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import { globalRead, noKibanaPrivileges, diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/get_user_action_stats.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/get_user_action_stats.ts similarity index 97% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/get_user_action_stats.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/get_user_action_stats.ts index f8678ecef930..9144ff88ba25 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/get_user_action_stats.ts +++ b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/get_user_action_stats.ts @@ -9,7 +9,7 @@ import type http from 'http'; import expect from '@kbn/expect'; import { ConnectorTypes } from '@kbn/cases-plugin/common/types/domain'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; import { postCaseReq } from '../../../../common/lib/mock'; import { diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/observables.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/observables.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/observables.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/observables.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/similar_cases.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/similar_cases.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/similar_cases.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/similar_cases.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/suggest_user_profiles.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/suggest_user_profiles.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/suggest_user_profiles.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/suggest_user_profiles.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/user_actions_get_users.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/user_actions_get_users.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/internal/user_actions_get_users.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/internal/user_actions_get_users.ts diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/user_profiles/get_current.ts b/x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/user_profiles/get_current.ts similarity index 100% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/user_profiles/get_current.ts rename to x-pack/platform/test/cases_api_integration/security_and_spaces/tests/trial/user_profiles/get_current.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/config.ts b/x-pack/platform/test/cases_api_integration/spaces_only/config.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/config.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/config.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/alerts/get_cases.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/alerts/get_cases.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/alerts/get_cases.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/alerts/get_cases.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/cases/delete_cases.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/cases/delete_cases.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/cases/delete_cases.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/cases/delete_cases.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/cases/find_cases.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/cases/find_cases.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/cases/find_cases.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/cases/find_cases.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/cases/get_case.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/cases/get_case.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/cases/get_case.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/cases/get_case.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/cases/patch_cases.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/cases/patch_cases.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/cases/patch_cases.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/cases/patch_cases.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/cases/post_case.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/cases/post_case.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/cases/post_case.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/cases/post_case.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/cases/reporters/get_reporters.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/cases/reporters/get_reporters.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/cases/reporters/get_reporters.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/cases/reporters/get_reporters.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/cases/tags/get_tags.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/cases/tags/get_tags.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/cases/tags/get_tags.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/cases/tags/get_tags.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/comments/delete_comment.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/comments/delete_comment.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/comments/delete_comment.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/comments/delete_comment.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/comments/find_comments.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/comments/find_comments.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/comments/find_comments.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/comments/find_comments.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/comments/get_comment.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/comments/get_comment.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/comments/get_comment.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/comments/get_comment.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/comments/patch_comment.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/comments/patch_comment.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/comments/patch_comment.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/comments/patch_comment.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/comments/post_comment.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/comments/post_comment.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/comments/post_comment.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/comments/post_comment.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/configure/get_configure.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/configure/get_configure.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/configure/get_configure.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/configure/get_configure.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/configure/patch_configure.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/configure/patch_configure.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/configure/patch_configure.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/configure/patch_configure.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/configure/post_configure.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/configure/post_configure.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/configure/post_configure.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/configure/post_configure.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/files/post_file.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/files/post_file.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/files/post_file.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/files/post_file.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/index.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/index.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/index.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/index.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/internal/bulk_create_attachments.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/internal/bulk_create_attachments.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/internal/bulk_create_attachments.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/internal/bulk_create_attachments.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/internal/suggest_user_profiles.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/internal/suggest_user_profiles.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/internal/suggest_user_profiles.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/internal/suggest_user_profiles.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/common/metrics/get_cases_metrics.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/common/metrics/get_cases_metrics.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/common/metrics/get_cases_metrics.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/common/metrics/get_cases_metrics.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/trial/cases/push_case.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/cases/push_case.ts similarity index 95% rename from x-pack/test/cases_api_integration/spaces_only/tests/trial/cases/push_case.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/cases/push_case.ts index eefd47fffc4e..97856537d171 100644 --- a/x-pack/test/cases_api_integration/spaces_only/tests/trial/cases/push_case.ts +++ b/x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/cases/push_case.ts @@ -8,7 +8,7 @@ /* eslint-disable @typescript-eslint/naming-convention */ import type http from 'http'; import expect from '@kbn/expect'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; import { nullUser } from '../../../../common/lib/mock'; diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/get_configure.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/configure/get_configure.ts similarity index 97% rename from x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/get_configure.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/configure/get_configure.ts index 5a29beb37fe9..3e2d67d96cc1 100644 --- a/x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/get_configure.ts +++ b/x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/configure/get_configure.ts @@ -8,7 +8,7 @@ import type http from 'http'; import expect from '@kbn/expect'; import type { ConnectorTypes } from '@kbn/cases-plugin/common/types/domain'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; import { diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/get_connectors.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/configure/get_connectors.ts similarity index 97% rename from x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/get_connectors.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/configure/get_connectors.ts index 7f8b87202779..076b6a4e1437 100644 --- a/x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/get_connectors.ts +++ b/x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/configure/get_connectors.ts @@ -6,7 +6,7 @@ */ import expect from '@kbn/expect'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; import { @@ -139,7 +139,7 @@ export default ({ getService }: FtrProviderContext): void => { }, /** * Preconfigured connectors are being registered here: - * x-pack/test/cases_api_integration/common/config.ts + * x-pack/platform/test/cases_api_integration/common/config.ts */ { actionTypeId: '.servicenow', @@ -273,7 +273,7 @@ export default ({ getService }: FtrProviderContext): void => { expect(connectors).to.eql([ /** * Preconfigured connectors are being registered here: - * x-pack/test/cases_api_integration/common/config.ts + * x-pack/platform/test/cases_api_integration/common/config.ts */ { actionTypeId: '.servicenow', diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/index.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/configure/index.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/index.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/configure/index.ts diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/patch_configure.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/configure/patch_configure.ts similarity index 97% rename from x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/patch_configure.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/configure/patch_configure.ts index f4330626d878..2857997dca04 100644 --- a/x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/patch_configure.ts +++ b/x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/configure/patch_configure.ts @@ -8,7 +8,7 @@ import type http from 'http'; import expect from '@kbn/expect'; import type { ConnectorTypes } from '@kbn/cases-plugin/common/types/domain'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; import { diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/post_configure.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/configure/post_configure.ts similarity index 96% rename from x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/post_configure.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/configure/post_configure.ts index ca9a5205b893..517226822506 100644 --- a/x-pack/test/cases_api_integration/spaces_only/tests/trial/configure/post_configure.ts +++ b/x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/configure/post_configure.ts @@ -8,7 +8,7 @@ import type http from 'http'; import expect from '@kbn/expect'; import type { ConnectorTypes } from '@kbn/cases-plugin/common/types/domain'; -import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; +import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; import { diff --git a/x-pack/test/cases_api_integration/spaces_only/tests/trial/index.ts b/x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/index.ts similarity index 100% rename from x-pack/test/cases_api_integration/spaces_only/tests/trial/index.ts rename to x-pack/platform/test/cases_api_integration/spaces_only/tests/trial/index.ts diff --git a/x-pack/platform/test/tsconfig.json b/x-pack/platform/test/tsconfig.json index 2cb6d7405c47..88115823cffb 100644 --- a/x-pack/platform/test/tsconfig.json +++ b/x-pack/platform/test/tsconfig.json @@ -95,6 +95,12 @@ "@kbn/stack-alerts-plugin", "@kbn/triggers-actions-ui-plugin", "@kbn/alerts-as-data-utils", + "@kbn/cases-plugin", + "@kbn/files-plugin", + "@kbn/shared-ux-file-types", + "@kbn/user-profile-components", + "@kbn/safer-lodash-set", + "@kbn/cases-api-integration-test-plugin", "@kbn/dev-proc-runner", "@kbn/repo-info", "@kbn/dev-cli-errors", diff --git a/x-pack/solutions/security/test/cases_api_integration/common/lib/alerts.ts b/x-pack/solutions/security/test/cases_api_integration/common/lib/alerts.ts new file mode 100644 index 000000000000..8e50871f3e8a --- /dev/null +++ b/x-pack/solutions/security/test/cases_api_integration/common/lib/alerts.ts @@ -0,0 +1,51 @@ +/* + * 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 { estypes } from '@elastic/elasticsearch'; +import type { ToolingLog } from '@kbn/tooling-log'; +import type SuperTest from 'supertest'; +import { DETECTION_ENGINE_QUERY_SIGNALS_URL } from '@kbn/security-solution-plugin/common/constants'; +import type { DetectionAlert } from '@kbn/security-solution-plugin/common/api/detection_engine'; +import type { RiskEnrichmentFields } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/utils/enrichments/types'; +import { + getRuleForAlertTesting, + createRule, + waitForRuleSuccess, + waitForAlertsToBePresent, + getAlertsByIds, + getQueryAlertIds, +} from '@kbn/test-suites-xpack/common/utils/security_solution'; + +export const createSecuritySolutionAlerts = async ( + supertest: SuperTest.Agent, + log: ToolingLog, + numberOfSignals: number = 1 +): Promise> => { + const rule = { + ...getRuleForAlertTesting(['auditbeat-*']), + query: 'process.executable: "/usr/bin/sudo"', + }; + const { id } = await createRule(supertest, log, rule); + await waitForRuleSuccess({ supertest, log, id }); + await waitForAlertsToBePresent(supertest, log, numberOfSignals, [id]); + const signals = await getAlertsByIds(supertest, log, [id]); + + return signals; +}; + +export const getSecuritySolutionAlerts = async ( + supertest: SuperTest.Agent, + alertIds: string[] +): Promise> => { + const { body: updatedAlert } = await supertest + .post(DETECTION_ENGINE_QUERY_SIGNALS_URL) + .set('kbn-xsrf', 'true') + .send(getQueryAlertIds(alertIds)) + .expect(200); + + return updatedAlert; +}; diff --git a/x-pack/solutions/security/test/cases_api_integration/common/lib/api.ts b/x-pack/solutions/security/test/cases_api_integration/common/lib/api.ts new file mode 100644 index 000000000000..c5f947f791a0 --- /dev/null +++ b/x-pack/solutions/security/test/cases_api_integration/common/lib/api.ts @@ -0,0 +1,62 @@ +/* + * 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 { SignalHit } from '@kbn/security-solution-plugin/server/lib/detection_engine/rule_types/types'; +import type { estypes } from '@elastic/elasticsearch'; +import type { TransportResult } from '@elastic/elasticsearch'; +import type { Client } from '@elastic/elasticsearch'; + +function toArray(input: T | T[]): T[] { + if (Array.isArray(input)) { + return input; + } + return [input]; +} + +/** + * Query Elasticsearch for a set of signals within a set of indices + */ +// TODO: fix this to use new API/schema +export const getSignalsWithES = async ({ + es, + indices, + ids, +}: { + es: Client; + indices: string | string[]; + ids: string | string[]; +}): Promise>>> => { + const signals: TransportResult, unknown> = await es.search( + { + index: indices, + size: 10000, + query: { + bool: { + filter: [ + { + ids: { + values: toArray(ids), + }, + }, + ], + }, + }, + }, + { meta: true } + ); + + return signals.body.hits.hits.reduce((acc, hit) => { + let indexMap = acc.get(hit._index); + if (indexMap === undefined) { + indexMap = new Map>([[hit._id!, hit]]); + } else { + indexMap.set(hit._id!, hit); + } + acc.set(hit._index, indexMap); + return acc; + }, new Map>>()); +}; diff --git a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/config_trial.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/config_trial.ts new file mode 100644 index 000000000000..87573fba4d70 --- /dev/null +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/config_trial.ts @@ -0,0 +1,16 @@ +/* + * 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 { createTestConfig } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/config'; + +// eslint-disable-next-line import/no-default-export +export default createTestConfig('security_and_spaces', { + license: 'trial', + ssl: true, + testFiles: [require.resolve('./tests/trial')], + publicBaseUrl: true, +}); diff --git a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/config_trial_common.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/config_trial_common.ts new file mode 100644 index 000000000000..984304966d84 --- /dev/null +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/config_trial_common.ts @@ -0,0 +1,16 @@ +/* + * 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 { createTestConfig } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/config'; + +// eslint-disable-next-line import/no-default-export +export default createTestConfig('security_and_spaces', { + license: 'trial', + ssl: true, + testFiles: [require.resolve('./tests/common/index_common_trial')], + publicBaseUrl: true, +}); diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/delete_cases.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/cases/delete_cases.ts similarity index 95% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/delete_cases.ts rename to x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/cases/delete_cases.ts index ae2c037e8f9e..e001cde5195a 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/delete_cases.ts +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/cases/delete_cases.ts @@ -8,20 +8,18 @@ import expect from '@kbn/expect'; import type SuperTest from 'supertest'; import { MAX_COMMENTS_PER_PAGE } from '@kbn/cases-plugin/common/constants'; -import type { Alerts } from '../../../../common/lib/alerts'; +import type { Alerts } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/alerts'; + import { createCaseAttachAlertAndDeleteCase, - createSecuritySolutionAlerts, getAlertById, - getSecuritySolutionAlerts, -} from '../../../../common/lib/alerts'; -import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; - +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/alerts'; +import type { FtrProviderContext } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/ftr_provider_context'; import { getFilesAttachmentReq, getPostCaseRequest, postCommentUserReq, -} from '../../../../common/lib/mock'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/mock'; import { createCase, deleteCases, @@ -37,7 +35,7 @@ import { findAttachments, bulkCreateAttachments, getAllComments, -} from '../../../../common/lib/api'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; import { secOnly, secOnlyRead, @@ -51,25 +49,31 @@ import { obsSec, secSolutionOnlyReadNoIndexAlerts, secOnlyReadAlerts, -} from '../../../../common/lib/authentication/users'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/users'; import { secAllUser, users as api_int_users, -} from '../../../../../api_integration/apis/cases/common/users'; -import { roles as api_int_roles } from '../../../../../api_integration/apis/cases/common/roles'; -import { createUsersAndRoles, deleteUsersAndRoles } from '../../../../common/lib/authentication'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/users'; +import { roles as api_int_roles } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/roles'; +import { + createUsersAndRoles, + deleteUsersAndRoles, +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication'; import { OBSERVABILITY_FILE_KIND, SECURITY_SOLUTION_FILE_KIND, -} from '../../../../common/lib/constants'; -import type { User } from '../../../../common/lib/authentication/types'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/constants'; +import type { User } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/types'; import { createAlertsIndex, deleteAllRules, deleteAllAlerts, -} from '../../../../../common/utils/security_solution'; +} from '@kbn/test-suites-xpack/common/utils/security_solution'; +import { + createSecuritySolutionAlerts, + getSecuritySolutionAlerts, +} from '../../../../common/lib/alerts'; -// eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertestWithoutAuth = getService('supertestWithoutAuth'); const supertest = getService('supertest'); diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts similarity index 99% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts rename to x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts index 9583e3045ce4..446e4200eeb7 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/cases/patch_cases.ts @@ -17,17 +17,16 @@ import { ConnectorTypes, CustomFieldTypes, } from '@kbn/cases-plugin/common/types/domain'; -import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; +import type { FtrProviderContext } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/ftr_provider_context'; import { defaultUser, getPostCaseRequest, postCaseReq, postCaseResp, postCommentUserReq, -} from '../../../../common/lib/mock'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/mock'; import { deleteAllCaseItems, - getSignalsWithES, setStatus, createCase, createComment, @@ -41,7 +40,7 @@ import { removeServerGeneratedPropertiesFromUserAction, createConfiguration, getConfigurationRequest, -} from '../../../../common/lib/api'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; import { createAlertsIndex, deleteAllAlerts, @@ -52,7 +51,7 @@ import { getAlertsByIds, createRule, getQueryAlertIds, -} from '../../../../../common/utils/security_solution'; +} from '@kbn/test-suites-xpack/common/utils/security_solution'; import { globalRead, noKibanaPrivileges, @@ -62,9 +61,9 @@ import { secOnly, secOnlyRead, superUser, -} from '../../../../common/lib/authentication/users'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/users'; +import { getSignalsWithES } from '../../../../common/lib/api'; -// eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); const esArchiver = getService('esArchiver'); diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/client/update_alert_status.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/client/update_alert_status.ts similarity index 93% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/client/update_alert_status.ts rename to x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/client/update_alert_status.ts index c8e748d928dc..67b7e78ebb89 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/client/update_alert_status.ts +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/client/update_alert_status.ts @@ -8,17 +8,16 @@ import expect from '@kbn/expect'; import type { Cases } from '@kbn/cases-plugin/common/types/domain'; import { CaseStatuses, AttachmentType } from '@kbn/cases-plugin/common/types/domain'; -import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; +import type { FtrProviderContext } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/ftr_provider_context'; -import { postCaseReq } from '../../../../common/lib/mock'; +import { postCaseReq } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/mock'; import { createCase, createComment, deleteAllCaseItems, - getSignalsWithES, -} from '../../../../common/lib/api'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; +import { getSignalsWithES } from '../../../../common/lib/api'; -// eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); const es = getService('es'); diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comment.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comment.ts similarity index 95% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comment.ts rename to x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comment.ts index df720d4b1c80..5ffe0e5125be 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comment.ts +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comment.ts @@ -6,26 +6,24 @@ */ import expect from '@kbn/expect'; -import type { Alerts } from '../../../../common/lib/alerts'; +import type { Alerts } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/alerts'; import { createCaseAttachAlertAndDeleteAlert, - createSecuritySolutionAlerts, getAlertById, - getSecuritySolutionAlerts, -} from '../../../../common/lib/alerts'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/alerts'; import { createAlertsIndex, deleteAllAlerts, deleteAllRules, -} from '../../../../../common/utils/security_solution'; -import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; +} from '@kbn/test-suites-xpack/common/utils/security_solution'; +import type { FtrProviderContext } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/ftr_provider_context'; import { getPostCaseRequest, postCaseReq, postCommentAlertReq, postCommentUserReq, -} from '../../../../common/lib/mock'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/mock'; import { deleteAllCaseItems, deleteCasesByESQuery, @@ -38,7 +36,7 @@ import { getCaseSavedObjectsFromES, bulkCreateAttachments, resolveCase, -} from '../../../../common/lib/api'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; import { globalRead, noKibanaPrivileges, @@ -52,9 +50,12 @@ import { secOnlyReadAlerts, secSolutionOnlyReadNoIndexAlerts, superUser, -} from '../../../../common/lib/authentication/users'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/users'; +import { + createSecuritySolutionAlerts, + getSecuritySolutionAlerts, +} from '../../../../common/lib/alerts'; -// eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); const es = getService('es'); diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comments.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comments.ts similarity index 96% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comments.ts rename to x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comments.ts index 154fa72f7849..b0ad92b50c7d 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comments.ts +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/delete_comments.ts @@ -6,19 +6,17 @@ */ import expect from '@kbn/expect'; -import type { Alerts } from '../../../../common/lib/alerts'; +import type { Alerts } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/alerts'; import { createCaseAttachAlertAndDeleteAlert, - createSecuritySolutionAlerts, getAlertById, - getSecuritySolutionAlerts, -} from '../../../../common/lib/alerts'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/alerts'; import { createAlertsIndex, deleteAllAlerts, deleteAllRules, -} from '../../../../../common/utils/security_solution'; -import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; +} from '@kbn/test-suites-xpack/common/utils/security_solution'; +import type { FtrProviderContext } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/ftr_provider_context'; import { getPostCaseRequest, @@ -30,7 +28,7 @@ import { postCommentUserReq, postExternalReferenceESReq, postExternalReferenceSOReq, -} from '../../../../common/lib/mock'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/mock'; import { deleteAllCaseItems, deleteCasesByESQuery, @@ -43,7 +41,7 @@ import { bulkCreateAttachments, getAllComments, getCaseSavedObjectsFromES, -} from '../../../../common/lib/api'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; import { globalRead, noKibanaPrivileges, @@ -57,9 +55,12 @@ import { secOnlyReadAlerts, secSolutionOnlyReadNoIndexAlerts, superUser, -} from '../../../../common/lib/authentication/users'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/users'; +import { + createSecuritySolutionAlerts, + getSecuritySolutionAlerts, +} from '../../../../common/lib/alerts'; -// eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); const es = getService('es'); diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/post_comment.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/post_comment.ts similarity index 98% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/post_comment.ts rename to x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/post_comment.ts index a993f5306b9e..2754ba6624c3 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/comments/post_comment.ts +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/comments/post_comment.ts @@ -20,7 +20,7 @@ import { CaseStatuses, ExternalReferenceStorageType, } from '@kbn/cases-plugin/common/types/domain'; -import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; +import type { FtrProviderContext } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/ftr_provider_context'; import { defaultUser, postCaseReq, @@ -32,7 +32,7 @@ import { fileMetadata, postCommentAlertMultipleIdsReq, postCommentActionsReq, -} from '../../../../common/lib/mock'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/mock'; import { deleteAllCaseItems, deleteCasesByESQuery, @@ -48,12 +48,12 @@ import { getAllComments, bulkCreateAttachments, getCaseSavedObjectsFromES, -} from '../../../../common/lib/api'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; import { createAlertsIndex, deleteAllAlerts, deleteAllRules, -} from '../../../../../common/utils/security_solution'; +} from '@kbn/test-suites-xpack/common/utils/security_solution'; import { globalRead, noKibanaPrivileges, @@ -67,15 +67,14 @@ import { obsSec, secOnlyReadAlerts, secSolutionOnlyReadNoIndexAlerts, -} from '../../../../common/lib/authentication/users'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/users'; +import { getAlertById } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/alerts'; +import type { User } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/types'; import { getSecuritySolutionAlerts, createSecuritySolutionAlerts, - getAlertById, } from '../../../../common/lib/alerts'; -import type { User } from '../../../../common/lib/authentication/types'; -// eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); const supertestWithoutAuth = getService('supertestWithoutAuth'); diff --git a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/index.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/index.ts new file mode 100644 index 000000000000..e3a237077152 --- /dev/null +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/index.ts @@ -0,0 +1,27 @@ +/* + * 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 '@kbn/test-suites-xpack-platform/cases_api_integration/common/ftr_provider_context'; + +export default ({ loadTestFile }: FtrProviderContext): void => { + describe('Common', function () { + /** + * Public routes + */ + loadTestFile(require.resolve('./client/update_alert_status')); + loadTestFile(require.resolve('./comments/delete_comment')); + loadTestFile(require.resolve('./comments/delete_comments')); + loadTestFile(require.resolve('./comments/post_comment')); + loadTestFile(require.resolve('./cases/delete_cases')); + loadTestFile(require.resolve('./cases/patch_cases')); + + /** + * Internal routes + */ + loadTestFile(require.resolve('./internal/bulk_create_attachments')); + }); +}; diff --git a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/index_common_trial/index.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/index_common_trial/index.ts new file mode 100644 index 000000000000..405a6cfb4c4d --- /dev/null +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/index_common_trial/index.ts @@ -0,0 +1,30 @@ +/* + * 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 '@kbn/test-suites-xpack-platform/cases_api_integration/common/ftr_provider_context'; +import { + createSpacesAndUsers, + deleteSpacesAndUsers, + activateUserProfiles, +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication'; + +export default ({ loadTestFile, getService }: FtrProviderContext): void => { + describe('cases security and spaces enabled: trial', function () { + before(async () => { + await createSpacesAndUsers(getService); + // once a user profile is created the only way to remove it is to delete the user and roles, so best to activate + // before all the tests + await activateUserProfiles(getService); + }); + + after(async () => { + await deleteSpacesAndUsers(getService); + }); + + loadTestFile(require.resolve('..')); + }); +}; diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_create_attachments.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_create_attachments.ts similarity index 98% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_create_attachments.ts rename to x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_create_attachments.ts index 6cdb28655c9e..261fdbfb5103 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_create_attachments.ts +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/common/internal/bulk_create_attachments.ts @@ -14,7 +14,7 @@ import { AttachmentType } from '@kbn/cases-plugin/common'; import type { BulkCreateAttachmentsRequest } from '@kbn/cases-plugin/common/types/api'; import type { ExternalReferenceSOAttachmentPayload } from '@kbn/cases-plugin/common/types/domain'; import { CaseStatuses, ExternalReferenceStorageType } from '@kbn/cases-plugin/common/types/domain'; -import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; +import type { FtrProviderContext } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/ftr_provider_context'; import { defaultUser, postCaseReq, @@ -27,7 +27,7 @@ import { fileMetadata, postCommentAlertMultipleIdsReq, postCommentActionsReq, -} from '../../../../common/lib/mock'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/mock'; import { deleteAllCaseItems, createCase, @@ -43,12 +43,12 @@ import { getAllComments, createComment, getCaseSavedObjectsFromES, -} from '../../../../common/lib/api'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; import { createAlertsIndex, deleteAllAlerts, deleteAllRules, -} from '../../../../../common/utils/security_solution'; +} from '@kbn/test-suites-xpack/common/utils/security_solution'; import { globalRead, noKibanaPrivileges, @@ -62,17 +62,16 @@ import { secOnlyReadAlerts, secSolutionOnlyReadNoIndexAlerts, superUser, -} from '../../../../common/lib/authentication/users'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/users'; +import { getAlertById } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/alerts'; +import type { User } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/types'; +import { SECURITY_SOLUTION_FILE_KIND } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/constants'; +import { arraysToEqual } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/validation'; import { getSecuritySolutionAlerts, createSecuritySolutionAlerts, - getAlertById, } from '../../../../common/lib/alerts'; -import type { User } from '../../../../common/lib/authentication/types'; -import { SECURITY_SOLUTION_FILE_KIND } from '../../../../common/lib/constants'; -import { arraysToEqual } from '../../../../common/lib/validation'; -// eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); const supertestWithoutAuth = getService('supertestWithoutAuth'); diff --git a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/cases/push_case.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/trial/cases/push_case.ts similarity index 98% rename from x-pack/test/cases_api_integration/security_and_spaces/tests/trial/cases/push_case.ts rename to x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/trial/cases/push_case.ts index cefb3a109275..f6758b651ead 100644 --- a/x-pack/test/cases_api_integration/security_and_spaces/tests/trial/cases/push_case.ts +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/trial/cases/push_case.ts @@ -18,7 +18,7 @@ import type { } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib/actions_simulations_utils'; import type { CaseConnector } from '@kbn/cases-plugin/common/types/domain'; import { ObjectRemover as ActionsRemover } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; -import type { FtrProviderContext } from '../../../../common/ftr_provider_context'; +import type { FtrProviderContext } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/ftr_provider_context'; import { postCaseReq, @@ -31,7 +31,7 @@ import { postCommentAlertMultipleIdsReq, persistableStateAttachment, postExternalReferenceESReq, -} from '../../../../common/lib/mock'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/mock'; import { getConfigurationRequest, createCase, @@ -43,7 +43,6 @@ import { getConnectorMappingsFromES, getCase, createConfiguration, - getSignalsWithES, delay, calculateDuration, getComment, @@ -55,7 +54,7 @@ import { getRecordingServiceNowSimulatorServer, getServiceNowSimulationServer, createConnector, -} from '../../../../common/lib/api'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; import { globalRead, noCasesConnectors, @@ -65,10 +64,10 @@ import { secOnly, secOnlyRead, superUser, -} from '../../../../common/lib/authentication/users'; -import { arraysToEqual } from '../../../../common/lib/validation'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/users'; +import { arraysToEqual } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/validation'; +import { getSignalsWithES } from '../../../../common/lib/api'; -// eslint-disable-next-line import/no-default-export export default ({ getService }: FtrProviderContext): void => { const supertest = getService('supertest'); const supertestWithoutAuth = getService('supertestWithoutAuth'); diff --git a/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/trial/index.ts b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/trial/index.ts new file mode 100644 index 000000000000..1a43aa1bf7b9 --- /dev/null +++ b/x-pack/solutions/security/test/cases_api_integration/security_and_spaces/tests/trial/index.ts @@ -0,0 +1,31 @@ +/* + * 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 '@kbn/test-suites-xpack-platform/cases_api_integration/common/ftr_provider_context'; +import { + createSpacesAndUsers, + deleteSpacesAndUsers, + activateUserProfiles, +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication'; + +export default ({ loadTestFile, getService }: FtrProviderContext): void => { + describe('cases security and spaces enabled: trial', function () { + before(async () => { + await createSpacesAndUsers(getService); + // once a user profile is created the only way to remove it is to delete the user and roles, so best to activate + // before all the tests + await activateUserProfiles(getService); + }); + + after(async () => { + await deleteSpacesAndUsers(getService); + }); + + // Trial + loadTestFile(require.resolve('./cases/push_case')); + }); +}; diff --git a/x-pack/solutions/security/test/tsconfig.json b/x-pack/solutions/security/test/tsconfig.json index 60761c929011..7c9c45ae8625 100644 --- a/x-pack/solutions/security/test/tsconfig.json +++ b/x-pack/solutions/security/test/tsconfig.json @@ -43,6 +43,7 @@ "@kbn/stack-connectors-plugin", "@kbn/security-plugin", "@kbn/security-plugin-types-common", + "@kbn/cases-plugin", "@kbn/es", "@kbn/cypress-test-helper", "@kbn/fleet-plugin", diff --git a/x-pack/test/api_integration/apis/cases/bulk_get_user_profiles.ts b/x-pack/test/api_integration/apis/cases/bulk_get_user_profiles.ts index 87790946552b..5a250f039cd5 100644 --- a/x-pack/test/api_integration/apis/cases/bulk_get_user_profiles.ts +++ b/x-pack/test/api_integration/apis/cases/bulk_get_user_profiles.ts @@ -9,13 +9,13 @@ import expect from '@kbn/expect'; import { APP_ID as CASES_APP_ID } from '@kbn/cases-plugin/common/constants'; import { APP_ID as SECURITY_SOLUTION_APP_ID } from '@kbn/security-solution-plugin/common/constants'; import { observabilityFeatureId as OBSERVABILITY_APP_ID } from '@kbn/observability-plugin/common'; -import type { FtrProviderContext } from '../../ftr_provider_context'; -import { deleteAllCaseItems } from '../../../cases_api_integration/common/lib/api'; +import { deleteAllCaseItems } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; import { bulkGetUserProfiles, suggestUserProfiles, -} from '../../../cases_api_integration/common/lib/api/user_profiles'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api/user_profiles'; +import type { FtrProviderContext } from '../../ftr_provider_context'; import { casesAllUser, casesReadUser, diff --git a/x-pack/test/api_integration/apis/cases/common/roles.ts b/x-pack/test/api_integration/apis/cases/common/roles.ts index b117c07c42fb..51e40c76123d 100644 --- a/x-pack/test/api_integration/apis/cases/common/roles.ts +++ b/x-pack/test/api_integration/apis/cases/common/roles.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { Role } from '../../../../cases_api_integration/common/lib/authentication/types'; +import type { Role } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/types'; /** * Roles for Cases in Security Solution diff --git a/x-pack/test/api_integration/apis/cases/common/users.ts b/x-pack/test/api_integration/apis/cases/common/users.ts index c00f1aae2cdb..27ed43515576 100644 --- a/x-pack/test/api_integration/apis/cases/common/users.ts +++ b/x-pack/test/api_integration/apis/cases/common/users.ts @@ -5,7 +5,7 @@ * 2.0. */ -import type { User } from '../../../../cases_api_integration/common/lib/authentication/types'; +import type { User } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/types'; import { casesAll, casesV2All, diff --git a/x-pack/test/api_integration/apis/cases/files.ts b/x-pack/test/api_integration/apis/cases/files.ts index c46dd4874619..9baf90402492 100644 --- a/x-pack/test/api_integration/apis/cases/files.ts +++ b/x-pack/test/api_integration/apis/cases/files.ts @@ -8,7 +8,7 @@ import expect from '@kbn/expect'; import type { BaseFilesClient } from '@kbn/shared-ux-file-types'; -import type { User } from '../../../cases_api_integration/common/lib/authentication/types'; +import type { User } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/types'; import { createFile, uploadFile, @@ -18,7 +18,12 @@ import { getFileById, deleteAllFilesForKind, deleteFileForFileKind, -} from '../../../cases_api_integration/common/lib/api'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; +import { + CASES_FILE_KIND, + OBSERVABILITY_FILE_KIND, + SECURITY_SOLUTION_FILE_KIND, +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/constants'; import type { FtrProviderContext } from '../../ftr_provider_context'; import { casesAllUser, @@ -28,11 +33,6 @@ import { secAllUser, secReadCasesReadUser, } from './common/users'; -import { - CASES_FILE_KIND, - OBSERVABILITY_FILE_KIND, - SECURITY_SOLUTION_FILE_KIND, -} from '../../../cases_api_integration/common/lib/constants'; interface TestScenario { user: User; diff --git a/x-pack/test/api_integration/apis/cases/index.ts b/x-pack/test/api_integration/apis/cases/index.ts index a12a5100a2f1..33b4933dbf67 100644 --- a/x-pack/test/api_integration/apis/cases/index.ts +++ b/x-pack/test/api_integration/apis/cases/index.ts @@ -8,9 +8,9 @@ import { createUsersAndRoles, deleteUsersAndRoles, -} from '../../../cases_api_integration/common/lib/authentication'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication'; -import { loginUsers } from '../../../cases_api_integration/common/lib/api/user_profiles'; +import { loginUsers } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api/user_profiles'; import { casesAllUser, obsCasesAllUser, secAllUser, users } from './common/users'; import { roles } from './common/roles'; import type { FtrProviderContext } from '../../ftr_provider_context'; diff --git a/x-pack/test/api_integration/apis/cases/privileges.ts b/x-pack/test/api_integration/apis/cases/privileges.ts index 271cc934d253..4662bf7443a2 100644 --- a/x-pack/test/api_integration/apis/cases/privileges.ts +++ b/x-pack/test/api_integration/apis/cases/privileges.ts @@ -14,7 +14,6 @@ import type { } from '@kbn/cases-plugin/common/types/domain'; import { APP_ID as SECURITY_SOLUTION_APP_ID } from '@kbn/security-solution-plugin/common/constants'; import { observabilityFeatureId as OBSERVABILITY_APP_ID } from '@kbn/observability-plugin/common'; -import type { FtrProviderContext } from '../../ftr_provider_context'; import { createCase, @@ -24,7 +23,9 @@ import { createComment, updateCaseStatus, updateCaseAssignee, -} from '../../../cases_api_integration/common/lib/api'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; +import { getPostCaseRequest } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/mock'; +import { suggestUserProfiles } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api/user_profiles'; import { casesAllUser, casesV2AllUser, @@ -56,8 +57,7 @@ import { secCasesV2NoReopenWithCreateCommentUser, secCasesV2NoCreateCommentWithReopenUser, } from './common/users'; -import { getPostCaseRequest } from '../../../cases_api_integration/common/lib/mock'; -import { suggestUserProfiles } from '../../../cases_api_integration/common/lib/api/user_profiles'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export default ({ getService }: FtrProviderContext): void => { describe('feature privilege', () => { diff --git a/x-pack/test/api_integration/apis/cases/suggest_user_profiles.ts b/x-pack/test/api_integration/apis/cases/suggest_user_profiles.ts index bcf86940b6aa..37507623aa98 100644 --- a/x-pack/test/api_integration/apis/cases/suggest_user_profiles.ts +++ b/x-pack/test/api_integration/apis/cases/suggest_user_profiles.ts @@ -9,10 +9,10 @@ import expect from '@kbn/expect'; import { APP_ID as CASES_APP_ID, MAX_SUGGESTED_PROFILES } from '@kbn/cases-plugin/common/constants'; import { APP_ID as SECURITY_SOLUTION_APP_ID } from '@kbn/security-solution-plugin/common/constants'; import { observabilityFeatureId as OBSERVABILITY_APP_ID } from '@kbn/observability-plugin/common'; -import type { FtrProviderContext } from '../../ftr_provider_context'; -import { deleteAllCaseItems } from '../../../cases_api_integration/common/lib/api'; -import { suggestUserProfiles } from '../../../cases_api_integration/common/lib/api/user_profiles'; +import { deleteAllCaseItems } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; +import { suggestUserProfiles } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api/user_profiles'; +import type { FtrProviderContext } from '../../ftr_provider_context'; import { casesAllUser, casesOnlyDeleteUser, diff --git a/x-pack/test/api_integration_basic/apis/security_solution/cases_privileges.ts b/x-pack/test/api_integration_basic/apis/security_solution/cases_privileges.ts index a1c2eb5f7c03..de4bf9981f53 100644 --- a/x-pack/test/api_integration_basic/apis/security_solution/cases_privileges.ts +++ b/x-pack/test/api_integration_basic/apis/security_solution/cases_privileges.ts @@ -8,19 +8,22 @@ import expect from '@kbn/expect'; import { APP_ID } from '@kbn/security-solution-plugin/common/constants'; -import { FtrProviderContext } from '../../ftr_provider_context'; import { createUsersAndRoles, deleteUsersAndRoles, -} from '../../../cases_api_integration/common/lib/authentication'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication'; -import { Role, User } from '../../../cases_api_integration/common/lib/authentication/types'; +import { + Role, + User, +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/types'; import { createCase, deleteAllCaseItems, getCase, -} from '../../../cases_api_integration/common/lib/api'; -import { getPostCaseRequest } from '../../../cases_api_integration/common/lib/mock'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; +import { getPostCaseRequest } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/mock'; +import { FtrProviderContext } from '../../ftr_provider_context'; const secAll: Role = { name: 'sec_all_role', diff --git a/x-pack/test/functional/services/cases/api.ts b/x-pack/test/functional/services/cases/api.ts index 7a1d4f52108d..31a22a277a46 100644 --- a/x-pack/test/functional/services/cases/api.ts +++ b/x-pack/test/functional/services/cases/api.ts @@ -21,12 +21,12 @@ import { getCase, createConfiguration, getConfigurationRequest, -} from '../../../cases_api_integration/common/lib/api'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; import { loginUsers, suggestUserProfiles, -} from '../../../cases_api_integration/common/lib/api/user_profiles'; -import { User } from '../../../cases_api_integration/common/lib/authentication/types'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api/user_profiles'; +import { User } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/types'; import { FtrProviderContext } from '../../ftr_provider_context'; import { generateRandomCaseWithoutConnector } from './helpers'; diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/common/roles.ts b/x-pack/test/functional_with_es_ssl/apps/cases/common/roles.ts index 8ea678f386de..f3085399ddba 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/common/roles.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/common/roles.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { Role } from '../../../../cases_api_integration/common/lib/authentication/types'; +import { Role } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/types'; /** * Roles for Cases in the stack diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/common/users.ts b/x-pack/test/functional_with_es_ssl/apps/cases/common/users.ts index 8964f414662f..6a3fd4239ca7 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/common/users.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/common/users.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { User } from '../../../../cases_api_integration/common/lib/authentication/types'; +import { User } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/types'; import { casesAll, casesNoDelete, casesReadDelete, casesReadAndEditSettings } from './roles'; /** diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/group1/create_case_form.ts b/x-pack/test/functional_with_es_ssl/apps/cases/group1/create_case_form.ts index c9a16b6e4598..dcd7b5c75403 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/group1/create_case_form.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/group1/create_case_form.ts @@ -8,11 +8,11 @@ import expect from '@kbn/expect'; import { v4 as uuidv4 } from 'uuid'; import { CaseSeverity, CustomFieldTypes } from '@kbn/cases-plugin/common/types/domain'; -import { FtrProviderContext } from '../../../ftr_provider_context'; import { createUsersAndRoles, deleteUsersAndRoles, -} from '../../../../cases_api_integration/common/lib/authentication'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication'; +import { FtrProviderContext } from '../../../ftr_provider_context'; import { users, roles, casesAllUser, casesAllUser2 } from '../common'; export default ({ getService, getPageObject }: FtrProviderContext) => { diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/group1/sub_privileges.ts b/x-pack/test/functional_with_es_ssl/apps/cases/group1/sub_privileges.ts index aecdb1623ff3..b8ca9583fc44 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/group1/sub_privileges.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/group1/sub_privileges.ts @@ -6,6 +6,10 @@ */ import expect from '@kbn/expect'; +import { + createUsersAndRoles, + deleteUsersAndRoles, +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { users, @@ -15,10 +19,6 @@ import { casesNoDeleteUser, casesReadAndEditSettingsUser, } from '../common'; -import { - createUsersAndRoles, - deleteUsersAndRoles, -} from '../../../../cases_api_integration/common/lib/authentication'; export default ({ getPageObjects, getService }: FtrProviderContext) => { const PageObjects = getPageObjects(['security', 'header']); diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/group1/view_case.ts b/x-pack/test/functional_with_es_ssl/apps/cases/group1/view_case.ts index 72582b9dac2c..5cc56ee5eee3 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/group1/view_case.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/group1/view_case.ts @@ -15,11 +15,11 @@ import { } from '@kbn/cases-plugin/common/types/domain'; import { setTimeout as setTimeoutAsync } from 'timers/promises'; -import { FtrProviderContext } from '../../../ftr_provider_context'; import { createUsersAndRoles, deleteUsersAndRoles, -} from '../../../../cases_api_integration/common/lib/authentication'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication'; +import { FtrProviderContext } from '../../../ftr_provider_context'; import { users, roles, casesAllUser, casesAllUser2 } from '../common'; export default ({ getPageObject, getService }: FtrProviderContext) => { diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/group2/attachment_framework.ts b/x-pack/test/functional_with_es_ssl/apps/cases/group2/attachment_framework.ts index bd9aabdce985..3bd9d28e8560 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/group2/attachment_framework.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/group2/attachment_framework.ts @@ -21,7 +21,7 @@ import { findAttachments, findCaseUserActions, findCases, -} from '../../../../cases_api_integration/common/lib/api'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; import { FtrProviderContext } from '../../../ftr_provider_context'; const ADD_TO_EXISTING_CASE_DATA_TEST_SUBJ = 'embeddablePanelAction-embeddable_addToExistingCase'; diff --git a/x-pack/test/functional_with_es_ssl/apps/cases/group2/list_view.ts b/x-pack/test/functional_with_es_ssl/apps/cases/group2/list_view.ts index aa6d4eeae684..0eb5606c319d 100644 --- a/x-pack/test/functional_with_es_ssl/apps/cases/group2/list_view.ts +++ b/x-pack/test/functional_with_es_ssl/apps/cases/group2/list_view.ts @@ -13,11 +13,11 @@ import { CustomFieldTypes, } from '@kbn/cases-plugin/common/types/domain'; import { UserProfile } from '@kbn/user-profile-components'; -import { FtrProviderContext } from '../../../ftr_provider_context'; import { createUsersAndRoles, deleteUsersAndRoles, -} from '../../../../cases_api_integration/common/lib/authentication'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication'; +import { FtrProviderContext } from '../../../ftr_provider_context'; import { users, roles, casesAllUser, casesAllUser2 } from '../common'; export default ({ getPageObject, getService }: FtrProviderContext) => { diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/logs_list.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/logs_list.ts index 8cc64e39221d..ff6e1b424995 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/logs_list.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/logs_list.ts @@ -6,12 +6,15 @@ */ import expect from '@kbn/expect'; -import { FtrProviderContext } from '../../ftr_provider_context'; -import { Role, User } from '../../../cases_api_integration/common/lib/authentication/types'; +import { + Role, + User, +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/types'; import { createUsersAndRoles, deleteUsersAndRoles, -} from '../../../cases_api_integration/common/lib/authentication'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication'; +import { FtrProviderContext } from '../../ftr_provider_context'; const SPACE2 = { id: 'space-2', diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/shared/global_rule_event_log_list.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/shared/global_rule_event_log_list.ts index 80832169f697..58b89ba876c6 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/shared/global_rule_event_log_list.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/shared/global_rule_event_log_list.ts @@ -8,12 +8,15 @@ import expect from '@kbn/expect'; import { asyncForEach } from '@kbn/std'; import { getUrlPrefix } from '@kbn/test-suites-xpack-platform/alerting_api_integration/common/lib'; -import { FtrProviderContext } from '../../../ftr_provider_context'; -import { Role, User } from '../../../../cases_api_integration/common/lib/authentication/types'; +import { + Role, + User, +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication/types'; import { createUsersAndRoles, deleteUsersAndRoles, -} from '../../../../cases_api_integration/common/lib/authentication'; +} from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/authentication'; +import { FtrProviderContext } from '../../../ftr_provider_context'; import { getTestAlertData } from '../../../lib/get_test_data'; const SPACE2 = { diff --git a/x-pack/test/screenshot_creation/apps/response_ops_docs/observability_cases/list_view.ts b/x-pack/test/screenshot_creation/apps/response_ops_docs/observability_cases/list_view.ts index 309c17f6ee49..afb6a5f67c79 100644 --- a/x-pack/test/screenshot_creation/apps/response_ops_docs/observability_cases/list_view.ts +++ b/x-pack/test/screenshot_creation/apps/response_ops_docs/observability_cases/list_view.ts @@ -6,9 +6,9 @@ */ import { AttachmentType } from '@kbn/cases-plugin/common/types/domain'; +import { createAndUploadFile } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; +import { OBSERVABILITY_FILE_KIND } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; -import { createAndUploadFile } from '../../../../cases_api_integration/common/lib/api'; -import { OBSERVABILITY_FILE_KIND } from '../../../../cases_api_integration/common/lib/constants'; export default function ({ getPageObject, getService }: FtrProviderContext) { const common = getPageObject('common'); diff --git a/x-pack/test/screenshot_creation/apps/response_ops_docs/security_cases/list_view.ts b/x-pack/test/screenshot_creation/apps/response_ops_docs/security_cases/list_view.ts index 5d599a43082f..6bdb0d2ac702 100644 --- a/x-pack/test/screenshot_creation/apps/response_ops_docs/security_cases/list_view.ts +++ b/x-pack/test/screenshot_creation/apps/response_ops_docs/security_cases/list_view.ts @@ -6,9 +6,9 @@ */ import { CaseSeverity } from '@kbn/cases-plugin/common/types/domain'; +import { createAndUploadFile } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; +import { SECURITY_SOLUTION_FILE_KIND } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; -import { createAndUploadFile } from '../../../../cases_api_integration/common/lib/api'; -import { SECURITY_SOLUTION_FILE_KIND } from '../../../../cases_api_integration/common/lib/constants'; export default function ({ getPageObject, getService, getPageObjects }: FtrProviderContext) { const cases = getService('cases'); diff --git a/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_cases/index.ts b/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_cases/index.ts index e9ebb8e9b2bc..de37610e0eca 100644 --- a/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_cases/index.ts +++ b/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_cases/index.ts @@ -6,8 +6,8 @@ */ import { AttachmentType } from '@kbn/cases-plugin/common/types/domain'; -import { createAndUploadFile } from '../../../../cases_api_integration/common/lib/api'; -import { CASES_FILE_KIND } from '../../../../cases_api_integration/common/lib/constants'; +import { createAndUploadFile } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; +import { CASES_FILE_KIND } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; export const caseTitle = 'Web transactions'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/add_actions.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/add_actions.ts index 8d27207519ce..aeda2fc44c94 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/add_actions.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/actions/trial_license_complete_tier/add_actions.ts @@ -9,7 +9,8 @@ import expect from 'expect'; import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common'; import { DETECTION_ENGINE_RULES_URL } from '@kbn/security-solution-plugin/common/constants'; import { QueryRuleCreateProps } from '@kbn/security-solution-plugin/common/api/detection_engine'; -import { getCases, waitForCases } from '../../../../../../cases_api_integration/common/lib/api'; +import { getCases } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api'; +import { waitForCases } from '../../../utils/cases'; import { deleteAllRules, waitForRuleSuccess, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/cases.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/cases.ts new file mode 100644 index 000000000000..3f21fe91161d --- /dev/null +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/cases.ts @@ -0,0 +1,23 @@ +/* + * 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 { ToolingLog } from '@kbn/tooling-log'; +import type SuperTest from 'supertest'; +import { getCases } from '@kbn/test-suites-xpack-platform/cases_api_integration/common/lib/api/case'; +import { waitFor } from '../../../../common/utils/security_solution/detections_response'; + +export const waitForCases = async (supertest: SuperTest.Agent, log: ToolingLog): Promise => { + await waitFor( + async () => { + const response = await getCases(supertest); + const cases = response; + return cases != null && cases.cases.length > 0 && cases?.cases[0]?.totalAlerts > 0; + }, + 'waitForCaseToAttachAlert', + log + ); +}; diff --git a/x-pack/test/security_solution_api_integration/tsconfig.json b/x-pack/test/security_solution_api_integration/tsconfig.json index 3abeed579f13..45dcb862ba05 100644 --- a/x-pack/test/security_solution_api_integration/tsconfig.json +++ b/x-pack/test/security_solution_api_integration/tsconfig.json @@ -57,5 +57,6 @@ "@kbn/security-plugin-types-common", "@kbn/babel-register", "@kbn/config-schema", + "@kbn/test-suites-xpack-platform", ] } diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index 474a7e150738..883f205ba4cc 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -30,7 +30,6 @@ "@kbn/kibana-usage-collection-plugin", "@kbn/share-plugin", "@kbn/telemetry-collection-manager-plugin", - "@kbn/actions-plugin", "@kbn/alerting-plugin", "@kbn/apm-plugin", "@kbn/cases-plugin", @@ -72,7 +71,6 @@ "@kbn/utility-types", "@kbn/data-views-plugin", "@kbn/datemath", - "@kbn/safer-lodash-set", "@kbn/es-archiver", "@kbn/config-schema", "@kbn/es-query", @@ -91,7 +89,6 @@ "@kbn/security-api-integration-helpers", "@kbn/alerts-as-data-utils", "@kbn/discover-plugin", - "@kbn/files-plugin", "@kbn/shared-ux-file-types", "@kbn/guided-onboarding-plugin", "@kbn/field-formats-plugin", @@ -135,7 +132,6 @@ "@kbn/securitysolution-exceptions-common", "@kbn/securitysolution-endpoint-exceptions-common", "@kbn/osquery-plugin", - "@kbn/cases-api-integration-test-plugin", "@kbn/mock-idp-utils", "@kbn/saved-objects-management-plugin", "@kbn/alerting-types", diff --git a/yarn.lock b/yarn.lock index f9657c21bb77..de2bd6093ebf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4045,7 +4045,7 @@ version "0.0.0" uid "" -"@kbn/cases-api-integration-test-plugin@link:x-pack/test/cases_api_integration/common/plugins/cases": +"@kbn/cases-api-integration-test-plugin@link:x-pack/platform/test/cases_api_integration/common/plugins/cases": version "0.0.0" uid "" @@ -6529,7 +6529,7 @@ version "0.0.0" uid "" -"@kbn/observability-fixtures-plugin@link:x-pack/test/cases_api_integration/common/plugins/observability": +"@kbn/observability-fixtures-plugin@link:x-pack/platform/test/cases_api_integration/common/plugins/observability": version "0.0.0" uid "" @@ -7221,7 +7221,7 @@ version "0.0.0" uid "" -"@kbn/security-solution-fixtures-plugin@link:x-pack/test/cases_api_integration/common/plugins/security_solution": +"@kbn/security-solution-fixtures-plugin@link:x-pack/platform/test/cases_api_integration/common/plugins/security_solution": version "0.0.0" uid ""