mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
skip failing test suite (#212743)
This commit is contained in:
parent
44f072bbe5
commit
7f8a05f061
1 changed files with 113 additions and 108 deletions
|
@ -79,124 +79,129 @@ import { fillAddFilterForm } from '../../../../tasks/search_bar';
|
|||
import { CREATE_RULE_URL } from '../../../../urls/navigation';
|
||||
|
||||
// Skipping in MKI due to flake
|
||||
describe('Custom query rules', { tags: ['@ess', '@serverless', '@skipInServerlessMKI'] }, () => {
|
||||
describe('Custom detection rules creation with data views', () => {
|
||||
const rule = getDataViewRule();
|
||||
const expectedUrls = rule.references?.join('');
|
||||
const expectedFalsePositives = rule.false_positives?.join('');
|
||||
const expectedTags = rule.tags?.join('');
|
||||
const mitreAttack = rule.threat;
|
||||
const expectedMitre = formatMitreAttackDescription(mitreAttack ?? []);
|
||||
const expectedNumberOfRules = 1;
|
||||
// Failing: See https://github.com/elastic/kibana/issues/212743
|
||||
describe.skip(
|
||||
'Custom query rules',
|
||||
{ tags: ['@ess', '@serverless', '@skipInServerlessMKI'] },
|
||||
() => {
|
||||
describe('Custom detection rules creation with data views', () => {
|
||||
const rule = getDataViewRule();
|
||||
const expectedUrls = rule.references?.join('');
|
||||
const expectedFalsePositives = rule.false_positives?.join('');
|
||||
const expectedTags = rule.tags?.join('');
|
||||
const mitreAttack = rule.threat;
|
||||
const expectedMitre = formatMitreAttackDescription(mitreAttack ?? []);
|
||||
const expectedNumberOfRules = 1;
|
||||
|
||||
beforeEach(() => {
|
||||
if (rule.data_view_id != null) {
|
||||
postDataView(rule.data_view_id);
|
||||
}
|
||||
deleteAlertsAndRules();
|
||||
login();
|
||||
});
|
||||
beforeEach(() => {
|
||||
if (rule.data_view_id != null) {
|
||||
postDataView(rule.data_view_id);
|
||||
}
|
||||
deleteAlertsAndRules();
|
||||
login();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (rule.data_view_id != null) {
|
||||
deleteDataView(rule.data_view_id);
|
||||
}
|
||||
});
|
||||
afterEach(() => {
|
||||
if (rule.data_view_id != null) {
|
||||
deleteDataView(rule.data_view_id);
|
||||
}
|
||||
});
|
||||
|
||||
it('Creates and enables a new rule', function () {
|
||||
visit(CREATE_RULE_URL);
|
||||
fillDefineCustomRuleAndContinue(rule);
|
||||
fillAboutRuleAndContinue(rule);
|
||||
fillScheduleRuleAndContinue(rule);
|
||||
createAndEnableRule();
|
||||
openRuleManagementPageViaBreadcrumbs();
|
||||
it('Creates and enables a new rule', function () {
|
||||
visit(CREATE_RULE_URL);
|
||||
fillDefineCustomRuleAndContinue(rule);
|
||||
fillAboutRuleAndContinue(rule);
|
||||
fillScheduleRuleAndContinue(rule);
|
||||
createAndEnableRule();
|
||||
openRuleManagementPageViaBreadcrumbs();
|
||||
|
||||
cy.get(CUSTOM_RULES_BTN).should('have.text', 'Custom rules (1)');
|
||||
cy.get(CUSTOM_RULES_BTN).should('have.text', 'Custom rules (1)');
|
||||
|
||||
getRulesManagementTableRows().should('have.length', expectedNumberOfRules);
|
||||
cy.get(RULE_NAME).should('have.text', rule.name);
|
||||
cy.get(RISK_SCORE).should('have.text', rule.risk_score);
|
||||
cy.get(SEVERITY).should('have.text', 'High');
|
||||
cy.get(RULE_SWITCH).should('have.attr', 'aria-checked', 'true');
|
||||
getRulesManagementTableRows().should('have.length', expectedNumberOfRules);
|
||||
cy.get(RULE_NAME).should('have.text', rule.name);
|
||||
cy.get(RISK_SCORE).should('have.text', rule.risk_score);
|
||||
cy.get(SEVERITY).should('have.text', 'High');
|
||||
cy.get(RULE_SWITCH).should('have.attr', 'aria-checked', 'true');
|
||||
|
||||
goToRuleDetailsOf(rule.name);
|
||||
goToRuleDetailsOf(rule.name);
|
||||
|
||||
cy.get(RULE_NAME_HEADER).should('contain', `${rule.name}`);
|
||||
cy.get(ABOUT_RULE_DESCRIPTION).should('have.text', rule.description);
|
||||
cy.get(ABOUT_DETAILS).within(() => {
|
||||
getDetails(SEVERITY_DETAILS).should('have.text', 'High');
|
||||
getDetails(RISK_SCORE_DETAILS).should('have.text', rule.risk_score);
|
||||
getDetails(REFERENCE_URLS_DETAILS).should((details) => {
|
||||
expect(removeExternalLinkText(details.text())).equal(expectedUrls);
|
||||
cy.get(RULE_NAME_HEADER).should('contain', `${rule.name}`);
|
||||
cy.get(ABOUT_RULE_DESCRIPTION).should('have.text', rule.description);
|
||||
cy.get(ABOUT_DETAILS).within(() => {
|
||||
getDetails(SEVERITY_DETAILS).should('have.text', 'High');
|
||||
getDetails(RISK_SCORE_DETAILS).should('have.text', rule.risk_score);
|
||||
getDetails(REFERENCE_URLS_DETAILS).should((details) => {
|
||||
expect(removeExternalLinkText(details.text())).equal(expectedUrls);
|
||||
});
|
||||
getDetails(FALSE_POSITIVES_DETAILS).should('have.text', expectedFalsePositives);
|
||||
getDetails(MITRE_ATTACK_DETAILS).should((mitre) => {
|
||||
expect(removeExternalLinkText(mitre.text())).equal(expectedMitre);
|
||||
});
|
||||
getDetails(TAGS_DETAILS).should('have.text', expectedTags);
|
||||
});
|
||||
getDetails(FALSE_POSITIVES_DETAILS).should('have.text', expectedFalsePositives);
|
||||
getDetails(MITRE_ATTACK_DETAILS).should((mitre) => {
|
||||
expect(removeExternalLinkText(mitre.text())).equal(expectedMitre);
|
||||
cy.get(INVESTIGATION_NOTES_TOGGLE).click();
|
||||
cy.get(ABOUT_INVESTIGATION_NOTES).should('have.text', INVESTIGATION_NOTES_MARKDOWN);
|
||||
cy.get(DEFINITION_DETAILS).within(() => {
|
||||
getDetails(DATA_VIEW_DETAILS).should('have.text', rule.data_view_id);
|
||||
getDetails(CUSTOM_QUERY_DETAILS).should('have.text', rule.query);
|
||||
getDetails(RULE_TYPE_DETAILS).should('have.text', 'Query');
|
||||
getDetails(TIMELINE_TEMPLATE_DETAILS).should('have.text', 'None');
|
||||
});
|
||||
getDetails(TAGS_DETAILS).should('have.text', expectedTags);
|
||||
});
|
||||
cy.get(INVESTIGATION_NOTES_TOGGLE).click();
|
||||
cy.get(ABOUT_INVESTIGATION_NOTES).should('have.text', INVESTIGATION_NOTES_MARKDOWN);
|
||||
cy.get(DEFINITION_DETAILS).within(() => {
|
||||
getDetails(DATA_VIEW_DETAILS).should('have.text', rule.data_view_id);
|
||||
getDetails(CUSTOM_QUERY_DETAILS).should('have.text', rule.query);
|
||||
getDetails(RULE_TYPE_DETAILS).should('have.text', 'Query');
|
||||
getDetails(TIMELINE_TEMPLATE_DETAILS).should('have.text', 'None');
|
||||
});
|
||||
cy.get(DEFINITION_DETAILS).should('not.contain', INDEX_PATTERNS_DETAILS);
|
||||
cy.get(SCHEDULE_DETAILS).within(() => {
|
||||
getDetails(RUNS_EVERY_DETAILS)
|
||||
.find(INTERVAL_ABBR_VALUE)
|
||||
.should('have.text', `${rule.interval}`);
|
||||
const humanizedDuration = getHumanizedDuration(
|
||||
rule.from ?? 'now-6m',
|
||||
rule.interval ?? '5m'
|
||||
);
|
||||
getDetails(ADDITIONAL_LOOK_BACK_DETAILS)
|
||||
.find(INTERVAL_ABBR_VALUE)
|
||||
.should('have.text', `${humanizedDuration}`);
|
||||
cy.get(DEFINITION_DETAILS).should('not.contain', INDEX_PATTERNS_DETAILS);
|
||||
cy.get(SCHEDULE_DETAILS).within(() => {
|
||||
getDetails(RUNS_EVERY_DETAILS)
|
||||
.find(INTERVAL_ABBR_VALUE)
|
||||
.should('have.text', `${rule.interval}`);
|
||||
const humanizedDuration = getHumanizedDuration(
|
||||
rule.from ?? 'now-6m',
|
||||
rule.interval ?? '5m'
|
||||
);
|
||||
getDetails(ADDITIONAL_LOOK_BACK_DETAILS)
|
||||
.find(INTERVAL_ABBR_VALUE)
|
||||
.should('have.text', `${humanizedDuration}`);
|
||||
});
|
||||
|
||||
waitForTheRuleToBeExecuted();
|
||||
waitForAlertsToPopulate();
|
||||
|
||||
cy.get(ALERTS_COUNT)
|
||||
.invoke('text')
|
||||
.should('match', /^[1-9].+$/);
|
||||
cy.get(ALERT_GRID_CELL).contains(rule.name);
|
||||
});
|
||||
|
||||
waitForTheRuleToBeExecuted();
|
||||
waitForAlertsToPopulate();
|
||||
it('Creates and edits a new rule with a data view', function () {
|
||||
visit(CREATE_RULE_URL);
|
||||
fillDefineCustomRuleAndContinue(rule);
|
||||
cy.get(RULE_NAME_INPUT).clear();
|
||||
cy.get(RULE_NAME_INPUT).type(rule.name);
|
||||
cy.get(RULE_DESCRIPTION_INPUT).clear();
|
||||
cy.get(RULE_DESCRIPTION_INPUT).type(rule.description);
|
||||
|
||||
cy.get(ALERTS_COUNT)
|
||||
.invoke('text')
|
||||
.should('match', /^[1-9].+$/);
|
||||
cy.get(ALERT_GRID_CELL).contains(rule.name);
|
||||
cy.get(ABOUT_CONTINUE_BTN).should('exist').click();
|
||||
|
||||
fillScheduleRuleAndContinue(rule);
|
||||
createRuleWithoutEnabling();
|
||||
openRuleManagementPageViaBreadcrumbs();
|
||||
|
||||
goToRuleDetailsOf(rule.name);
|
||||
|
||||
cy.get(EDIT_RULE_SETTINGS_LINK).click();
|
||||
|
||||
cy.get(RULE_NAME_HEADER).should('contain', 'Edit rule settings');
|
||||
});
|
||||
|
||||
it('Adds filter on define step', () => {
|
||||
visit(CREATE_RULE_URL);
|
||||
fillDefineCustomRule(rule);
|
||||
openAddFilterPopover();
|
||||
fillAddFilterForm({
|
||||
key: 'host.name',
|
||||
operator: 'exists',
|
||||
});
|
||||
// Check that newly added filter exists
|
||||
cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM).should('have.text', 'host.name: exists');
|
||||
});
|
||||
});
|
||||
|
||||
it('Creates and edits a new rule with a data view', function () {
|
||||
visit(CREATE_RULE_URL);
|
||||
fillDefineCustomRuleAndContinue(rule);
|
||||
cy.get(RULE_NAME_INPUT).clear();
|
||||
cy.get(RULE_NAME_INPUT).type(rule.name);
|
||||
cy.get(RULE_DESCRIPTION_INPUT).clear();
|
||||
cy.get(RULE_DESCRIPTION_INPUT).type(rule.description);
|
||||
|
||||
cy.get(ABOUT_CONTINUE_BTN).should('exist').click();
|
||||
|
||||
fillScheduleRuleAndContinue(rule);
|
||||
createRuleWithoutEnabling();
|
||||
openRuleManagementPageViaBreadcrumbs();
|
||||
|
||||
goToRuleDetailsOf(rule.name);
|
||||
|
||||
cy.get(EDIT_RULE_SETTINGS_LINK).click();
|
||||
|
||||
cy.get(RULE_NAME_HEADER).should('contain', 'Edit rule settings');
|
||||
});
|
||||
|
||||
it('Adds filter on define step', () => {
|
||||
visit(CREATE_RULE_URL);
|
||||
fillDefineCustomRule(rule);
|
||||
openAddFilterPopover();
|
||||
fillAddFilterForm({
|
||||
key: 'host.name',
|
||||
operator: 'exists',
|
||||
});
|
||||
// Check that newly added filter exists
|
||||
cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM).should('have.text', 'host.name: exists');
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue