Skip to content

Commit

Permalink
[Security Solution][Rule Management] Getting rid off before hook if i…
Browse files Browse the repository at this point in the history
…s not loading an archive (#178891)

## Summary

Addresses: #175022

Update:
[Flaky test suite runner passed
successfully](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/5522)
  • Loading branch information
MadameSheema committed Mar 25, 2024
1 parent 6defb37 commit 6f49ab8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ import {
} from '../../../../tasks/common/callouts';
import { login } from '../../../../tasks/login';
import { visitRulesManagementTable } from '../../../../tasks/rules_management';
import { deleteAlertsAndRules } from '../../../../tasks/api_calls/common';

// TODO: https://github.com/elastic/kibana/issues/164451 We should find a way to make this spec work in Serverless
// TODO: https://github.com/elastic/kibana/issues/161540
describe('All rules - read only', { tags: ['@ess', '@serverless', '@skipInServerless'] }, () => {
before(() => {
createRule(getNewRule({ rule_id: '1', enabled: false }));
});

beforeEach(() => {
deleteAlertsAndRules();
createRule(getNewRule({ rule_id: '1', enabled: false }));
login(ROLES.t1_analyst);
visitRulesManagementTable();
cy.get(RULE_NAME).should('have.text', getNewRule().name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,20 +238,17 @@ describe('Related integrations', { tags: ['@ess', '@serverless', '@brokenInServe
});

describe('related Integrations Advanced Setting is disabled', () => {
before(() => {
disableRelatedIntegrations();
});

after(() => {
enableRelatedIntegrations();
});

describe('rules management table', () => {
beforeEach(() => {
disableRelatedIntegrations();
visitRulesManagementTable();
disableAutoRefresh();
});

afterEach(() => {
enableRelatedIntegrations();
});

it('should not display a badge with the installed integrations', () => {
cy.get(RULE_NAME).should('have.text', PREBUILT_RULE_NAME);
cy.get(INTEGRATION_LINK).should('not.exist');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,21 @@ import { login } from '../../../../tasks/login';

import { createRule } from '../../../../tasks/api_calls/rules';
import { getNewRule } from '../../../../objects/rule';
import { deleteAlertsAndRules } from '../../../../tasks/api_calls/common';

const RULES_TABLE_REFRESH_INTERVAL_MS = 60000;

describe('Rules table: auto-refresh', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
beforeEach(() => {
login();
deleteAlertsAndRules();
setRulesTableAutoRefreshIntervalSetting({
enabled: true,
refreshInterval: RULES_TABLE_REFRESH_INTERVAL_MS,
});
createRule(getNewRule({ name: 'Test rule 1', rule_id: '1', enabled: false }));
});

beforeEach(() => {
login();
});

it('gets deactivated when any rule selected and activated after rules unselected', () => {
visitRulesManagementTable();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
setRowsPerPageTo,
sortByTableColumn,
} from '../../../../tasks/table_pagination';
import { deleteAlertsAndRules } from '../../../../tasks/api_calls/common';

function createTestRules(): void {
createRule(getNewRule({ rule_id: '1', name: 'test 1', tags: ['tag-a'], enabled: false }));
Expand Down Expand Up @@ -96,11 +97,9 @@ function expectDefaultRulesTableState(): void {
}

describe('Rules table: persistent state', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
createTestRules();
});

beforeEach(() => {
deleteAlertsAndRules();
createTestRules();
login();
resetRulesTableState();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,18 @@ import {
sortByTableColumn,
} from '../../../../tasks/table_pagination';
import { TABLE_FIRST_PAGE, TABLE_SECOND_PAGE } from '../../../../screens/table_pagination';
import { deleteAlertsAndRules } from '../../../../tasks/api_calls/common';

describe('Rules table: sorting', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
beforeEach(() => {
login();
deleteAlertsAndRules();
createRule(getNewRule({ rule_id: '1', enabled: false }));
createRule(getExistingRule({ rule_id: '2', enabled: false }));
createRule(getNewOverrideRule({ rule_id: '3', enabled: false }));
createRule(getNewThresholdRule({ rule_id: '4', enabled: false }));
});

beforeEach(() => {
login();
});

it('Sorts by enabled rules', () => {
visit(RULES_MANAGEMENT_URL);

Expand Down

0 comments on commit 6f49ab8

Please sign in to comment.