diff --git a/x-pack/plugins/security_solution/cypress/ccs_e2e/detection_rules/event_correlation_rule.cy.ts b/x-pack/plugins/security_solution/cypress/ccs_e2e/detection_rules/event_correlation_rule.cy.ts index 2e1db0b18df68..d8cd2d2b10e6c 100644 --- a/x-pack/plugins/security_solution/cypress/ccs_e2e/detection_rules/event_correlation_rule.cy.ts +++ b/x-pack/plugins/security_solution/cypress/ccs_e2e/detection_rules/event_correlation_rule.cy.ts @@ -8,7 +8,7 @@ import { esArchiverCCSLoad } from '../../tasks/es_archiver'; import { getCCSEqlRule } from '../../objects/rule'; -import { ALERT_DATA_GRID, NUMBER_OF_ALERTS } from '../../screens/alerts'; +import { ALERTS_COUNT, ALERT_DATA_GRID } from '../../screens/alerts'; import { filterByCustomRules, @@ -41,7 +41,7 @@ describe('Detection rules', function () { waitForTheRuleToBeExecuted(); waitForAlertsToPopulate(); - cy.get(NUMBER_OF_ALERTS).should('have.text', expectedNumberOfAlerts); + cy.get(ALERTS_COUNT).should('have.text', expectedNumberOfAlerts); cy.get(ALERT_DATA_GRID) .invoke('text') .then((text) => { diff --git a/x-pack/plugins/security_solution/cypress/e2e/data_sources/create_runtime_field.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/data_sources/create_runtime_field.cy.ts index b42ed414c2887..f8b4ae39efba3 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/data_sources/create_runtime_field.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/data_sources/create_runtime_field.cy.ts @@ -16,36 +16,43 @@ import { createCustomRuleEnabled } from '../../tasks/api_calls/rules'; import { getNewRule } from '../../objects/rule'; import { refreshPage } from '../../tasks/security_header'; import { waitForAlertsToPopulate } from '../../tasks/create_new_rule'; -import { assertFieldDisplayed, createField } from '../../tasks/create_runtime_field'; +import { createField } from '../../tasks/create_runtime_field'; import { openAlertsFieldBrowser } from '../../tasks/alerts'; -import { deleteAlertsIndex } from '../../tasks/sourcerer'; +import { deleteRuntimeField } from '../../tasks/sourcerer'; + +const alertRunTimeField = 'field.name.alert.page'; +const timelineRuntimeField = 'field.name.timeline'; describe('Create DataView runtime field', () => { before(() => { - deleteAlertsIndex(); login(); }); + before(() => { + deleteRuntimeField('security-solution-default', alertRunTimeField); + deleteRuntimeField('security-solution-default', timelineRuntimeField); + }); + it('adds field to alert table', () => { - const fieldName = 'field.name.alert.page'; visit(ALERTS_URL); createCustomRuleEnabled(getNewRule()); refreshPage(); waitForAlertsToPopulate(); openAlertsFieldBrowser(); - createField(fieldName); - assertFieldDisplayed(fieldName, 'alerts'); + createField(alertRunTimeField); + cy.get(`[data-test-subj="dataGridHeaderCell-${alertRunTimeField}"]`).should('exist'); }); it('adds field to timeline', () => { - const fieldName = 'field.name.timeline'; visit(HOSTS_URL); openTimelineUsingToggle(); populateTimeline(); openTimelineFieldsBrowser(); - createField(fieldName); - assertFieldDisplayed(fieldName); + createField(timelineRuntimeField); + cy.get( + `[data-test-subj="timeline"] [data-test-subj="header-text-${timelineRuntimeField}"]` + ).should('exist'); }); }); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_alerts/alerts_cell_actions.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_alerts/alerts_cell_actions.cy.ts index b322a87929d52..be4a939910928 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_alerts/alerts_cell_actions.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_alerts/alerts_cell_actions.cy.ts @@ -51,7 +51,7 @@ describe('Alerts cell actions', () => { .first() .invoke('text') .then((severityVal) => { - scrollAlertTableColumnIntoView(ALERT_TABLE_FILE_NAME_HEADER); + scrollAlertTableColumnIntoView(ALERT_TABLE_SEVERITY_VALUES); filterForAlertProperty(ALERT_TABLE_SEVERITY_VALUES, 0); cy.get(FILTER_BADGE) .first() @@ -75,7 +75,7 @@ describe('Alerts cell actions', () => { .first() .invoke('text') .then((severityVal) => { - scrollAlertTableColumnIntoView(ALERT_TABLE_FILE_NAME_HEADER); + scrollAlertTableColumnIntoView(ALERT_TABLE_SEVERITY_VALUES); addAlertPropertyToTimeline(ALERT_TABLE_SEVERITY_VALUES, 0); openActiveTimeline(); cy.get(PROVIDER_BADGE) @@ -101,7 +101,7 @@ describe('Alerts cell actions', () => { .first() .invoke('text') .then(() => { - scrollAlertTableColumnIntoView(ALERT_TABLE_FILE_NAME_HEADER); + scrollAlertTableColumnIntoView(ALERT_TABLE_SEVERITY_VALUES); showTopNAlertProperty(ALERT_TABLE_SEVERITY_VALUES, 0); cy.get(SHOW_TOP_N_HEADER).first().should('have.text', `Top kibana.alert.severity`); }); @@ -114,7 +114,7 @@ describe('Alerts cell actions', () => { .first() .invoke('text') .then(() => { - scrollAlertTableColumnIntoView(ALERT_TABLE_FILE_NAME_HEADER); + scrollAlertTableColumnIntoView(ALERT_TABLE_SEVERITY_VALUES); cy.window().then((win) => { cy.stub(win, 'prompt').returns('DISABLED WINDOW PROMPT'); }); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_alerts/enrichments.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_alerts/enrichments.cy.ts index 580782981e169..de610f3fa1808 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_alerts/enrichments.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_alerts/enrichments.cy.ts @@ -7,12 +7,12 @@ import { getNewRule } from '../../objects/rule'; import { - NUMBER_OF_ALERTS, HOST_RISK_HEADER_COLIMN, USER_RISK_HEADER_COLIMN, HOST_RISK_COLUMN, USER_RISK_COLUMN, ACTION_COLUMN, + ALERTS_COUNT, } from '../../screens/alerts'; import { ENRICHED_DATA_ROW } from '../../screens/alerts_details'; import { esArchiverLoad, esArchiverUnload } from '../../tasks/es_archiver'; @@ -56,7 +56,7 @@ describe('Enrichment', () => { }); it('Should has enrichment fields', function () { - cy.get(NUMBER_OF_ALERTS) + cy.get(ALERTS_COUNT) .invoke('text') .should('match', /^[1-9].+$/); // Any number of alerts cy.get(HOST_RISK_HEADER_COLIMN).contains('host.risk.calculated_level'); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule.cy.ts index ae1bb250fc605..b0fa7e6ff3d8d 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule.cy.ts @@ -14,7 +14,7 @@ import { getNewOverrideRule, } from '../../objects/rule'; import { getTimeline } from '../../objects/timeline'; -import { ALERT_GRID_CELL, NUMBER_OF_ALERTS } from '../../screens/alerts'; +import { ALERTS_COUNT, ALERT_GRID_CELL } from '../../screens/alerts'; import { CUSTOM_RULES_BTN, @@ -229,7 +229,7 @@ describe('Custom query rules', () => { waitForAlertsToPopulate(); cy.log('Asserting that alerts have been generated after the creation'); - cy.get(NUMBER_OF_ALERTS) + cy.get(ALERTS_COUNT) .invoke('text') .should('match', /^[1-9].+$/); // Any number of alerts cy.get(ALERT_GRID_CELL).contains(ruleFields.ruleName); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule_data_view.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule_data_view.cy.ts index 04e08d5de572a..d0259f45d23cf 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule_data_view.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule_data_view.cy.ts @@ -9,7 +9,7 @@ import { formatMitreAttackDescription } from '../../helpers/rules'; import type { Mitre } from '../../objects/rule'; import { getDataViewRule } from '../../objects/rule'; import type { CompleteTimeline } from '../../objects/timeline'; -import { ALERT_GRID_CELL, NUMBER_OF_ALERTS } from '../../screens/alerts'; +import { ALERTS_COUNT, ALERT_GRID_CELL } from '../../screens/alerts'; import { CUSTOM_RULES_BTN, @@ -160,7 +160,7 @@ describe('Custom query rules', () => { waitForTheRuleToBeExecuted(); waitForAlertsToPopulate(); - cy.get(NUMBER_OF_ALERTS) + cy.get(ALERTS_COUNT) .invoke('text') .should('match', /^[1-9].+$/); cy.get(ALERT_GRID_CELL).contains(this.rule.name); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/event_correlation_rule.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/event_correlation_rule.cy.ts index 79146eebc55df..ae2be01d66257 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/event_correlation_rule.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/event_correlation_rule.cy.ts @@ -9,7 +9,7 @@ import { formatMitreAttackDescription } from '../../helpers/rules'; import type { Mitre } from '../../objects/rule'; import { getEqlRule, getEqlSequenceRule, getIndexPatterns } from '../../objects/rule'; -import { ALERT_DATA_GRID, NUMBER_OF_ALERTS } from '../../screens/alerts'; +import { ALERTS_COUNT, ALERT_DATA_GRID } from '../../screens/alerts'; import { CUSTOM_RULES_BTN, RISK_SCORE, @@ -147,7 +147,7 @@ describe('EQL rules', () => { waitForTheRuleToBeExecuted(); waitForAlertsToPopulate(); - cy.get(NUMBER_OF_ALERTS).should('have.text', expectedNumberOfAlerts); + cy.get(ALERTS_COUNT).should('have.text', expectedNumberOfAlerts); cy.get(ALERT_DATA_GRID) .invoke('text') .then((text) => { @@ -191,7 +191,7 @@ describe('EQL rules', () => { waitForTheRuleToBeExecuted(); waitForAlertsToPopulate(); - cy.get(NUMBER_OF_ALERTS).should('have.text', expectedNumberOfSequenceAlerts); + cy.get(ALERTS_COUNT).should('have.text', expectedNumberOfSequenceAlerts); cy.get(ALERT_DATA_GRID) .invoke('text') .then((text) => { diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/indicator_match_rule.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/indicator_match_rule.cy.ts index 2114dd3b1fe63..b12fe66a6873a 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/indicator_match_rule.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/indicator_match_rule.cy.ts @@ -17,7 +17,7 @@ import { ALERT_RULE_NAME, ALERT_RISK_SCORE, ALERT_SEVERITY, - NUMBER_OF_ALERTS, + ALERTS_COUNT, } from '../../screens/alerts'; import { CUSTOM_RULES_BTN, @@ -491,7 +491,7 @@ describe('indicator match', () => { waitForTheRuleToBeExecuted(); waitForAlertsToPopulate(); - cy.get(NUMBER_OF_ALERTS).should('have.text', expectedNumberOfAlerts); + cy.get(ALERTS_COUNT).should('have.text', expectedNumberOfAlerts); cy.get(ALERT_RULE_NAME).first().should('have.text', rule.name); cy.get(ALERT_SEVERITY).first().should('have.text', rule.severity?.toLowerCase()); cy.get(ALERT_RISK_SCORE).first().should('have.text', rule.riskScore); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/override.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/override.cy.ts index 69ec2e9b75f9b..d4d6eb9fe0c08 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/override.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/override.cy.ts @@ -10,7 +10,7 @@ import type { Mitre, OverrideRule } from '../../objects/rule'; import { getNewOverrideRule, getSeveritiesOverride } from '../../objects/rule'; import type { CompleteTimeline } from '../../objects/timeline'; -import { NUMBER_OF_ALERTS, ALERT_GRID_CELL } from '../../screens/alerts'; +import { ALERT_GRID_CELL, ALERTS_COUNT } from '../../screens/alerts'; import { CUSTOM_RULES_BTN, @@ -160,7 +160,7 @@ describe('Detection rules, override', () => { waitForTheRuleToBeExecuted(); waitForAlertsToPopulate(); - cy.get(NUMBER_OF_ALERTS) + cy.get(ALERTS_COUNT) .invoke('text') .should('match', /^[1-9].+$/); // Any number of alerts cy.get(ALERT_GRID_CELL).contains('auditbeat'); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/threshold_rule.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/threshold_rule.cy.ts index df3f0031289e3..ecf66438db3ab 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/threshold_rule.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/threshold_rule.cy.ts @@ -9,7 +9,7 @@ import { formatMitreAttackDescription } from '../../helpers/rules'; import type { Mitre } from '../../objects/rule'; import { getNewThresholdRule } from '../../objects/rule'; -import { ALERT_GRID_CELL, NUMBER_OF_ALERTS } from '../../screens/alerts'; +import { ALERTS_COUNT, ALERT_GRID_CELL } from '../../screens/alerts'; import { CUSTOM_RULES_BTN, @@ -142,7 +142,7 @@ describe('Detection rules, threshold', () => { waitForTheRuleToBeExecuted(); waitForAlertsToPopulate(); - cy.get(NUMBER_OF_ALERTS).should(($count) => expect(+$count.text().split(' ')[0]).to.be.lt(100)); + cy.get(ALERTS_COUNT).should(($count) => expect(+$count.text().split(' ')[0]).to.be.lt(100)); cy.get(ALERT_GRID_CELL).contains(rule.name); }); }); diff --git a/x-pack/plugins/security_solution/cypress/e2e/exceptions/rule_details_flow/add_edit_exception_data_view.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/exceptions/rule_details_flow/add_edit_exception_data_view.cy.ts index 597472ba65446..b939f11219eab 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/exceptions/rule_details_flow/add_edit_exception_data_view.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/exceptions/rule_details_flow/add_edit_exception_data_view.cy.ts @@ -7,7 +7,7 @@ import { LOADING_INDICATOR } from '../../../screens/security_header'; import { getNewRule } from '../../../objects/rule'; -import { ALERTS_COUNT, EMPTY_ALERT_TABLE, NUMBER_OF_ALERTS } from '../../../screens/alerts'; +import { ALERTS_COUNT, EMPTY_ALERT_TABLE } from '../../../screens/alerts'; import { createCustomRuleEnabled } from '../../../tasks/api_calls/rules'; import { goToRuleDetails } from '../../../tasks/alerts_detection_rules'; import { @@ -112,7 +112,7 @@ describe('Add exception using data views from rule details', () => { // Closed alert should appear in table goToClosedAlertsOnRuleDetailsPage(); cy.get(ALERTS_COUNT).should('exist'); - cy.get(NUMBER_OF_ALERTS).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS}`); + cy.get(ALERTS_COUNT).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS}`); // Remove the exception and load an event that would have matched that exception // to show that said exception now starts to show up again @@ -132,7 +132,7 @@ describe('Add exception using data views from rule details', () => { waitForAlertsToPopulate(); cy.get(ALERTS_COUNT).should('exist'); - cy.get(NUMBER_OF_ALERTS).should('have.text', '2 alerts'); + cy.get(ALERTS_COUNT).should('have.text', '2 alerts'); }); it('Creates an exception item', () => { @@ -162,7 +162,7 @@ describe('Add exception using data views from rule details', () => { // Closed alert should appear in table goToClosedAlertsOnRuleDetailsPage(); cy.get(ALERTS_COUNT).should('exist'); - cy.get(NUMBER_OF_ALERTS).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS}`); + cy.get(ALERTS_COUNT).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS}`); // Remove the exception and load an event that would have matched that exception // to show that said exception now starts to show up again @@ -182,7 +182,7 @@ describe('Add exception using data views from rule details', () => { waitForAlertsToPopulate(); cy.get(ALERTS_COUNT).should('exist'); - cy.get(NUMBER_OF_ALERTS).should('have.text', '2 alerts'); + cy.get(ALERTS_COUNT).should('have.text', '2 alerts'); }); it('Edits an exception item', () => { diff --git a/x-pack/plugins/security_solution/cypress/e2e/timelines/bulk_add_to_timeline.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/timelines/bulk_add_to_timeline.cy.ts index 571c23bf81a67..22a156b57737e 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/timelines/bulk_add_to_timeline.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/timelines/bulk_add_to_timeline.cy.ts @@ -23,30 +23,6 @@ import { openEvents, openSessions } from '../../tasks/hosts/main'; import { login, visit } from '../../tasks/login'; import { ALERTS_URL, HOSTS_URL } from '../../urls/navigation'; -const assertFirstPageEventsAddToTimeline = (type: 'alerts' | 'events') => { - if (type === 'alerts') selectFirstPageAlerts(); - else selectFirstPageEvents(); - cy.get(SELECTED_ALERTS).then((sub) => { - const alertCountText = sub.text(); - const alertCount = alertCountText.split(' ')[1]; - bulkInvestigateSelectedEventsInTimeline(); - cy.get('body').should('contain.text', `${alertCount} event IDs`); - cy.get(SERVER_SIDE_EVENT_COUNT).should('contain.text', alertCount); - }); -}; - -const assertAllEventsAddToTimeline = (type: 'alerts' | 'events') => { - if (type === 'alerts') selectAllAlerts(); - else selectAllEvents(); - cy.get(SELECTED_ALERTS).then((sub) => { - const alertCountText = sub.text(); // Selected 3,654 alerts - const alertCount = alertCountText.split(' ')[1]; - bulkInvestigateSelectedEventsInTimeline(); - cy.get('body').should('contain.text', `${alertCount} event IDs`); - cy.get(SERVER_SIDE_EVENT_COUNT).should('contain.text', alertCount); - }); -}; - describe('Bulk Investigate in Timeline', () => { before(() => { cleanKibana(); @@ -69,11 +45,25 @@ describe('Bulk Investigate in Timeline', () => { }); it('Adding multiple alerts to the timeline should be successful', () => { - assertFirstPageEventsAddToTimeline('alerts'); + selectFirstPageAlerts(); + cy.get(SELECTED_ALERTS).then((sub) => { + const alertCountText = sub.text(); + const alertCount = alertCountText.split(' ')[1]; + bulkInvestigateSelectedEventsInTimeline(); + cy.get('body').should('contain.text', `${alertCount} event IDs`); + cy.get(SERVER_SIDE_EVENT_COUNT).should('contain.text', alertCount); + }); }); it('When selected all alerts are selected should be successfull', () => { - assertAllEventsAddToTimeline('alerts'); + selectAllAlerts(); + cy.get(SELECTED_ALERTS).then((sub) => { + const alertCountText = sub.text(); // Selected 3,654 alerts + const alertCount = alertCountText.split(' ')[1]; + bulkInvestigateSelectedEventsInTimeline(); + cy.get('body').should('contain.text', `${alertCount} event IDs`); + cy.get(SERVER_SIDE_EVENT_COUNT).should('contain.text', alertCount); + }); }); }); @@ -85,11 +75,25 @@ describe('Bulk Investigate in Timeline', () => { }); it('Adding multiple events to the timeline should be successful', () => { - assertFirstPageEventsAddToTimeline('events'); + selectFirstPageEvents(); + cy.get(SELECTED_ALERTS).then((sub) => { + const alertCountText = sub.text(); + const alertCount = alertCountText.split(' ')[1]; + bulkInvestigateSelectedEventsInTimeline(); + cy.get('body').should('contain.text', `${alertCount} event IDs`); + cy.get(SERVER_SIDE_EVENT_COUNT).should('contain.text', alertCount); + }); }); it('When selected all alerts are selected should be successfull', () => { - assertAllEventsAddToTimeline('events'); + selectAllEvents(); + cy.get(SELECTED_ALERTS).then((sub) => { + const alertCountText = sub.text(); // Selected 3,654 alerts + const alertCount = alertCountText.split(' ')[1]; + bulkInvestigateSelectedEventsInTimeline(); + cy.get('body').should('contain.text', `${alertCount} event IDs`); + cy.get(SERVER_SIDE_EVENT_COUNT).should('contain.text', alertCount); + }); }); }); @@ -101,11 +105,25 @@ describe('Bulk Investigate in Timeline', () => { }); it('Adding multiple events to the timeline should be successful', () => { - assertFirstPageEventsAddToTimeline('events'); + selectFirstPageEvents(); + cy.get(SELECTED_ALERTS).then((sub) => { + const alertCountText = sub.text(); + const alertCount = alertCountText.split(' ')[1]; + bulkInvestigateSelectedEventsInTimeline(); + cy.get('body').should('contain.text', `${alertCount} event IDs`); + cy.get(SERVER_SIDE_EVENT_COUNT).should('contain.text', alertCount); + }); }); it('When selected all events are selected should be successfull', () => { - assertAllEventsAddToTimeline('events'); + selectAllEvents(); + cy.get(SELECTED_ALERTS).then((sub) => { + const alertCountText = sub.text(); // Selected 3,654 alerts + const alertCount = alertCountText.split(' ')[1]; + bulkInvestigateSelectedEventsInTimeline(); + cy.get('body').should('contain.text', `${alertCount} event IDs`); + cy.get(SERVER_SIDE_EVENT_COUNT).should('contain.text', alertCount); + }); }); }); }); diff --git a/x-pack/plugins/security_solution/cypress/screens/alerts.ts b/x-pack/plugins/security_solution/cypress/screens/alerts.ts index 13fb241c5184d..ae444ea941fb2 100644 --- a/x-pack/plugins/security_solution/cypress/screens/alerts.ts +++ b/x-pack/plugins/security_solution/cypress/screens/alerts.ts @@ -67,8 +67,6 @@ export const ALERTS_HISTOGRAM_PANEL_LOADER = '[data-test-subj="loadingPanelAlert export const ALERTS_CONTAINER_LOADING_BAR = '[data-test-subj="events-container-loading-true"]'; -export const NUMBER_OF_ALERTS = ALERTS_COUNT; - export const OPEN_ALERT_BTN = '[data-test-subj="open-alert-status"]'; export const OPENED_ALERTS_FILTER_BTN = '[data-test-subj="openAlerts"]'; diff --git a/x-pack/plugins/security_solution/cypress/tasks/create_runtime_field.ts b/x-pack/plugins/security_solution/cypress/tasks/create_runtime_field.ts index 1cc07890b3d7a..662db2eece70d 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/create_runtime_field.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/create_runtime_field.ts @@ -16,10 +16,3 @@ export const createField = (fieldName: string): Cypress.Chainable - view === 'alerts' - ? cy.get(`[data-test-subj="dataGridHeaderCell-${fieldName}"]`).should('exist') - : cy - .get(`[data-test-subj="timeline"] [data-test-subj="header-text-${fieldName}"]`) - .should('exist'); diff --git a/x-pack/plugins/security_solution/cypress/tasks/sourcerer.ts b/x-pack/plugins/security_solution/cypress/tasks/sourcerer.ts index b21dd651d2cfc..266e3655a8342 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/sourcerer.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/sourcerer.ts @@ -151,3 +151,14 @@ export const waitForAlertsIndexToExist = () => { createCustomRuleEnabled(getNewRule(), '1', 100); refreshUntilAlertsIndexExists(); }; + +export const deleteRuntimeField = (dataView: string, fieldName: string) => { + const deleteRuntimeFieldPath = `/api/data_views/data_view/${dataView}/runtime_field/${fieldName}`; + + cy.request({ + url: deleteRuntimeFieldPath, + method: 'DELETE', + headers: { 'kbn-xsrf': 'cypress-creds' }, + failOnStatusCode: false, + }); +};