Skip to content

Commit

Permalink
[Security Solution] Unskip bulk actions Cypress tests (elastic#174365)
Browse files Browse the repository at this point in the history
## Summary

**Resolves: elastic#171101

200 runs of bulk_edit_rules_actions.cy.ts in ESS env: [*Buildkite
4776*](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4776)
200 runs of bulk_edit_rules_actions.cy.ts in Serverless env: [*Buildkite
4777*](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4777)

All tests were green except a couple tests that stopped abruptly mid-way
because of CI runner timeouts. So there weren't failed tests.

Two issues were causing fails:
1. `"hunter_no_actions"` role that was used in "User with no privileges
can't add rule actions" test doesn't exist in Serverless env. Changed it
to `"t1_analyst"` – it exists in both ESS and Serverless and doesn't
give permission to edit rules.
2. Race condition caused by disabled auto-refresh
- In the `beforeAll` hook the auto-refresh is disabled for the Rule
Management page.
- Then `excessivelyInstallAllPrebuiltRules` is called, which installs
all 1000+ prebuilt rules (only in Serverless, because ESS has 0 prebuilt
rules available to install).
- While the installation is in progress the Rule Management page loads
and displays 9 rules.
- Then the test selects all rules (9) and executes a bulk update on
them.
- Once the bulk action succeeds, the user sees a toast with "1000+
actions have been updated" while the test expects "9 actions have been
updated" because of disabled auto-refresh.
- I decided to skip installing all the Elastic prebuilt rules because
the operation is very heavy and we check that bulk actions work for
prebuilt rules anyways since two test prebuilt rules are created and
installed in beforeAll.
  • Loading branch information
nikitaindik authored and delanni committed Jan 11, 2024
1 parent fc29532 commit 7ee34c7
Showing 1 changed file with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { createRuleAssetSavedObject } from '../../../../../helpers/rules';
import {
RULES_BULK_EDIT_ACTIONS_INFO,
RULES_BULK_EDIT_ACTIONS_WARNING,
ADD_RULE_ACTIONS_MENU_ITEM,
BULK_ACTIONS_BTN,
} from '../../../../../screens/rules_bulk_actions';
import { actionFormSelector } from '../../../../../screens/common/rule_actions';

Expand Down Expand Up @@ -47,7 +47,6 @@ import {
submitBulkEditForm,
checkOverwriteRuleActionsCheckbox,
openBulkEditRuleActionsForm,
openBulkActionsMenu,
} from '../../../../../tasks/rules_bulk_actions';
import { login } from '../../../../../tasks/login';
import { visitRulesManagementTable } from '../../../../../tasks/rules_management';
Expand All @@ -65,7 +64,6 @@ import {
} from '../../../../../objects/rule';
import {
createAndInstallMockedPrebuiltRules,
excessivelyInstallAllPrebuiltRules,
preventPrebuiltRulesPackageInstallation,
} from '../../../../../tasks/api_calls/prebuilt_rules';

Expand All @@ -74,10 +72,9 @@ const ruleNameToAssert = 'Custom rule name with actions';
const expectedExistingSlackMessage = 'Existing slack action';
const expectedSlackMessage = 'Slack action test message';

// TODO: Fix and unskip in Serverless https://github.com/elastic/kibana/issues/171101
describe(
'Detection rules, bulk edit of rule actions',
{ tags: ['@ess', '@serverless', '@brokenInServerless', '@brokenInServerlessQA'] },
{ tags: ['@ess', '@serverless', '@brokenInServerlessQA'] },
() => {
beforeEach(() => {
login();
Expand Down Expand Up @@ -148,7 +145,7 @@ describe(

context('Restricted action privileges', () => {
it("User with no privileges can't add rule actions", () => {
login(ROLES.hunter_no_actions);
login(ROLES.t1_analyst);
visitRulesManagementTable();

expectManagementTableRules([
Expand All @@ -164,11 +161,7 @@ describe(
]);
waitForCallOutToBeShown(MISSING_PRIVILEGES_CALLOUT, 'primary');

selectAllRules();

openBulkActionsMenu();

cy.get(ADD_RULE_ACTIONS_MENU_ITEM).should('be.disabled');
cy.get(BULK_ACTIONS_BTN).should('not.exist');
});
});

Expand Down Expand Up @@ -197,8 +190,6 @@ describe(
throttleUnit: 'd',
};

excessivelyInstallAllPrebuiltRules();

getRulesManagementTableRows().then((rows) => {
// select both custom and prebuilt rules
selectAllRules();
Expand Down Expand Up @@ -227,8 +218,6 @@ describe(
});

it('Overwrite rule actions in rules', () => {
excessivelyInstallAllPrebuiltRules();

getRulesManagementTableRows().then((rows) => {
// select both custom and prebuilt rules
selectAllRules();
Expand Down

0 comments on commit 7ee34c7

Please sign in to comment.