From 005108684b909b6fac829e1d4bb1ca6921215c66 Mon Sep 17 00:00:00 2001 From: Wafaa Nasr Date: Wed, 7 Jun 2023 15:15:30 +0100 Subject: [PATCH] [Security Solution][Exceptions]- Increase exceptions test coverage (#152757) ## Summary - Addresses https://github.com/elastic/security-team/issues/5947 - Adding tests to cover the yellow rows in [test sheet](https://docs.google.com/spreadsheets/d/1Eb_317s7nkQ4axVA270Ja99PRS-NWrYZAEc-1aVuyXg/edit#gid=0) - Organise the tests to correspond to the following [structure](https://docs.google.com/spreadsheets/d/14DdtghpxgfEmWoc7kot4XgEva_4GDEC_uTej65MUjV8/edit?pli=1#gid=0) - Removed the `x-pack/plugins/security_solution/cypress/e2e/exceptions/alerts_table_flow/add_exception.cy.ts` as it was duplicated from `x-pack/plugins/security_solution/cypress/e2e/exceptions/exceptions_management_flow/exceptions_table.cy.ts` - Skipped the `flyout_validation` tests until resolving this [ticket](https://github.com/elastic/kibana/issues/154994) - Regarding `Exception-List`, `Exception-List-Item` and `Rule with exceptions` migrations test cases are handled by most of our old `FTR` tests as most of them deal with `Exception List Schema` which doesn't include the new props, like the `expire_time` that was introduced in `8.7`, so adding new tests using the new schema can be treated as testing the new versions against the existing scenarios whereas the existing tests for the migrations (downgrade) tests [4a75a51](https://github.com/elastic/kibana/pull/152757/commits/4a75a51a3ef250a03aa3d253e952be77b2af2df5) - Tests under `x-pack/plugins/security_solution/cypress/upgrade_e2e` are just POCs can't be used # New tests folder structure based on workflow image --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../__snapshots__/list_header.test.tsx.snap | 12 +- .../__snapshots__/menu_items.test.tsx.snap | 12 +- .../src/list_header/menu_items/index.tsx | 2 +- .../menu_items/menu_items.test.tsx | 6 +- x-pack/plugins/lists/common/constants.mock.ts | 3 + .../create_exception_list_item_schema.mock.ts | 16 + .../request/import_exceptions_schema.mock.ts | 24 +- .../alerts_table_flow/add_exception.cy.ts | 203 ------- .../endpoint_exceptions.cy.ts | 106 ++++ .../alerts_table_flow/rule_exceptions.cy.ts | 123 +++++ .../e2e/exceptions/entry/comments.cy.ts | 238 +++++++++ .../flyout_validation.cy.ts | 11 +- .../entry/multiple_conditions.cy.ts | 100 ++++ .../e2e/exceptions/entry/use_value_list.cy.ts | 132 +++++ .../add_edit_endpoint_exception.cy.ts | 3 + .../add_edit_exception_data_view.cy.ts | 52 +- .../add_edit_exception.cy.ts | 65 --- .../list_detail_page}/list_details.cy.ts | 59 ++- .../manage_exceptions.cy.ts | 152 ++++++ .../duplicate_lists.cy.ts | 140 +++++ .../filter_table.cy.ts} | 49 +- .../import_lists.cy.ts | 85 +++ .../manage_lists.cy.ts} | 120 +---- .../read_only.cy.ts} | 20 +- .../fixtures/7_16_exception_list.ndjson | 2 + .../security_solution/cypress/objects/rule.ts | 20 + .../cypress/screens/alerts_detection_rules.ts | 2 + .../cypress/screens/exceptions.ts | 100 +++- .../cypress/tasks/alerts_detection_rules.ts | 5 + .../cypress/tasks/exceptions.ts | 107 ++++ .../cypress/tasks/exceptions_table.ts | 88 +++- .../import_exceptions_list_flyout/index.tsx | 3 + .../exceptions/pages/shared_lists/index.tsx | 6 +- .../group10/import_export_rules.ts | 401 +++++++++++--- .../group10/import_rules.ts | 50 +- ..._exceptions.ts => exceptions_workflows.ts} | 179 ++++++- .../security_and_spaces/group3/index.ts | 2 +- .../es_archives/endpoint/data.json | 129 +++++ .../es_archives/endpoint/mappings.json | 494 ++++++++++++++++++ .../es_archives/endpoint_2/data.json | 129 +++++ .../es_archives/endpoint_2/mappings.json | 494 ++++++++++++++++++ 41 files changed, 3360 insertions(+), 584 deletions(-) delete mode 100644 x-pack/plugins/security_solution/cypress/e2e/exceptions/alerts_table_flow/add_exception.cy.ts create mode 100644 x-pack/plugins/security_solution/cypress/e2e/exceptions/alerts_table_flow/endpoint_exceptions.cy.ts create mode 100644 x-pack/plugins/security_solution/cypress/e2e/exceptions/alerts_table_flow/rule_exceptions.cy.ts create mode 100644 x-pack/plugins/security_solution/cypress/e2e/exceptions/entry/comments.cy.ts rename x-pack/plugins/security_solution/cypress/e2e/exceptions/{add_edit_flyout => entry}/flyout_validation.cy.ts (97%) create mode 100644 x-pack/plugins/security_solution/cypress/e2e/exceptions/entry/multiple_conditions.cy.ts create mode 100644 x-pack/plugins/security_solution/cypress/e2e/exceptions/entry/use_value_list.cy.ts delete mode 100644 x-pack/plugins/security_solution/cypress/e2e/exceptions/shared_exception_lists_management/add_edit_exception.cy.ts rename x-pack/plugins/security_solution/cypress/e2e/exceptions/{list_management_flow => shared_exception_lists_management/list_detail_page}/list_details.cy.ts (62%) create mode 100644 x-pack/plugins/security_solution/cypress/e2e/exceptions/shared_exception_lists_management/manage_exceptions.cy.ts create mode 100644 x-pack/plugins/security_solution/cypress/e2e/exceptions/shared_exception_lists_management/shared_exception_list_page/duplicate_lists.cy.ts rename x-pack/plugins/security_solution/cypress/e2e/exceptions/shared_exception_lists_management/{exceptions_table.cy.ts => shared_exception_list_page/filter_table.cy.ts} (80%) create mode 100644 x-pack/plugins/security_solution/cypress/e2e/exceptions/shared_exception_lists_management/shared_exception_list_page/import_lists.cy.ts rename x-pack/plugins/security_solution/cypress/e2e/exceptions/shared_exception_lists_management/{manage_shared_exception_list.cy.ts => shared_exception_list_page/manage_lists.cy.ts} (53%) rename x-pack/plugins/security_solution/cypress/e2e/exceptions/shared_exception_lists_management/{all_exception_lists_read_only.cy.ts => shared_exception_list_page/read_only.cy.ts} (76%) create mode 100644 x-pack/plugins/security_solution/cypress/fixtures/7_16_exception_list.ndjson rename x-pack/test/detection_engine_api_integration/security_and_spaces/group3/{create_exceptions.ts => exceptions_workflows.ts} (84%) create mode 100644 x-pack/test/security_solution_cypress/es_archives/endpoint/data.json create mode 100644 x-pack/test/security_solution_cypress/es_archives/endpoint/mappings.json create mode 100644 x-pack/test/security_solution_cypress/es_archives/endpoint_2/data.json create mode 100644 x-pack/test/security_solution_cypress/es_archives/endpoint_2/mappings.json diff --git a/packages/kbn-securitysolution-exception-list-components/src/list_header/__snapshots__/list_header.test.tsx.snap b/packages/kbn-securitysolution-exception-list-components/src/list_header/__snapshots__/list_header.test.tsx.snap index c0d2cc256166a..c5b380bef6737 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/list_header/__snapshots__/list_header.test.tsx.snap +++ b/packages/kbn-securitysolution-exception-list-components/src/list_header/__snapshots__/list_header.test.tsx.snap @@ -176,7 +176,7 @@ Object { >