kibana/packages/kbn-securitysolution-exception-list-components
Wafaa Nasr 005108684b
[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](4a75a51a3e)
- Tests under `x-pack/plugins/security_solution/cypress/upgrade_e2e` are
just POCs can't be used

# New tests folder structure based on workflow

<img width="432" alt="image"
src="https://user-images.githubusercontent.com/12671903/234849016-f6f227d1-fcaf-43cb-abe3-d3fc7f9cee00.png">

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-06-07 15:15:30 +01:00
..
src [Security Solution][Exceptions]- Increase exceptions test coverage (#152757) 2023-06-07 15:15:30 +01:00
index.ts [Security Solution][Exception]: Add to shared lists fixes (#146750) 2022-12-02 15:02:33 +01:00
jest.config.js [Security Solution][Exceptions] - Create/ refactor Exception-List common's components in @kbn/securitysolution-exception-list-components (#143363) 2022-10-19 19:33:17 +02:00
kibana.jsonc Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
package.json Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00
README.md [Security Solution][Exceptions] - Create/ refactor Exception-List common's components in @kbn/securitysolution-exception-list-components (#143363) 2022-10-19 19:33:17 +02:00
setup_test.ts Exceptions List component (#140985) 2022-09-28 20:36:05 +02:00
tsconfig.json Transpile packages on demand, validate all TS projects (#146212) 2022-12-22 19:00:29 -06:00

@kbn/securitysolution-exception-list-components

Common exceptions' components

Aim

  • To have most of the Exceptions' components in one place, to be shared accross multiple pages and used for different logic.
  • This package holds the presetational part of the components only as the API or the logic part should reside under the consumer page

Pattern used

component
    index.tsx
    index.styles.ts <-- to hold styles if the component has many custom styles
    use_component.ts <-- for logic if the Presentational Component has logic
    component.test.tsx
    use_component.test.tsx
  

Testing

In order to unify our testing tools, we configured only two libraries, the React-Testing-Library to test the component UI part and the Reat-Testing-Hooks to test the component's UI interactions

Styling

In order to follow the KBN-Packages's recommendations, to define a custom CSS we can only use the @emotion/react or @emotion/css libraries

Next

  • Now the ExceptionItems, ExceptionItemCard and ExceptionItemCardMetaInfo receive securityLinkAnchorComponent, exceptionsUtilityComponent , and exceptionsUtilityComponent as props to avoid moving all the common components under the x-pack at once, later we should move all building blocks to this kbn-package