[8.10] [Security Solution] Fix bulk edit rules tests (#164692) (#164917)

# Backport

This will backport the following commits from `main` to `8.10`:
- [[Security Solution] Fix bulk edit rules tests
(#164692)](https://github.com/elastic/kibana/pull/164692)

<!--- Backport version: 8.9.8 -->

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

<!--BACKPORT [{"author":{"name":"Maxim
Palenov","email":"maxim.palenov@elastic.co"},"sourceCommit":{"committedDate":"2023-08-25T13:26:47Z","message":"[Security
Solution] Fix bulk edit rules tests (#164692)\n\n**Relates to:**
https://github.com/elastic/kibana/issues/161507\r\n\r\n##
Summary\r\n\r\nThis PR fixes **bulk_edit_rules.cy.ts** flakiness found
while running Security Solution Cypress tests in Flaky test runner ([run
1](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2969)
and [run
2](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2970)).\r\n\r\n##
Flaky test runner\r\n\r\n[bulk_edit_rules.cy.ts 300
runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2975)
🟢","sha":"6ab3aa3da1a3d1ed37b711efb9891cae43c0da39","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":164692,"url":"https://github.com/elastic/kibana/pull/164692","mergeCommit":{"message":"[Security
Solution] Fix bulk edit rules tests (#164692)\n\n**Relates to:**
https://github.com/elastic/kibana/issues/161507\r\n\r\n##
Summary\r\n\r\nThis PR fixes **bulk_edit_rules.cy.ts** flakiness found
while running Security Solution Cypress tests in Flaky test runner ([run
1](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2969)
and [run
2](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2970)).\r\n\r\n##
Flaky test runner\r\n\r\n[bulk_edit_rules.cy.ts 300
runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2975)
🟢","sha":"6ab3aa3da1a3d1ed37b711efb9891cae43c0da39"}},"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/164692","number":164692,"mergeCommit":{"message":"[Security
Solution] Fix bulk edit rules tests (#164692)\n\n**Relates to:**
https://github.com/elastic/kibana/issues/161507\r\n\r\n##
Summary\r\n\r\nThis PR fixes **bulk_edit_rules.cy.ts** flakiness found
while running Security Solution Cypress tests in Flaky test runner ([run
1](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2969)
and [run
2](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2970)).\r\n\r\n##
Flaky test runner\r\n\r\n[bulk_edit_rules.cy.ts 300
runs](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2975)
🟢","sha":"6ab3aa3da1a3d1ed37b711efb9891cae43c0da39"}}]}] BACKPORT-->

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Maxim Palenov 2023-08-26 19:27:04 +02:00 committed by GitHub
parent cae621d550
commit 83b33f2c40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -96,6 +96,7 @@ import {
import {
createAndInstallMockedPrebuiltRules,
getAvailablePrebuiltRulesCount,
preventPrebuiltRulesPackageInstallation,
} from '../../../../../tasks/api_calls/prebuilt_rules';
import { setRowsPerPageTo, sortByTableColumn } from '../../../../../tasks/table_pagination';
@ -123,6 +124,7 @@ describe('Detection rules, bulk edit', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLES
// Make sure persisted rules table state is cleared
resetRulesTableState();
deleteAlertsAndRules();
preventPrebuiltRulesPackageInstallation(); // Make sure prebuilt rules aren't pulled from Fleet API
cy.task('esArchiverResetKibana');
createRule(getNewRule({ name: RULE_NAME, ...defaultRuleData, rule_id: '1', enabled: false }));
createRule(
@ -233,9 +235,7 @@ describe('Detection rules, bulk edit', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLES
clickAddTagsMenuItem();
waitForMixedRulesBulkEditModal(rows.length);
getAvailablePrebuiltRulesCount().then((availablePrebuiltRulesCount) => {
checkPrebuiltRulesCannotBeModified(availablePrebuiltRulesCount);
});
checkPrebuiltRulesCannotBeModified(PREBUILT_RULES.length);
// user cancels action and modal disappears
cancelConfirmationModal();