Skip to content

Commit

Permalink
[8.10] [Security Solution] Fix flakiness in: `prebuilt_rules_manageme…
Browse files Browse the repository at this point in the history
…nt.cy.ts` - Deletes and recovers more than one rule (#164694) (#164961)

# Backport

This will backport the following commits from `main` to `8.10`:
- [[Security Solution] Fix flakiness in:
`prebuilt_rules_management.cy.ts` - Deletes and recovers more than one
rule (#164694)](#164694)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Juan Pablo
Djeredjian","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-08-28T11:02:22Z","message":"[Security
Solution] Fix flakiness in: `prebuilt_rules_management.cy.ts` - Deletes
and recovers more than one rule (#164694)\n\nRelates to:
https://github.com/elastic/kibana/issues/161507\r\n\r\n##
Summary\r\n\r\n- Solves flakiness in following test:\r\n-
Filename:\r\n`x-pack/test/security_solution_cypress/cypress/e2e/detection_response/prebuilt_rules/prebuilt_rules_management.cy.ts`\r\n-
Test name: **Prebuilt rules Actions with prebuilt rules Rules
table\r\nDeletes and recovers more than one rule**\r\n\r\n- Test was
failing because of already observed issue of `autoRefresh`\r\ntaking
place while the rule selection is happening, causing Cypress to\r\nlose
focus and preventing the checkbox from being checked. This
PR\r\ndisables autorefresh from the table to prevent that from
happening.\r\n\r\n## Flaky test runner\r\n\r\n350
iters:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2976\r\n🟢","sha":"e22f9b860e6d62ddcaacae6a1b2f57178afa8e54","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["test","release_note:skip","Team:Detections
and Resp","Team: SecuritySolution","Feature:Rule
Management","Team:Detection Rule
Management","v8.10.0","v8.11.0"],"number":164694,"url":"https://github.com/elastic/kibana/pull/164694","mergeCommit":{"message":"[Security
Solution] Fix flakiness in: `prebuilt_rules_management.cy.ts` - Deletes
and recovers more than one rule (#164694)\n\nRelates to:
https://github.com/elastic/kibana/issues/161507\r\n\r\n##
Summary\r\n\r\n- Solves flakiness in following test:\r\n-
Filename:\r\n`x-pack/test/security_solution_cypress/cypress/e2e/detection_response/prebuilt_rules/prebuilt_rules_management.cy.ts`\r\n-
Test name: **Prebuilt rules Actions with prebuilt rules Rules
table\r\nDeletes and recovers more than one rule**\r\n\r\n- Test was
failing because of already observed issue of `autoRefresh`\r\ntaking
place while the rule selection is happening, causing Cypress to\r\nlose
focus and preventing the checkbox from being checked. This
PR\r\ndisables autorefresh from the table to prevent that from
happening.\r\n\r\n## Flaky test runner\r\n\r\n350
iters:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2976\r\n🟢","sha":"e22f9b860e6d62ddcaacae6a1b2f57178afa8e54"}},"sourceBranch":"main","suggestedTargetBranches":["8.10"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/164694","number":164694,"mergeCommit":{"message":"[Security
Solution] Fix flakiness in: `prebuilt_rules_management.cy.ts` - Deletes
and recovers more than one rule (#164694)\n\nRelates to:
https://github.com/elastic/kibana/issues/161507\r\n\r\n##
Summary\r\n\r\n- Solves flakiness in following test:\r\n-
Filename:\r\n`x-pack/test/security_solution_cypress/cypress/e2e/detection_response/prebuilt_rules/prebuilt_rules_management.cy.ts`\r\n-
Test name: **Prebuilt rules Actions with prebuilt rules Rules
table\r\nDeletes and recovers more than one rule**\r\n\r\n- Test was
failing because of already observed issue of `autoRefresh`\r\ntaking
place while the rule selection is happening, causing Cypress to\r\nlose
focus and preventing the checkbox from being checked. This
PR\r\ndisables autorefresh from the table to prevent that from
happening.\r\n\r\n## Flaky test runner\r\n\r\n350
iters:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2976\r\n🟢","sha":"e22f9b860e6d62ddcaacae6a1b2f57178afa8e54"}}]}]
BACKPORT-->

Co-authored-by: Juan Pablo Djeredjian <[email protected]>
  • Loading branch information
kibanamachine and jpdjere authored Aug 28, 2023
1 parent f463db3 commit 41f48a6
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
} from '../../../screens/alerts_detection_rules';
import {
deleteFirstRule,
disableAutoRefresh,
getRulesManagementTableRows,
selectAllRules,
selectRulesByName,
Expand All @@ -34,6 +35,7 @@ import {
import {
createAndInstallMockedPrebuiltRules,
getAvailablePrebuiltRulesCount,
preventPrebuiltRulesPackageInstallation,
} from '../../../tasks/api_calls/prebuilt_rules';
import {
cleanKibana,
Expand All @@ -59,10 +61,12 @@ describe('Prebuilt rules', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
login();
deleteAlertsAndRules();
deletePrebuiltRulesAssets();
preventPrebuiltRulesPackageInstallation();
visitWithoutDateRange(DETECTIONS_RULE_MANAGEMENT_URL);
createAndInstallMockedPrebuiltRules({ rules });
cy.reload();
waitForPrebuiltDetectionRulesToBeLoaded();
disableAutoRefresh();
});

describe('Alerts rules, prebuilt rules', () => {
Expand Down

0 comments on commit 41f48a6

Please sign in to comment.