Skip to content

Commit

Permalink
[8.x] [Security Solution] Fix some Prebuilt Rules Cypress tests not r…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
kibanamachine and nikitaindik committed Sep 13, 2024
1 parent 96c88df commit 25d19b0
Show file tree
Hide file tree
Showing 5 changed files with 643 additions and 680 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -631,13 +631,9 @@ Given no prebuilt rules are installed in Kibana
And there are X prebuilt rules of all types available to install
When user opens the Add Rules page
Then all X rules available for installation should be displayed in the table
When user opens the rule preview for the 1st rule
Then the preview should open
And all properties of the 1st rule should be displayed in the correct tab and section of the preview (see examples of rule properties above)
When user selects the 2nd rule in the table
Then the preview should be updated
And all properties of the 2nd rule should be displayed in the correct tab and section of the preview (see examples of rule properties above)
And user should be able to repeat this for all X rules
When user opens a rule preview for any rule
Then the preview should appear
And all properties of a rule should be displayed in the correct tab and section of the preview (see examples of rule properties above)
```

#### **Scenario: Tabs and sections without content should be hidden in preview before installing**
Expand Down Expand Up @@ -783,15 +779,11 @@ And for all of the installed rules there are new versions available
And user is on the Rule Management page
When user opens the Rule Updates table
Then all X rules available for upgrade should be displayed in the table
When user opens the rule preview for the 1st rule
Then the preview should open
When user opens a rule preview for any rule
Then the preview should appear
And the "Updates" tab should be active
When user selects the "Overview" tab
Then all properties of the new version of the 1st rule should be displayed in the correct tab and section of the preview (see examples of rule properties above)
When user selects the 2nd rule in the table
Then the preview should be updated
And all properties of the new version of the 2nd rule should be displayed in the correct tab and section of the preview (see examples of rule properties above)
And user should be able to repeat this for all X rules
Then all properties of the new version of a rule should be displayed in the correct tab and section of the preview (see examples of rule properties above)
```

#### **Scenario: Tabs and sections without content should be hidden in preview before upgrading**
Expand Down
Loading

0 comments on commit 25d19b0

Please sign in to comment.