Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution] Enable Serverless for exceptions/entry and exceptions/rule_details_flow Cypress tests #169211

Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,9 @@ import {

import { deleteAlertsAndRules } from '../../../tasks/common';

// TODO: https://github.com/elastic/kibana/issues/161539
// FLAKY: https://github.com/elastic/kibana/issues/165651
// FLAKY: https://github.com/elastic/kibana/issues/165734
// FLAKY: https://github.com/elastic/kibana/issues/165652
describe(
'Add multiple conditions and validate the generated exceptions',
{ tags: ['@ess', '@serverless', '@skipInServerless'] },
{ tags: ['@ess', '@serverless'] },
() => {
beforeEach(() => {
cy.task('esArchiverResetKibana');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,72 +47,66 @@ const goToRulesAndOpenValueListModal = () => {
openValueListsModal();
};

// TODO: https://github.com/elastic/kibana/issues/161539
// Flaky on serverless
describe(
'Use Value list in exception entry',
{ tags: ['@ess', '@serverless', '@skipInServerless'] },
() => {
beforeEach(() => {
cleanKibana();
login();
createListsIndex();
cy.task('esArchiverLoad', { archiveName: 'exceptions' });
importValueList(KNOWN_VALUE_LIST_FILES.TEXT, 'keyword');

createRule(
getNewRule({
query: 'user.name:*',
index: ['exceptions*'],
exceptions_list: [],
rule_id: '2',
enabled: false,
})
).then((rule) => visitRuleDetailsPage(rule.body.id, { tab: 'rule_exceptions' }));
});

afterEach(() => {
cy.task('esArchiverUnload', 'exceptions');
});

it('Should use value list in exception entry, and validate deleting value list prompt', () => {
const ITEM_NAME = 'Exception item with value list';
const ITEM_FIELD = 'agent.name';

// open add exception modal
openExceptionFlyoutFromEmptyViewerPrompt();

// add exception item name
addExceptionFlyoutItemName(ITEM_NAME);

addExceptionEntryFieldValue(ITEM_FIELD, 0);
addExceptionEntryOperatorValue('is in list', 0);

addExceptionEntryFieldMatchIncludedValue(KNOWN_VALUE_LIST_FILES.TEXT, 0);

// The Close all alerts that match attributes in this exception option is disabled
cy.get(CLOSE_ALERTS_CHECKBOX).should('exist');
cy.get(CLOSE_ALERTS_CHECKBOX).should('have.attr', 'disabled');

// Create exception
submitNewExceptionItem();

// displays existing exception items
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 1);
cy.get(NO_EXCEPTIONS_EXIST_PROMPT).should('not.exist');
cy.get(EXCEPTION_CARD_ITEM_NAME).should('have.text', ITEM_NAME);
cy.get(EXCEPTION_CARD_ITEM_CONDITIONS).should(
'have.text',
` ${ITEM_FIELD}included in value_list.txt`
);

// Go back to value list to delete the existing one
goToRulesAndOpenValueListModal();

deleteValueListsFile(KNOWN_VALUE_LIST_FILES.TEXT);

// Toast should be shown because of exception reference
cy.get(EXCEPTIONS_TABLE_MODAL).should('exist');
});
}
);
describe('Use Value list in exception entry', { tags: ['@ess', '@serverless'] }, () => {
beforeEach(() => {
cleanKibana();
login();
createListsIndex();
cy.task('esArchiverLoad', { archiveName: 'exceptions' });
importValueList(KNOWN_VALUE_LIST_FILES.TEXT, 'keyword');

createRule(
getNewRule({
query: 'user.name:*',
index: ['exceptions*'],
exceptions_list: [],
rule_id: '2',
enabled: false,
})
).then((rule) => visitRuleDetailsPage(rule.body.id, { tab: 'rule_exceptions' }));
});

afterEach(() => {
cy.task('esArchiverUnload', 'exceptions');
});

it('Should use value list in exception entry, and validate deleting value list prompt', () => {
const ITEM_NAME = 'Exception item with value list';
const ITEM_FIELD = 'agent.name';

// open add exception modal
openExceptionFlyoutFromEmptyViewerPrompt();

// add exception item name
addExceptionFlyoutItemName(ITEM_NAME);

addExceptionEntryFieldValue(ITEM_FIELD, 0);
addExceptionEntryOperatorValue('is in list', 0);

addExceptionEntryFieldMatchIncludedValue(KNOWN_VALUE_LIST_FILES.TEXT, 0);

// The Close all alerts that match attributes in this exception option is disabled
cy.get(CLOSE_ALERTS_CHECKBOX).should('exist');
cy.get(CLOSE_ALERTS_CHECKBOX).should('have.attr', 'disabled');

// Create exception
submitNewExceptionItem();

// displays existing exception items
cy.get(EXCEPTION_ITEM_VIEWER_CONTAINER).should('have.length', 1);
cy.get(NO_EXCEPTIONS_EXIST_PROMPT).should('not.exist');
cy.get(EXCEPTION_CARD_ITEM_NAME).should('have.text', ITEM_NAME);
cy.get(EXCEPTION_CARD_ITEM_CONDITIONS).should(
'have.text',
` ${ITEM_FIELD}included in value_list.txt`
);

// Go back to value list to delete the existing one
goToRulesAndOpenValueListModal();

deleteValueListsFile(KNOWN_VALUE_LIST_FILES.TEXT);

// Toast should be shown because of exception reference
cy.get(EXCEPTIONS_TABLE_MODAL).should('exist');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import {
} from '../../../tasks/api_calls/exceptions';

// TODO: https://github.com/elastic/kibana/issues/161539
// FLAKY: https://github.com/elastic/kibana/issues/165736
describe(
'Add endpoint exception from rule details',
{ tags: ['@ess', '@serverless', '@brokenInServerless'] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ import {
deleteExceptionList,
} from '../../../tasks/api_calls/exceptions';

// TODO: https://github.com/elastic/kibana/issues/161539 Do we need this to run in Serverless?
describe('Exceptions viewer read only', { tags: ['@ess', '@skipInServerless'] }, () => {
describe('Exceptions viewer read only', { tags: ['@ess'] }, () => {
const exceptionList = getExceptionList();

beforeEach(() => {
Expand Down