Skip to content

[Detection Engine] Cypress cleanup and simplification#217276

Merged
yctercero merged 7 commits intoelastic:mainfrom
yctercero:experiment_with_cypress
Apr 14, 2025
Merged

[Detection Engine] Cypress cleanup and simplification#217276
yctercero merged 7 commits intoelastic:mainfrom
yctercero:experiment_with_cypress

Conversation

@yctercero
Copy link
Copy Markdown
Contributor

@yctercero yctercero commented Apr 7, 2025

Summary

This PR attempts to simplify our Cypress tests to focus in on what exactly we want a test to be doing. Many of our rule creation cypress tests were testing rule creation, rule edit, rule details and more. This results in a lot of flake and us triaging tests that often test things other than what we're ultimately trying to answer.

I tried to simplify it so the rule specific tests simply answer - can we create this rule type in the UI? Then there's a single test for checking the entire flow of create rule -> rule details and check for alerts. The FTRs should be ensuring that the rules generate alerts as expected so we don't need to check this for every rule type in cypress.

I also moved alert suppression into it's own folder as there is a lot of specific logic to test around that.

Ran on flakey test runner - https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8159

@yctercero
Copy link
Copy Markdown
Contributor Author

/ci

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🎉 All tests passed! - kibana-flaky-test-suite-runner#8159

[✅] Security Solution Detection Engine - Cypress: 25/25 tests passed.
[✅] [Serverless] Security Solution Detection Engine - Cypress: 25/25 tests passed.
[✅] Security Solution Detection Engine - Exceptions - Cypress: 25/25 tests passed.
[✅] [Serverless] Security Solution Detection Engine - Exceptions - Cypress: 25/25 tests passed.

see run history

@yctercero yctercero self-assigned this Apr 9, 2025
@yctercero yctercero added release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels v9.1.0 v8.19.0 Team:Detection Engine Security Solution Detection Engine Area labels Apr 9, 2025
@yctercero yctercero marked this pull request as ready for review April 9, 2025 16:46
@yctercero yctercero requested a review from a team as a code owner April 9, 2025 16:46
@yctercero yctercero requested a review from vitaliidm April 9, 2025 16:46
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-detection-engine (Team:Detection Engine)

@yctercero yctercero changed the title testing out if we can simplify our rule creation cypress tests [Detection Engine] Cypress cleanup and simplification Apr 9, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @yctercero

@yctercero yctercero merged commit 81c93ca into elastic:main Apr 14, 2025
9 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/14453309861

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 14, 2025
## Summary

This PR attempts to simplify our Cypress tests to focus in on what
exactly we want a test to be doing. Many of our rule creation cypress
tests were testing rule creation, rule edit, rule details and more. This
results in a lot of flake and us triaging tests that often test things
other than what we're ultimately trying to answer.

I tried to simplify it so the rule specific tests simply answer - can we
create this rule type in the UI? Then there's a single test for checking
the entire flow of create rule -> rule details and check for alerts. The
FTRs should be ensuring that the rules generate alerts as expected so we
don't need to check this for every rule type in cypress.

I also moved alert suppression into it's own folder as there is a lot of
specific logic to test around that.

(cherry picked from commit 81c93ca)
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Apr 14, 2025
…#218166)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Detection Engine] Cypress cleanup and simplification
(#217276)](#217276)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Yara
Tercero","email":"yctercero@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-14T18:46:47Z","message":"[Detection
Engine] Cypress cleanup and simplification (#217276)\n\n##
Summary\n\nThis PR attempts to simplify our Cypress tests to focus in on
what\nexactly we want a test to be doing. Many of our rule creation
cypress\ntests were testing rule creation, rule edit, rule details and
more. This\nresults in a lot of flake and us triaging tests that often
test things\nother than what we're ultimately trying to answer.\n\nI
tried to simplify it so the rule specific tests simply answer - can
we\ncreate this rule type in the UI? Then there's a single test for
checking\nthe entire flow of create rule -> rule details and check for
alerts. The\nFTRs should be ensuring that the rules generate alerts as
expected so we\ndon't need to check this for every rule type in
cypress.\n\nI also moved alert suppression into it's own folder as there
is a lot of\nspecific logic to test around
that.","sha":"81c93ca5d1dd714297b04ff80660fbdb6a267582","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Detection
Engine","backport:version","v9.1.0","v8.19.0"],"title":"[Detection
Engine] Cypress cleanup and
simplification","number":217276,"url":"https://github.com/elastic/kibana/pull/217276","mergeCommit":{"message":"[Detection
Engine] Cypress cleanup and simplification (#217276)\n\n##
Summary\n\nThis PR attempts to simplify our Cypress tests to focus in on
what\nexactly we want a test to be doing. Many of our rule creation
cypress\ntests were testing rule creation, rule edit, rule details and
more. This\nresults in a lot of flake and us triaging tests that often
test things\nother than what we're ultimately trying to answer.\n\nI
tried to simplify it so the rule specific tests simply answer - can
we\ncreate this rule type in the UI? Then there's a single test for
checking\nthe entire flow of create rule -> rule details and check for
alerts. The\nFTRs should be ensuring that the rules generate alerts as
expected so we\ndon't need to check this for every rule type in
cypress.\n\nI also moved alert suppression into it's own folder as there
is a lot of\nspecific logic to test around
that.","sha":"81c93ca5d1dd714297b04ff80660fbdb6a267582"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217276","number":217276,"mergeCommit":{"message":"[Detection
Engine] Cypress cleanup and simplification (#217276)\n\n##
Summary\n\nThis PR attempts to simplify our Cypress tests to focus in on
what\nexactly we want a test to be doing. Many of our rule creation
cypress\ntests were testing rule creation, rule edit, rule details and
more. This\nresults in a lot of flake and us triaging tests that often
test things\nother than what we're ultimately trying to answer.\n\nI
tried to simplify it so the rule specific tests simply answer - can
we\ncreate this rule type in the UI? Then there's a single test for
checking\nthe entire flow of create rule -> rule details and check for
alerts. The\nFTRs should be ensuring that the rules generate alerts as
expected so we\ndon't need to check this for every rule type in
cypress.\n\nI also moved alert suppression into it's own folder as there
is a lot of\nspecific logic to test around
that.","sha":"81c93ca5d1dd714297b04ff80660fbdb6a267582"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Yara Tercero <yctercero@users.noreply.github.com>
rylnd pushed a commit to rylnd/kibana that referenced this pull request May 30, 2025
## Summary

This PR attempts to simplify our Cypress tests to focus in on what
exactly we want a test to be doing. Many of our rule creation cypress
tests were testing rule creation, rule edit, rule details and more. This
results in a lot of flake and us triaging tests that often test things
other than what we're ultimately trying to answer.

I tried to simplify it so the rule specific tests simply answer - can we
create this rule type in the UI? Then there's a single test for checking
the entire flow of create rule -> rule details and check for alerts. The
FTRs should be ensuring that the rules generate alerts as expected so we
don't need to check this for every rule type in cypress.

I also moved alert suppression into it's own folder as there is a lot of
specific logic to test around that.

(cherry picked from commit 81c93ca)

# Conflicts:
#	x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_creation/eql_rule_suppression_ess_basic.cy.ts
@rylnd
Copy link
Copy Markdown
Contributor

rylnd commented May 30, 2025

💚 All backports created successfully

Status Branch Result
9.0

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

rylnd added a commit that referenced this pull request May 30, 2025
…#221991)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[Detection Engine] Cypress cleanup and simplification
(#217276)](#217276)

<!--- Backport version: 10.0.0 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Yara
Tercero","email":"yctercero@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-14T18:46:47Z","message":"[Detection
Engine] Cypress cleanup and simplification (#217276)\n\n##
Summary\n\nThis PR attempts to simplify our Cypress tests to focus in on
what\nexactly we want a test to be doing. Many of our rule creation
cypress\ntests were testing rule creation, rule edit, rule details and
more. This\nresults in a lot of flake and us triaging tests that often
test things\nother than what we're ultimately trying to answer.\n\nI
tried to simplify it so the rule specific tests simply answer - can
we\ncreate this rule type in the UI? Then there's a single test for
checking\nthe entire flow of create rule -> rule details and check for
alerts. The\nFTRs should be ensuring that the rules generate alerts as
expected so we\ndon't need to check this for every rule type in
cypress.\n\nI also moved alert suppression into it's own folder as there
is a lot of\nspecific logic to test around
that.","sha":"81c93ca5d1dd714297b04ff80660fbdb6a267582","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Detection
Engine","backport:version","v9.1.0","v8.19.0"],"title":"[Detection
Engine] Cypress cleanup and
simplification","number":217276,"url":"https://github.com/elastic/kibana/pull/217276","mergeCommit":{"message":"[Detection
Engine] Cypress cleanup and simplification (#217276)\n\n##
Summary\n\nThis PR attempts to simplify our Cypress tests to focus in on
what\nexactly we want a test to be doing. Many of our rule creation
cypress\ntests were testing rule creation, rule edit, rule details and
more. This\nresults in a lot of flake and us triaging tests that often
test things\nother than what we're ultimately trying to answer.\n\nI
tried to simplify it so the rule specific tests simply answer - can
we\ncreate this rule type in the UI? Then there's a single test for
checking\nthe entire flow of create rule -> rule details and check for
alerts. The\nFTRs should be ensuring that the rules generate alerts as
expected so we\ndon't need to check this for every rule type in
cypress.\n\nI also moved alert suppression into it's own folder as there
is a lot of\nspecific logic to test around
that.","sha":"81c93ca5d1dd714297b04ff80660fbdb6a267582"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217276","number":217276,"mergeCommit":{"message":"[Detection
Engine] Cypress cleanup and simplification (#217276)\n\n##
Summary\n\nThis PR attempts to simplify our Cypress tests to focus in on
what\nexactly we want a test to be doing. Many of our rule creation
cypress\ntests were testing rule creation, rule edit, rule details and
more. This\nresults in a lot of flake and us triaging tests that often
test things\nother than what we're ultimately trying to answer.\n\nI
tried to simplify it so the rule specific tests simply answer - can
we\ncreate this rule type in the UI? Then there's a single test for
checking\nthe entire flow of create rule -> rule details and check for
alerts. The\nFTRs should be ensuring that the rules generate alerts as
expected so we\ndon't need to check this for every rule type in
cypress.\n\nI also moved alert suppression into it's own folder as there
is a lot of\nspecific logic to test around
that.","sha":"81c93ca5d1dd714297b04ff80660fbdb6a267582"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/218166","number":218166,"state":"MERGED","mergeCommit":{"sha":"8ab1f4101a8d148c41f368762328cbfe098bc7b3","message":"[8.x]
[Detection Engine] Cypress cleanup and simplification (#217276)
(#218166)\n\n# Backport\n\nThis will backport the following commits from
`main` to `8.x`:\n- [[Detection Engine] Cypress cleanup and
simplification\n(#217276)](https://github.com/elastic/kibana/pull/217276)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Yara Tercero <yctercero@users.noreply.github.com>"}}]}] BACKPORT-->

---------

Co-authored-by: Yara Tercero <yctercero@users.noreply.github.com>
@mistic
Copy link
Copy Markdown
Contributor

mistic commented Jun 3, 2025

This PR didn't make it into the latest 9.0.2 BC. Updating the labels.

@mistic mistic added v9.0.3 and removed v9.0.2 labels Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:Detection Engine Security Solution Detection Engine Area v8.19.0 v9.0.3 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants