Open banderror opened 1 year ago
Pinging @elastic/security-detections-response (Team:Detections and Resp)
Pinging @elastic/security-solution (Team: SecuritySolution)
We started that effort already, but we didn't have enough hands: https://github.com/elastic/kibana/pull/143383
It would be nice to use the above PR as which things we want to maintain, which things can be dropped/changed, and also arrive at an agreement regarding the next steps
section, since we are going to find similar issues.
@MadameSheema We'll sync up on this later 👍
Epic: https://github.com/elastic/kibana/issues/153633 Related to: (comment, comment, comment)
Summary
Make Cypress tests for rules driven by code instead of test data. Get rid of optional properties in data. This is supposed to reduce flakiness, increase speed, and improve the maintainability of our Cypress tests.
Our e2e tests are driven by test data. Whatever is or is not in the data (e.g. an instance of
CustomRule
) will determine what actions will be taken in the UI. Example:This approach has a few downsides:
fillScheduleRuleAndContinue
. This is commonly considered a bad practice in any automated tests because it increases complexity and non-determinism.The suggestion is to make tests driven by code instead of data. By using single-purpose functions (Cypress tasks, commands, etc) and combining them into higher-order functions, tests will be implementing the exact logic each of them needs.
With that in place, test data can become just normal mock data where you normally have default values for properties you don't need.
Going back to the optional properties like
customQuery
andrunsEvery
- they all will be required and have some default values. Each test will decide: