Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution] Fix some Prebuilt Rules Cypress tests not running in CI #191978

Merged
merged 9 commits into from
Sep 13, 2024

Conversation

nikitaindik
Copy link
Contributor

@nikitaindik nikitaindik commented Sep 3, 2024

Resolves: #192256

Summary

This PR re-enables two Cypress test files that didn't run on CI: update_workflow.cy.ts and prebuilt_rules_preview.cy.ts. It also fixes failing tests in prebuilt_rules_preview.cy.ts.

Changes

  • Renamed update_workflow.ts -> update_workflow.cy.ts. It didn't run on CI because it wasn't picked up by a glob here.
  • prebuilt_rules_preview.cy.ts:
    • Moved { tags: ['@ess', '@serverless'] } to the top-level describe block instead of having it in a variable that is used in every describe. Apparently the tool we use to parse tags doesn't recognize tags in variables anymore, so this test didn't run in either ESS or Serverless pipelines.
    • Removed describe('All environments' ... wrappers since they don't add any value anymore. Didn't remove any actual tests.
    • Reverted a change from this PR that added a backdrop to the modal which doesn't allow user to switch rules without closing the modal. We have a test that checks that such switching is possible and this test started to fail once I reactivated the test file.
    • Fixed selectors that grab filters in the Overview tab. The old ones stopped working. Probably because of a change to the filters component that is built by another team.

Correct behaviour: Switching between rules with flyout open

Schermopname.2024-09-05.om.16.54.44.mov

@nikitaindik nikitaindik added the release_note:skip Skip the PR/issue when compiling release notes label Sep 3, 2024
@nikitaindik nikitaindik self-assigned this Sep 3, 2024
@nikitaindik nikitaindik force-pushed the cypress-tests-not-running-on-ci branch from ba3a284 to b146546 Compare September 5, 2024 10:10
@nikitaindik nikitaindik force-pushed the cypress-tests-not-running-on-ci branch from b146546 to fb10273 Compare September 5, 2024 14:48
@nikitaindik nikitaindik added Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team v8.16.0 labels Sep 5, 2024
@nikitaindik nikitaindik marked this pull request as ready for review September 5, 2024 15:30
@nikitaindik nikitaindik requested a review from a team as a code owner September 5, 2024 15:30
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management)

@@ -196,7 +196,7 @@ export const RuleDetailsFlyout = ({
paddingSize="l"
data-test-subj={dataTestSubj}
aria-labelledby={prebuiltRulesFlyoutTitleId}
ownFocus
Copy link
Contributor

@alexwizp alexwizp Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure that this is the correct change. This table is partially (or completely) covered by the open Flyout, which means, from an a11y perspective, we should not allow setting focus on it.

Let's ask EUI. @cee-chen / @1Copenut please give us your input.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the importance of the functionality for quick preview, but also I think we need to follow a consistent style for when it is appropriate to use ownFocus and when it is not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikitaindik I have the same concern. It's better to follow current UX across Kibana. I'm pretty sure the test you mentioned was written some time ago when the flyout didn't own focus by default.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EuiFlyout does set ownFocus={true} by default, so unless this component now explicitly sets ownFocus={false} this component should be behaving the same way as before.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry disregard my previous unhelpful comment, I was looking only at the line highlighted and not at the full diff, I see this is setting ownFocus={false}.

ownFocus={false} flyouts still move/trap focus, so the flyout content still remains accessible for keyboard users, although the content below it does not: https://eui.elastic.co/#/layout/flyout#without-ownfocus

Alexey, does the above documentation help explain ownFocus usage?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cee-chen Yep, that's exactly what I mean. That case doesn't seem like something where we should set ownFocus={false}. The default behavior will provide the best UX

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your input folks! I have tried both options myself and found that when tabbing using the keyboard the focus seems to behave the same. With either ownFocus={false} or ownFocus={true} it stays within the flyout and top page menu. Please tell me if I misunderstood your concern.

Also I have discussed this with our PO (@approksiu) and design team today, showed them both options - with and without the backdrop. And we have concluded that for our use case (quickly switching between rules) it would be desirable if there's no backdrop and table items are still clickable with a mouse.

Copy link
Contributor

@alexwizp alexwizp Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I certainly support the unification of UX, but this is your decision. Please keep in mind that this will lead to the following issues:

  1. When switching between table elements, the focus will not move to the EuiFlyout as expected. In fact, the focus goes to the element under EuiFlyout, which makes keyboard navigation very problematic.
  2. There may be incorrect behaviour of the main content scrolling when using keyboard navigation inside the EuiFlyout. See same problem we have here fix: [Obs Infrastructure > Hosts][KEYBOARD]: Host flyout has buggy scrolling when I expand the State dropdown menu #192372 . I've tested for your case and issue is here.

I'm not insisting, I just want to highlight and explain why we removed ownFocus={false}

@approksiu just fyi

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for highlighting these 2 issues @alexwizp! I have discussed these with the team and we've decided to revert to the default behaviour (with the dark backdrop). Made the change in this commit: d1cadfa

@nikitaindik nikitaindik marked this pull request as draft September 10, 2024 09:24
@nikitaindik nikitaindik marked this pull request as ready for review September 10, 2024 20:57
@kibana-ci
Copy link
Collaborator

kibana-ci commented Sep 13, 2024

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @nikitaindik

@nikitaindik nikitaindik added the backport:prev-major Backport to (8.x, 8.15) the previous major branch and all later branches still in development label Sep 13, 2024
Copy link
Contributor

@maximpn maximpn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nikitaindik nikitaindik merged commit c65c2ae into elastic:main Sep 13, 2024
48 of 49 checks passed
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 13, 2024
… in CI (elastic#191978)

**Resolves: elastic#192256

## Summary

This PR re-enables two Cypress test files that didn't run on CI:
`update_workflow.cy.ts` and `prebuilt_rules_preview.cy.ts`. It also
fixes failing tests in `prebuilt_rules_preview.cy.ts`.

### Changes
- Renamed `update_workflow.ts` -> `update_workflow.cy.ts`. It didn't run
on CI because it wasn't picked up by a glob
[here](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/package.json#L14).
 - `prebuilt_rules_preview.cy.ts`:
- Moved `{ tags: ['@ess', '@serverless'] }` to the top-level `describe`
block instead of having it in a variable that is used in every
`describe`. Apparently the tool we use to parse tags doesn't recognize
tags in variables anymore, so this test didn't run in either ESS or
Serverless pipelines.
- Removed `describe('All environments' ... ` wrappers since they don't
add any value anymore. Didn't remove any actual tests.
- Reverted a change from this
[PR](elastic#181427) that added a
backdrop to the modal which doesn't allow user to switch rules without
closing the modal. We have a
[test](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/rule_management/prebuilt_rules/prebuilt_rules_preview.cy.ts#L1182)
that checks that such switching is possible and this test started to
fail once I reactivated the test file.
- Fixed selectors that grab filters in the Overview tab. The old ones
stopped working. Probably because of a change to the filters component
that is built by another team.

#### Correct behaviour: Switching between rules with flyout open

https://github.com/user-attachments/assets/da4a0902-657c-45fe-adc1-eb44ad0de798
(cherry picked from commit c65c2ae)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 13, 2024
… in CI (elastic#191978)

**Resolves: elastic#192256

## Summary

This PR re-enables two Cypress test files that didn't run on CI:
`update_workflow.cy.ts` and `prebuilt_rules_preview.cy.ts`. It also
fixes failing tests in `prebuilt_rules_preview.cy.ts`.

### Changes
- Renamed `update_workflow.ts` -> `update_workflow.cy.ts`. It didn't run
on CI because it wasn't picked up by a glob
[here](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/package.json#L14).
 - `prebuilt_rules_preview.cy.ts`:
- Moved `{ tags: ['@ess', '@serverless'] }` to the top-level `describe`
block instead of having it in a variable that is used in every
`describe`. Apparently the tool we use to parse tags doesn't recognize
tags in variables anymore, so this test didn't run in either ESS or
Serverless pipelines.
- Removed `describe('All environments' ... ` wrappers since they don't
add any value anymore. Didn't remove any actual tests.
- Reverted a change from this
[PR](elastic#181427) that added a
backdrop to the modal which doesn't allow user to switch rules without
closing the modal. We have a
[test](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/rule_management/prebuilt_rules/prebuilt_rules_preview.cy.ts#L1182)
that checks that such switching is possible and this test started to
fail once I reactivated the test file.
- Fixed selectors that grab filters in the Overview tab. The old ones
stopped working. Probably because of a change to the filters component
that is built by another team.

#### Correct behaviour: Switching between rules with flyout open

https://github.com/user-attachments/assets/da4a0902-657c-45fe-adc1-eb44ad0de798
(cherry picked from commit c65c2ae)
@kibanamachine
Copy link
Contributor

kibanamachine commented Sep 13, 2024

💚 All backports created successfully

Status Branch Result
8.15
8.x

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

Manual backport

To create the backport manually run:

node scripts/backport --pr 191978

Questions ?

Please refer to the Backport tool documentation

nikitaindik added a commit to nikitaindik/kibana that referenced this pull request Sep 13, 2024
… in CI (elastic#191978)

**Resolves: elastic#192256

## Summary

This PR re-enables two Cypress test files that didn't run on CI:
`update_workflow.cy.ts` and `prebuilt_rules_preview.cy.ts`. It also
fixes failing tests in `prebuilt_rules_preview.cy.ts`.

### Changes
- Renamed `update_workflow.ts` -> `update_workflow.cy.ts`. It didn't run
on CI because it wasn't picked up by a glob
[here](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/package.json#L14).
 - `prebuilt_rules_preview.cy.ts`:
- Moved `{ tags: ['@ess', '@serverless'] }` to the top-level `describe`
block instead of having it in a variable that is used in every
`describe`. Apparently the tool we use to parse tags doesn't recognize
tags in variables anymore, so this test didn't run in either ESS or
Serverless pipelines.
- Removed `describe('All environments' ... ` wrappers since they don't
add any value anymore. Didn't remove any actual tests.
- Reverted a change from this
[PR](elastic#181427) that added a
backdrop to the modal which doesn't allow user to switch rules without
closing the modal. We have a
[test](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/rule_management/prebuilt_rules/prebuilt_rules_preview.cy.ts#L1182)
that checks that such switching is possible and this test started to
fail once I reactivated the test file.
- Fixed selectors that grab filters in the Overview tab. The old ones
stopped working. Probably because of a change to the filters component
that is built by another team.

#### Correct behaviour: Switching between rules with flyout open

https://github.com/user-attachments/assets/da4a0902-657c-45fe-adc1-eb44ad0de798
(cherry picked from commit c65c2ae)
kibanamachine added a commit that referenced this pull request Sep 13, 2024
…running in CI (#191978) (#192852)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[Security Solution] Fix some Prebuilt Rules Cypress tests not running
in CI (#191978)](#191978)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Nikita
Indik","email":"nikita.indik@elastic.co"},"sourceCommit":{"committedDate":"2024-09-13T12:00:57Z","message":"[Security
Solution] Fix some Prebuilt Rules Cypress tests not running in CI
(#191978)\n\n**Resolves:
https://github.com/elastic/kibana/issues/192256**\r\n\r\n##
Summary\r\n\r\nThis PR re-enables two Cypress test files that didn't run
on CI:\r\n`update_workflow.cy.ts` and `prebuilt_rules_preview.cy.ts`. It
also\r\nfixes failing tests in
`prebuilt_rules_preview.cy.ts`.\r\n\r\n### Changes\r\n- Renamed
`update_workflow.ts` -> `update_workflow.cy.ts`. It didn't run\r\non CI
because it wasn't picked up by a
glob\r\n[here](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/package.json#L14).\r\n
- `prebuilt_rules_preview.cy.ts`:\r\n- Moved `{ tags: ['@ess',
'@serverless'] }` to the top-level `describe`\r\nblock instead of having
it in a variable that is used in every\r\n`describe`. Apparently the
tool we use to parse tags doesn't recognize\r\ntags in variables
anymore, so this test didn't run in either ESS or\r\nServerless
pipelines.\r\n- Removed `describe('All environments' ... ` wrappers
since they don't\r\nadd any value anymore. Didn't remove any actual
tests.\r\n- Reverted a change from
this\r\n[PR](#181427) that added
a\r\nbackdrop to the modal which doesn't allow user to switch rules
without\r\nclosing the modal. We have
a\r\n[test](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/rule_management/prebuilt_rules/prebuilt_rules_preview.cy.ts#L1182)\r\nthat
checks that such switching is possible and this test started to\r\nfail
once I reactivated the test file.\r\n- Fixed selectors that grab filters
in the Overview tab. The old ones\r\nstopped working. Probably because
of a change to the filters component\r\nthat is built by another
team.\r\n\r\n\r\n#### Correct behaviour: Switching between rules with
flyout
open\r\n\r\nhttps://github.com/user-attachments/assets/da4a0902-657c-45fe-adc1-eb44ad0de798","sha":"c65c2ae4900a9f75db872cee056af35ff5f79cdc","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","backport:prev-major","v8.16.0"],"title":"[Security
Solution] Fix some Prebuilt Rules Cypress tests not running in
CI","number":191978,"url":"https://github.com/elastic/kibana/pull/191978","mergeCommit":{"message":"[Security
Solution] Fix some Prebuilt Rules Cypress tests not running in CI
(#191978)\n\n**Resolves:
https://github.com/elastic/kibana/issues/192256**\r\n\r\n##
Summary\r\n\r\nThis PR re-enables two Cypress test files that didn't run
on CI:\r\n`update_workflow.cy.ts` and `prebuilt_rules_preview.cy.ts`. It
also\r\nfixes failing tests in
`prebuilt_rules_preview.cy.ts`.\r\n\r\n### Changes\r\n- Renamed
`update_workflow.ts` -> `update_workflow.cy.ts`. It didn't run\r\non CI
because it wasn't picked up by a
glob\r\n[here](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/package.json#L14).\r\n
- `prebuilt_rules_preview.cy.ts`:\r\n- Moved `{ tags: ['@ess',
'@serverless'] }` to the top-level `describe`\r\nblock instead of having
it in a variable that is used in every\r\n`describe`. Apparently the
tool we use to parse tags doesn't recognize\r\ntags in variables
anymore, so this test didn't run in either ESS or\r\nServerless
pipelines.\r\n- Removed `describe('All environments' ... ` wrappers
since they don't\r\nadd any value anymore. Didn't remove any actual
tests.\r\n- Reverted a change from
this\r\n[PR](#181427) that added
a\r\nbackdrop to the modal which doesn't allow user to switch rules
without\r\nclosing the modal. We have
a\r\n[test](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/rule_management/prebuilt_rules/prebuilt_rules_preview.cy.ts#L1182)\r\nthat
checks that such switching is possible and this test started to\r\nfail
once I reactivated the test file.\r\n- Fixed selectors that grab filters
in the Overview tab. The old ones\r\nstopped working. Probably because
of a change to the filters component\r\nthat is built by another
team.\r\n\r\n\r\n#### Correct behaviour: Switching between rules with
flyout
open\r\n\r\nhttps://github.com/user-attachments/assets/da4a0902-657c-45fe-adc1-eb44ad0de798","sha":"c65c2ae4900a9f75db872cee056af35ff5f79cdc"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/191978","number":191978,"mergeCommit":{"message":"[Security
Solution] Fix some Prebuilt Rules Cypress tests not running in CI
(#191978)\n\n**Resolves:
https://github.com/elastic/kibana/issues/192256**\r\n\r\n##
Summary\r\n\r\nThis PR re-enables two Cypress test files that didn't run
on CI:\r\n`update_workflow.cy.ts` and `prebuilt_rules_preview.cy.ts`. It
also\r\nfixes failing tests in
`prebuilt_rules_preview.cy.ts`.\r\n\r\n### Changes\r\n- Renamed
`update_workflow.ts` -> `update_workflow.cy.ts`. It didn't run\r\non CI
because it wasn't picked up by a
glob\r\n[here](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/package.json#L14).\r\n
- `prebuilt_rules_preview.cy.ts`:\r\n- Moved `{ tags: ['@ess',
'@serverless'] }` to the top-level `describe`\r\nblock instead of having
it in a variable that is used in every\r\n`describe`. Apparently the
tool we use to parse tags doesn't recognize\r\ntags in variables
anymore, so this test didn't run in either ESS or\r\nServerless
pipelines.\r\n- Removed `describe('All environments' ... ` wrappers
since they don't\r\nadd any value anymore. Didn't remove any actual
tests.\r\n- Reverted a change from
this\r\n[PR](#181427) that added
a\r\nbackdrop to the modal which doesn't allow user to switch rules
without\r\nclosing the modal. We have
a\r\n[test](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/rule_management/prebuilt_rules/prebuilt_rules_preview.cy.ts#L1182)\r\nthat
checks that such switching is possible and this test started to\r\nfail
once I reactivated the test file.\r\n- Fixed selectors that grab filters
in the Overview tab. The old ones\r\nstopped working. Probably because
of a change to the filters component\r\nthat is built by another
team.\r\n\r\n\r\n#### Correct behaviour: Switching between rules with
flyout
open\r\n\r\nhttps://github.com/user-attachments/assets/da4a0902-657c-45fe-adc1-eb44ad0de798","sha":"c65c2ae4900a9f75db872cee056af35ff5f79cdc"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Nikita Indik <nikita.indik@elastic.co>
kibanamachine added a commit that referenced this pull request Sep 13, 2024
…unning in CI (#191978) (#192853)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution] Fix some Prebuilt Rules Cypress tests not running
in CI (#191978)](#191978)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Nikita
Indik","email":"nikita.indik@elastic.co"},"sourceCommit":{"committedDate":"2024-09-13T12:00:57Z","message":"[Security
Solution] Fix some Prebuilt Rules Cypress tests not running in CI
(#191978)\n\n**Resolves:
https://github.com/elastic/kibana/issues/192256**\r\n\r\n##
Summary\r\n\r\nThis PR re-enables two Cypress test files that didn't run
on CI:\r\n`update_workflow.cy.ts` and `prebuilt_rules_preview.cy.ts`. It
also\r\nfixes failing tests in
`prebuilt_rules_preview.cy.ts`.\r\n\r\n### Changes\r\n- Renamed
`update_workflow.ts` -> `update_workflow.cy.ts`. It didn't run\r\non CI
because it wasn't picked up by a
glob\r\n[here](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/package.json#L14).\r\n
- `prebuilt_rules_preview.cy.ts`:\r\n- Moved `{ tags: ['@ess',
'@serverless'] }` to the top-level `describe`\r\nblock instead of having
it in a variable that is used in every\r\n`describe`. Apparently the
tool we use to parse tags doesn't recognize\r\ntags in variables
anymore, so this test didn't run in either ESS or\r\nServerless
pipelines.\r\n- Removed `describe('All environments' ... ` wrappers
since they don't\r\nadd any value anymore. Didn't remove any actual
tests.\r\n- Reverted a change from
this\r\n[PR](#181427) that added
a\r\nbackdrop to the modal which doesn't allow user to switch rules
without\r\nclosing the modal. We have
a\r\n[test](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/rule_management/prebuilt_rules/prebuilt_rules_preview.cy.ts#L1182)\r\nthat
checks that such switching is possible and this test started to\r\nfail
once I reactivated the test file.\r\n- Fixed selectors that grab filters
in the Overview tab. The old ones\r\nstopped working. Probably because
of a change to the filters component\r\nthat is built by another
team.\r\n\r\n\r\n#### Correct behaviour: Switching between rules with
flyout
open\r\n\r\nhttps://github.com/user-attachments/assets/da4a0902-657c-45fe-adc1-eb44ad0de798","sha":"c65c2ae4900a9f75db872cee056af35ff5f79cdc","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Detections
and Resp","Team: SecuritySolution","Team:Detection Rule
Management","backport:prev-major","v8.16.0"],"title":"[Security
Solution] Fix some Prebuilt Rules Cypress tests not running in
CI","number":191978,"url":"https://github.com/elastic/kibana/pull/191978","mergeCommit":{"message":"[Security
Solution] Fix some Prebuilt Rules Cypress tests not running in CI
(#191978)\n\n**Resolves:
https://github.com/elastic/kibana/issues/192256**\r\n\r\n##
Summary\r\n\r\nThis PR re-enables two Cypress test files that didn't run
on CI:\r\n`update_workflow.cy.ts` and `prebuilt_rules_preview.cy.ts`. It
also\r\nfixes failing tests in
`prebuilt_rules_preview.cy.ts`.\r\n\r\n### Changes\r\n- Renamed
`update_workflow.ts` -> `update_workflow.cy.ts`. It didn't run\r\non CI
because it wasn't picked up by a
glob\r\n[here](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/package.json#L14).\r\n
- `prebuilt_rules_preview.cy.ts`:\r\n- Moved `{ tags: ['@ess',
'@serverless'] }` to the top-level `describe`\r\nblock instead of having
it in a variable that is used in every\r\n`describe`. Apparently the
tool we use to parse tags doesn't recognize\r\ntags in variables
anymore, so this test didn't run in either ESS or\r\nServerless
pipelines.\r\n- Removed `describe('All environments' ... ` wrappers
since they don't\r\nadd any value anymore. Didn't remove any actual
tests.\r\n- Reverted a change from
this\r\n[PR](#181427) that added
a\r\nbackdrop to the modal which doesn't allow user to switch rules
without\r\nclosing the modal. We have
a\r\n[test](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/rule_management/prebuilt_rules/prebuilt_rules_preview.cy.ts#L1182)\r\nthat
checks that such switching is possible and this test started to\r\nfail
once I reactivated the test file.\r\n- Fixed selectors that grab filters
in the Overview tab. The old ones\r\nstopped working. Probably because
of a change to the filters component\r\nthat is built by another
team.\r\n\r\n\r\n#### Correct behaviour: Switching between rules with
flyout
open\r\n\r\nhttps://github.com/user-attachments/assets/da4a0902-657c-45fe-adc1-eb44ad0de798","sha":"c65c2ae4900a9f75db872cee056af35ff5f79cdc"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/191978","number":191978,"mergeCommit":{"message":"[Security
Solution] Fix some Prebuilt Rules Cypress tests not running in CI
(#191978)\n\n**Resolves:
https://github.com/elastic/kibana/issues/192256**\r\n\r\n##
Summary\r\n\r\nThis PR re-enables two Cypress test files that didn't run
on CI:\r\n`update_workflow.cy.ts` and `prebuilt_rules_preview.cy.ts`. It
also\r\nfixes failing tests in
`prebuilt_rules_preview.cy.ts`.\r\n\r\n### Changes\r\n- Renamed
`update_workflow.ts` -> `update_workflow.cy.ts`. It didn't run\r\non CI
because it wasn't picked up by a
glob\r\n[here](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/package.json#L14).\r\n
- `prebuilt_rules_preview.cy.ts`:\r\n- Moved `{ tags: ['@ess',
'@serverless'] }` to the top-level `describe`\r\nblock instead of having
it in a variable that is used in every\r\n`describe`. Apparently the
tool we use to parse tags doesn't recognize\r\ntags in variables
anymore, so this test didn't run in either ESS or\r\nServerless
pipelines.\r\n- Removed `describe('All environments' ... ` wrappers
since they don't\r\nadd any value anymore. Didn't remove any actual
tests.\r\n- Reverted a change from
this\r\n[PR](#181427) that added
a\r\nbackdrop to the modal which doesn't allow user to switch rules
without\r\nclosing the modal. We have
a\r\n[test](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/rule_management/prebuilt_rules/prebuilt_rules_preview.cy.ts#L1182)\r\nthat
checks that such switching is possible and this test started to\r\nfail
once I reactivated the test file.\r\n- Fixed selectors that grab filters
in the Overview tab. The old ones\r\nstopped working. Probably because
of a change to the filters component\r\nthat is built by another
team.\r\n\r\n\r\n#### Correct behaviour: Switching between rules with
flyout
open\r\n\r\nhttps://github.com/user-attachments/assets/da4a0902-657c-45fe-adc1-eb44ad0de798","sha":"c65c2ae4900a9f75db872cee056af35ff5f79cdc"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Nikita Indik <nikita.indik@elastic.co>
markov00 pushed a commit to markov00/kibana that referenced this pull request Sep 18, 2024
… in CI (elastic#191978)

**Resolves: elastic#192256

## Summary

This PR re-enables two Cypress test files that didn't run on CI:
`update_workflow.cy.ts` and `prebuilt_rules_preview.cy.ts`. It also
fixes failing tests in `prebuilt_rules_preview.cy.ts`.

### Changes
- Renamed `update_workflow.ts` -> `update_workflow.cy.ts`. It didn't run
on CI because it wasn't picked up by a glob
[here](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/package.json#L14).
 - `prebuilt_rules_preview.cy.ts`:
- Moved `{ tags: ['@ess', '@serverless'] }` to the top-level `describe`
block instead of having it in a variable that is used in every
`describe`. Apparently the tool we use to parse tags doesn't recognize
tags in variables anymore, so this test didn't run in either ESS or
Serverless pipelines.
- Removed `describe('All environments' ... ` wrappers since they don't
add any value anymore. Didn't remove any actual tests.
- Reverted a change from this
[PR](elastic#181427) that added a
backdrop to the modal which doesn't allow user to switch rules without
closing the modal. We have a
[test](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/rule_management/prebuilt_rules/prebuilt_rules_preview.cy.ts#L1182)
that checks that such switching is possible and this test started to
fail once I reactivated the test file.
- Fixed selectors that grab filters in the Overview tab. The old ones
stopped working. Probably because of a change to the filters component
that is built by another team.


#### Correct behaviour: Switching between rules with flyout open

https://github.com/user-attachments/assets/da4a0902-657c-45fe-adc1-eb44ad0de798
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-major Backport to (8.x, 8.15) the previous major branch and all later branches still in development release_note:skip Skip the PR/issue when compiling release notes Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.15.2 v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Security Solution] Some Prebuilt Rules Cypress tests don't run in CI
7 participants