diff --git a/.buildkite/scripts/pipelines/pull_request/pipeline.ts b/.buildkite/scripts/pipelines/pull_request/pipeline.ts index 955409c971198..cd392b00be882 100644 --- a/.buildkite/scripts/pipelines/pull_request/pipeline.ts +++ b/.buildkite/scripts/pipelines/pull_request/pipeline.ts @@ -233,6 +233,7 @@ const uploadPipeline = (pipelineContent: string | object) => { /^x-pack\/packages\/security-solution/, /^x-pack\/packages\/kbn-elastic-assistant/, /^x-pack\/packages\/kbn-elastic-assistant-common/, + /^x-pack\/test\/functional\/es_archives\/security_solution/, /^x-pack\/test\/security_solution_cypress/, ])) || GITHUB_PR_LABELS.includes('ci:all-cypress-suites') @@ -271,6 +272,7 @@ const uploadPipeline = (pipelineContent: string | object) => { /^x-pack\/packages\/security-solution/, /^x-pack\/packages\/kbn-elastic-assistant/, /^x-pack\/packages\/kbn-elastic-assistant-common/, + /^x-pack\/test\/functional\/es_archives\/security_solution/, /^x-pack\/test\/security_solution_cypress/, ])) || GITHUB_PR_LABELS.includes('ci:all-cypress-suites') diff --git a/x-pack/test/security_solution_cypress/cypress/README.md b/x-pack/test/security_solution_cypress/cypress/README.md index 51f2365e199be..ed8fe3793d60b 100644 --- a/x-pack/test/security_solution_cypress/cypress/README.md +++ b/x-pack/test/security_solution_cypress/cypress/README.md @@ -233,6 +233,21 @@ Note that the command will create the folder if it does not exist. Task [cypress/support/es_archiver.ts](https://github.com/elastic/kibana/blob/main/x-pack/test/security_solution_cypress/cypress/support/es_archiver.ts) provides helpers such as `esArchiverLoad` and `esArchiverUnload` by means of `es_archiver`'s CLI. +Archives used only for Cypress tests purposes are stored in `x-pack/test/security_solution_cypress/es_archives` and are used as follow on the tests. + +```typescript +cy.task('esArchiverLoad', { archiveName: 'overview' }); +cy.task('esArchiverUnload', { archiveName: 'overview'}); + +``` + +You can also use archives stored in `kibana/x-pack/test/functional/es_archives`. In order to do sow uste it on the tests as follow. + +```typescript +cy.task('esArchiverLoad', { archiveName: 'security_solution/alias' }, type: 'ftr'); +cy.task('esArchiverUnload', { archiveName: 'security_solution/alias', type:'ftr'}); +``` + ## Serverless Note that we use tags in order to select which tests we want to execute, if you want a test to be executed on serverless you need to add @serverless tag to it. diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments.cy.ts index 12173369c896b..022f1ba4fd72a 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments.cy.ts @@ -45,7 +45,7 @@ describe('Alert user assignment - ESS & Serverless', { tags: ['@ess', '@serverle }); after(() => { - cy.task('esArchiverUnload', 'auditbeat_multiple'); + cy.task('esArchiverUnload', { archiveName: 'auditbeat_multiple' }); }); beforeEach(() => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_ess.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_ess.cy.ts index 169a2824167db..9b0768e1d798a 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_ess.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_ess.cy.ts @@ -24,7 +24,7 @@ describe('Alert user assignment - ESS', { tags: ['@ess'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'auditbeat_multiple'); + cy.task('esArchiverUnload', { archiveName: 'auditbeat_multiple' }); }); beforeEach(() => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_ess_basic.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_ess_basic.cy.ts index c4ed1aa385eb7..ccd5b402ed7ea 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_ess_basic.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/assignments/assignments_ess_basic.cy.ts @@ -39,7 +39,7 @@ describe('Alert user assignment - Basic License', { tags: ['@ess'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'auditbeat_multiple'); + cy.task('esArchiverUnload', { archiveName: 'auditbeat_multiple' }); }); beforeEach(() => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/enrichments/alert_threat_enrichments.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/enrichments/alert_threat_enrichments.cy.ts index 47f7b2c2dd570..b8a70ce7b13e8 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/enrichments/alert_threat_enrichments.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/enrichments/alert_threat_enrichments.cy.ts @@ -43,8 +43,8 @@ describe( }); after(() => { - cy.task('esArchiverUnload', 'threat_indicator'); - cy.task('esArchiverUnload', 'suspicious_source_event'); + cy.task('esArchiverUnload', { archiveName: 'threat_indicator' }); + cy.task('esArchiverUnload', { archiveName: 'suspicious_source_event' }); }); beforeEach(() => { @@ -165,7 +165,7 @@ describe( }); after(() => { - cy.task('esArchiverUnload', 'threat_indicator2'); + cy.task('esArchiverUnload', { archiveName: 'threat_indicator2' }); }); it('Displays matched fields from both indicator match rules and investigation time enrichments on Threat Intel tab', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/status/alert_status.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/status/alert_status.cy.ts index eed6577a73029..911168362c946 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/status/alert_status.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/status/alert_status.cy.ts @@ -44,7 +44,7 @@ describe.skip('Changing alert status', { tags: ['@ess', '@serverless'] }, () => }); after(() => { - cy.task('esArchiverUnload', 'auditbeat_multiple'); + cy.task('esArchiverUnload', { archiveName: 'auditbeat_multiple' }); }); context('Opening alerts', { tags: ['@ess', '@serverless'] }, () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/tags/alert_tags.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/tags/alert_tags.cy.ts index 99d4e8d314cc8..bd65420da35c2 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/tags/alert_tags.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/detection_alerts/tags/alert_tags.cy.ts @@ -32,8 +32,8 @@ describe('Alert tagging', { tags: ['@ess', '@serverless'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'endpoint'); - cy.task('esArchiverUnload', 'auditbeat_multiple'); + cy.task('esArchiverUnload', { archiveName: 'endpoint' }); + cy.task('esArchiverUnload', { archiveName: 'auditbeat_multiple' }); }); beforeEach(() => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/alerts_table_flow/endpoint_exceptions.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/alerts_table_flow/endpoint_exceptions.cy.ts index ceea266456acb..34fa454e7a641 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/alerts_table_flow/endpoint_exceptions.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/alerts_table_flow/endpoint_exceptions.cy.ts @@ -50,7 +50,7 @@ describe.skip( const ADDITIONAL_ENTRY = 'host.hostname'; beforeEach(() => { - cy.task('esArchiverUnload', 'endpoint'); + cy.task('esArchiverUnload', { archiveName: 'endpoint' }); login(); deleteAlertsAndRules(); @@ -62,7 +62,7 @@ describe.skip( }); after(() => { - cy.task('esArchiverUnload', 'endpoint'); + cy.task('esArchiverUnload', { archiveName: 'endpoint' }); }); it('Should be able to create and close single Endpoint exception from overflow menu', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/alerts_table_flow/rule_exceptions/auto_populate_with_alert_data.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/alerts_table_flow/rule_exceptions/auto_populate_with_alert_data.cy.ts index 520ab19e9e5e8..788907e461526 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/alerts_table_flow/rule_exceptions/auto_populate_with_alert_data.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/alerts_table_flow/rule_exceptions/auto_populate_with_alert_data.cy.ts @@ -47,7 +47,7 @@ describe.skip( const ADDITIONAL_ENTRY = 'host.hostname'; beforeEach(() => { - cy.task('esArchiverUnload', 'endpoint'); + cy.task('esArchiverUnload', { archiveName: 'endpoint' }); cy.task('esArchiverLoad', { archiveName: 'endpoint' }); login(); createRule(getEndpointRule()).then((rule) => visitRuleDetailsPage(rule.body.id)); @@ -55,11 +55,11 @@ describe.skip( waitForAlertsToPopulate(); }); after(() => { - cy.task('esArchiverUnload', 'endpoint'); + cy.task('esArchiverUnload', { archiveName: 'endpoint' }); deleteAlertsAndRules(); }); afterEach(() => { - cy.task('esArchiverUnload', 'endpoint'); + cy.task('esArchiverUnload', { archiveName: 'endpoint' }); }); it('Should create a Rule exception item from alert actions overflow menu and auto populate the conditions using alert Highlighted fields', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/alerts_table_flow/rule_exceptions/closing_all_matching_alerts.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/alerts_table_flow/rule_exceptions/closing_all_matching_alerts.cy.ts index ffba394c407d4..6806ad1c776c1 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/alerts_table_flow/rule_exceptions/closing_all_matching_alerts.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/alerts_table_flow/rule_exceptions/closing_all_matching_alerts.cy.ts @@ -32,7 +32,7 @@ describe('Close matching Alerts ', { tags: ['@ess', '@serverless', '@skipInServe const ITEM_NAME = 'Sample Exception Item'; beforeEach(() => { - cy.task('esArchiverUnload', 'exceptions'); + cy.task('esArchiverUnload', { archiveName: 'exceptions' }); deleteAlertsAndRules(); cy.task('esArchiverLoad', { archiveName: 'exceptions' }); @@ -50,7 +50,7 @@ describe('Close matching Alerts ', { tags: ['@ess', '@serverless', '@skipInServe waitForAlertsToPopulate(); }); after(() => { - cy.task('esArchiverUnload', 'exceptions'); + cy.task('esArchiverUnload', { archiveName: 'exceptions' }); }); // TODO: https://github.com/elastic/kibana/issues/161539 diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/flyout_validation.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/flyout_validation.cy.ts index b7bb1317ef2b7..0bde78a14be55 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/flyout_validation.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/flyout_validation.cy.ts @@ -100,7 +100,7 @@ describe.skip('Exceptions flyout', { tags: ['@ess', '@serverless', '@skipInServe }); after(() => { - cy.task('esArchiverUnload', 'exceptions'); + cy.task('esArchiverUnload', { archiveName: 'exceptions' }); }); it('Validates empty entry values correctly', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/match_any.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/match_any.cy.ts index 3a5b5c6cd98c9..d9afe7d5a25ce 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/match_any.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/match_any.cy.ts @@ -53,7 +53,7 @@ describe('Exceptions match_any', { tags: ['@ess', '@serverless'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'exceptions'); + cy.task('esArchiverUnload', { archiveName: 'exceptions' }); }); it('Creates exception item', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/multiple_conditions.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/multiple_conditions.cy.ts index f8fb728dbf79a..4f7f1a2d68652 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/multiple_conditions.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/multiple_conditions.cy.ts @@ -45,7 +45,7 @@ describe( }); after(() => { - cy.task('esArchiverUnload', 'exceptions'); + cy.task('esArchiverUnload', { archiveName: 'exceptions' }); }); const exceptionName = 'My item name'; diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/use_value_list.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/use_value_list.cy.ts index 34aee1bf8f0ea..c1679c43f85f7 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/use_value_list.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/entry/use_value_list.cy.ts @@ -54,7 +54,7 @@ describe.skip('Use Value list in exception entry', { tags: ['@ess', '@serverless }); after(() => { - cy.task('esArchiverUnload', 'exceptions'); + cy.task('esArchiverUnload', { archiveName: 'exceptions' }); }); beforeEach(() => { login(); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/rule_details_flow/add_edit_endpoint_exception.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/rule_details_flow/add_edit_endpoint_exception.cy.ts index eef28b77e7ac5..66065e039b916 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/rule_details_flow/add_edit_endpoint_exception.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/rule_details_flow/add_edit_endpoint_exception.cy.ts @@ -61,7 +61,7 @@ describe('Add endpoint exception from rule details', { tags: ['@ess', '@serverle }); after(() => { - cy.task('esArchiverUnload', 'auditbeat_multiple'); + cy.task('esArchiverUnload', { archiveName: 'auditbeat_multiple' }); }); beforeEach(() => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/rule_details_flow/add_edit_exception.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/rule_details_flow/add_edit_exception.cy.ts index b1115b5833bd0..bca260aebaed3 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/rule_details_flow/add_edit_exception.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/rule_details_flow/add_edit_exception.cy.ts @@ -72,7 +72,7 @@ describe( }); after(() => { - cy.task('esArchiverUnload', 'exceptions'); + cy.task('esArchiverUnload', { archiveName: 'exceptions' }); }); beforeEach(() => { @@ -263,7 +263,7 @@ describe( }); afterEach(() => { - cy.task('esArchiverUnload', 'exceptions_2'); + cy.task('esArchiverUnload', { archiveName: 'exceptions_2' }); }); it('Cannot create an item to add to rule but not shared list as rule has no lists attached', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/rule_details_flow/add_edit_exception_data_view.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/rule_details_flow/add_edit_exception_data_view.cy.ts index 18c75ce25cbfa..b986fc59deb23 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/rule_details_flow/add_edit_exception_data_view.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/exceptions/rule_details_flow/add_edit_exception_data_view.cy.ts @@ -56,7 +56,7 @@ describe( }); after(() => { - cy.task('esArchiverUnload', 'exceptions'); + cy.task('esArchiverUnload', { archiveName: 'exceptions' }); }); beforeEach(() => { @@ -74,7 +74,7 @@ describe( }); afterEach(() => { - cy.task('esArchiverUnload', 'exceptions_2'); + cy.task('esArchiverUnload', { archiveName: 'exceptions_2' }); }); it('Creates an exception item and close all matching alerts', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/overview/cti_link_panel.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/overview/cti_link_panel.cy.ts index 4db690e282f4a..65cd15dbce8fe 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/overview/cti_link_panel.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/overview/cti_link_panel.cy.ts @@ -48,7 +48,7 @@ describe.skip('CTI Link Panel', { tags: ['@ess', '@serverless', '@skipInServerle }); after(() => { - cy.task('esArchiverUnload', 'threat_indicator'); + cy.task('esArchiverUnload', { archiveName: 'threat_indicator' }); }); it('renders disabled dashboard module as expected when there are no events in the selected time period', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_creation/event_correlation_rule.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_creation/event_correlation_rule.cy.ts index f02ec20ffd685..a2261d129d452 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_creation/event_correlation_rule.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_response/detection_engine/rule_creation/event_correlation_rule.cy.ts @@ -148,7 +148,7 @@ describe('EQL rules', { tags: ['@ess', '@serverless'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'auditbeat_multiple'); + cy.task('esArchiverUnload', { archiveName: 'auditbeat_multiple' }); }); it('Creates and enables a new EQL rule with a sequence', function () { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/dashboards/entity_analytics.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/dashboards/entity_analytics.cy.ts index 56c0264d00ee8..4919fe8557986 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/dashboards/entity_analytics.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/dashboards/entity_analytics.cy.ts @@ -70,7 +70,7 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () => }); after(() => { - cy.task('esArchiverUnload', 'auditbeat_multiple'); + cy.task('esArchiverUnload', { archiveName: 'auditbeat_multiple' }); }); describe('legacy risk score', () => { @@ -101,8 +101,8 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () => }); after(() => { - cy.task('esArchiverUnload', 'risk_hosts_no_data'); - cy.task('esArchiverUnload', 'risk_users_no_data'); + cy.task('esArchiverUnload', { archiveName: 'risk_hosts_no_data' }); + cy.task('esArchiverUnload', { archiveName: 'risk_users_no_data' }); }); it('shows no data detected prompt for host risk score module', () => { @@ -126,8 +126,8 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () => }); after(() => { - cy.task('esArchiverUnload', 'risk_hosts_legacy_data'); - cy.task('esArchiverUnload', 'risk_users_legacy_data'); + cy.task('esArchiverUnload', { archiveName: 'risk_hosts_legacy_data' }); + cy.task('esArchiverUnload', { archiveName: 'risk_users_legacy_data' }); }); it('shows enable host risk button', () => { @@ -150,7 +150,7 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () => }); after(() => { - cy.task('esArchiverUnload', 'risk_hosts'); + cy.task('esArchiverUnload', { archiveName: 'risk_hosts' }); }); it('renders donut chart', () => { @@ -235,7 +235,7 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () => }); after(() => { - cy.task('esArchiverUnload', 'risk_users'); + cy.task('esArchiverUnload', { archiveName: 'risk_users' }); }); it('renders donut chart', () => { @@ -338,7 +338,7 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () => }); after(() => { - cy.task('esArchiverUnload', 'risk_scores_new_no_data'); + cy.task('esArchiverUnload', { archiveName: 'risk_scores_new_no_data' }); }); it('shows no data detected prompt for host and user risk scores', () => { @@ -353,7 +353,7 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () => }); after(() => { - cy.task('esArchiverUnload', 'risk_scores_new'); + cy.task('esArchiverUnload', { archiveName: 'risk_scores_new' }); }); it('renders donut chart', () => { @@ -446,7 +446,7 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () => }); after(() => { - cy.task('esArchiverUnload', 'risk_scores_new'); + cy.task('esArchiverUnload', { archiveName: 'risk_scores_new' }); }); it('renders donut chart', () => { @@ -546,7 +546,7 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () => }); after(() => { - cy.task('esArchiverUnload', 'network'); + cy.task('esArchiverUnload', { archiveName: 'network' }); }); it('should enable a job and renders the table with pagination', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/dashboards/upgrade_risk_score.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/dashboards/upgrade_risk_score.cy.ts index 0da6597450126..410239309aeb1 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/dashboards/upgrade_risk_score.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/dashboards/upgrade_risk_score.cy.ts @@ -54,8 +54,8 @@ describe('Upgrade risk scores', { tags: ['@ess', '@serverless'] }, () => { afterEach(() => { deleteRiskScore({ riskScoreEntity: RiskScoreEntity.host, spaceId }); deleteRiskScore({ riskScoreEntity: RiskScoreEntity.user, spaceId }); - cy.task('esArchiverUnload', 'risk_hosts'); - cy.task('esArchiverUnload', 'risk_users'); + cy.task('esArchiverUnload', { archiveName: 'risk_hosts' }); + cy.task('esArchiverUnload', { archiveName: 'risk_users' }); }); it('shows upgrade panel', () => { @@ -77,8 +77,8 @@ describe('Upgrade risk scores', { tags: ['@ess', '@serverless'] }, () => { }); afterEach(() => { - cy.task('esArchiverUnload', 'risk_hosts'); - cy.task('esArchiverUnload', 'risk_users'); + cy.task('esArchiverUnload', { archiveName: 'risk_hosts' }); + cy.task('esArchiverUnload', { archiveName: 'risk_users' }); deleteRiskScore({ riskScoreEntity: RiskScoreEntity.host, spaceId }); deleteRiskScore({ riskScoreEntity: RiskScoreEntity.user, spaceId }); deleteRiskEngineConfiguration(); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/enrichments.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/enrichments.cy.ts index 5a6fdc2f05532..3bd09ee00000f 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/enrichments.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/enrichments.cy.ts @@ -36,13 +36,13 @@ const ORIGINAL_HOST_RISK_LEVEL = 'Original host risk level'; describe('Enrichment', { tags: ['@ess', '@serverless'] }, () => { before(() => { - cy.task('esArchiverUnload', 'risk_scores_new'); - cy.task('esArchiverUnload', 'risk_scores_new_updated'); + cy.task('esArchiverUnload', { archiveName: 'risk_scores_new' }); + cy.task('esArchiverUnload', { archiveName: 'risk_scores_new_updated' }); cy.task('esArchiverLoad', { archiveName: 'risk_users' }); }); after(() => { - cy.task('esArchiverUnload', 'risk_users'); + cy.task('esArchiverUnload', { archiveName: 'risk_users' }); }); describe('Custom query rule', () => { @@ -59,8 +59,8 @@ describe('Enrichment', { tags: ['@ess', '@serverless'] }, () => { }); afterEach(() => { - cy.task('esArchiverUnload', 'risk_hosts'); - cy.task('esArchiverUnload', 'risk_hosts_updated'); + cy.task('esArchiverUnload', { archiveName: 'risk_hosts' }); + cy.task('esArchiverUnload', { archiveName: 'risk_hosts_updated' }); }); it('Should has enrichment fields from legacy risk', function () { @@ -78,7 +78,7 @@ describe('Enrichment', { tags: ['@ess', '@serverless'] }, () => { cy.get(ENRICHED_DATA_ROW).contains(ORIGINAL_HOST_RISK_LEVEL).should('not.exist'); closeAlertFlyout(); - cy.task('esArchiverUnload', 'risk_hosts'); + cy.task('esArchiverUnload', { archiveName: 'risk_hosts' }); cy.task('esArchiverLoad', { archiveName: 'risk_hosts_updated' }); expandFirstAlert(); cy.get(ENRICHED_DATA_ROW).contains('Critical'); @@ -99,8 +99,8 @@ describe('Enrichment', { tags: ['@ess', '@serverless'] }, () => { }); afterEach(() => { - cy.task('esArchiverUnload', 'risk_scores_new'); - cy.task('esArchiverUnload', 'risk_scores_new_updated'); + cy.task('esArchiverUnload', { archiveName: 'risk_scores_new' }); + cy.task('esArchiverUnload', { archiveName: 'risk_scores_new_updated' }); }); it('Should has enrichment fields from legacy risk', function () { @@ -118,7 +118,7 @@ describe('Enrichment', { tags: ['@ess', '@serverless'] }, () => { cy.get(ENRICHED_DATA_ROW).contains(ORIGINAL_HOST_RISK_LEVEL).should('not.exist'); closeAlertFlyout(); - cy.task('esArchiverUnload', 'risk_scores_new'); + cy.task('esArchiverUnload', { archiveName: 'risk_scores_new' }); cy.task('esArchiverLoad', { archiveName: 'risk_scores_new_updated' }); expandFirstAlert(); cy.get(ENRICHED_DATA_ROW).contains('Low'); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_analytics_management_page.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_analytics_management_page.cy.ts index 24d13322f7d9d..f23480e52d0d1 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_analytics_management_page.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_analytics_management_page.cy.ts @@ -56,7 +56,7 @@ describe( }); after(() => { - cy.task('esArchiverUnload', 'all_users'); + cy.task('esArchiverUnload', { archiveName: 'all_users' }); }); it('renders page as expected', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_flyout.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_flyout.cy.ts index 90eb208f7d710..426fa29b7ac26 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_flyout.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_flyout.cy.ts @@ -74,8 +74,8 @@ describe( }); afterEach(() => { - cy.task('esArchiverUnload', 'risk_scores_new_complete_data'); - cy.task('esArchiverUnload', 'user_managed_data'); + cy.task('esArchiverUnload', { archiveName: 'risk_scores_new_complete_data' }); + cy.task('esArchiverUnload', { archiveName: 'user_managed_data' }); deleteAlertsAndRules(); // esArchiverUnload doesn't work properly when using with `useCreate` and `docsOnly` flags deleteCriticality({ idField: 'host.name', idValue: SIEM_KIBANA_HOST_NAME }); deleteCriticality({ idField: 'user.name', idValue: USER_NAME }); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/host_details/risk_tab.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/host_details/risk_tab.cy.ts index 3b81ccfdd36d7..d4fbb0dafb9f4 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/host_details/risk_tab.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/host_details/risk_tab.cy.ts @@ -24,8 +24,8 @@ describe('risk tab', { tags: ['@ess', '@serverless'] }, () => { deleteRiskEngineConfiguration(); }); - afterEach(() => { - cy.task('esArchiverUnload', 'risk_hosts'); + after(() => { + cy.task('esArchiverUnload', { archiveName: 'risk_hosts' }); }); it('renders risk tab', () => { @@ -50,15 +50,18 @@ describe('risk tab', { tags: ['@ess', '@serverless'] }, () => { }); describe('with new risk score', () => { - beforeEach(() => { + before(() => { cy.task('esArchiverLoad', { archiveName: 'risk_scores_new_complete_data' }); cy.task('esArchiverLoad', { archiveName: 'query_alert', useCreate: true, docsOnly: true }); + }); + + beforeEach(() => { mockRiskEngineEnabled(); login(); }); - afterEach(() => { - cy.task('esArchiverUnload', 'risk_scores_new_complete_data'); + after(() => { + cy.task('esArchiverUnload', { archiveName: 'risk_scores_new_complete_data' }); deleteAlertsAndRules(); // esArchiverUnload doesn't work properly when using with `useCreate` and `docsOnly` flags deleteRiskEngineConfiguration(); }); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/hosts/host_risk_tab.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/hosts/host_risk_tab.cy.ts index 2e6fa22be4302..6986580d689b6 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/hosts/host_risk_tab.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/hosts/host_risk_tab.cy.ts @@ -39,7 +39,7 @@ describe('risk tab', { tags: ['@ess', '@serverless'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'risk_hosts'); + cy.task('esArchiverUnload', { archiveName: 'risk_hosts' }); }); it('renders the table', () => { @@ -86,7 +86,7 @@ describe('risk tab', { tags: ['@ess', '@serverless'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'risk_scores_new'); + cy.task('esArchiverUnload', { archiveName: 'risk_scores_new' }); }); it('renders the table', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/hosts/hosts_risk_column.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/hosts/hosts_risk_column.cy.ts index dfbb017efe0d2..5c9288bf4bb4f 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/hosts/hosts_risk_column.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/hosts/hosts_risk_column.cy.ts @@ -24,7 +24,7 @@ describe('All hosts table', { tags: ['@ess', '@serverless'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'risk_hosts'); + cy.task('esArchiverUnload', { archiveName: 'risk_hosts' }); }); it('it renders risk column', () => { @@ -47,7 +47,7 @@ describe('All hosts table', { tags: ['@ess', '@serverless'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'risk_scores_new'); + cy.task('esArchiverUnload', { archiveName: 'risk_scores_new' }); }); it('it renders risk column', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/hosts/events_viewer.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/hosts/events_viewer.cy.ts index f61cf9943f5ee..bb44394c460ff 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/hosts/events_viewer.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/hosts/events_viewer.cy.ts @@ -53,7 +53,7 @@ describe('Events Viewer', { tags: ['@ess', '@serverless'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'auditbeat_multiple'); + cy.task('esArchiverUnload', { archiveName: 'auditbeat_multiple' }); }); context('Fields rendering', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/inspect/inspect_button.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/inspect/inspect_button.cy.ts index 3deabd6afa169..fbe1f5fe8c33a 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/inspect/inspect_button.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/inspect/inspect_button.cy.ts @@ -40,8 +40,8 @@ describe.skip( }); after(() => { - cy.task('esArchiverUnload', 'risk_users'); - cy.task('esArchiverUnload', 'risk_hosts'); + cy.task('esArchiverUnload', { archiveName: 'risk_users' }); + cy.task('esArchiverUnload', { archiveName: 'risk_hosts' }); }); INSPECT_BUTTONS_IN_SECURITY.forEach(({ pageName, url, lensVisualizations, tables }) => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/network/hover_actions.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/network/hover_actions.cy.ts index f926007482ad3..7d6ab6abdb8be 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/network/hover_actions.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/network/hover_actions.cy.ts @@ -36,7 +36,7 @@ describe('Hover actions', { tags: ['@ess', '@serverless'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'network'); + cy.task('esArchiverUnload', { archiveName: 'network' }); }); beforeEach(() => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/network/overflow_items.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/network/overflow_items.cy.ts index 297f47ddaafa4..aafe4cf469e76 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/network/overflow_items.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/network/overflow_items.cy.ts @@ -44,7 +44,7 @@ describe('Overflow items', { tags: ['@ess', '@serverless'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'network'); + cy.task('esArchiverUnload', { archiveName: 'network' }); }); it('Shows more items in the popover', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/overview/overview.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/overview/overview.cy.ts index b0b1a11bc69e0..28c7d49c6d1e8 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/overview/overview.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/overview/overview.cy.ts @@ -27,7 +27,7 @@ describe('Overview Page', { tags: ['@ess', '@serverless'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'overview'); + cy.task('esArchiverUnload', { archiveName: 'overview' }); }); it('Host stats render with correct values', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/pagination/pagination.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/pagination/pagination.cy.ts index a590cfc9383b1..37da9553b02a0 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/pagination/pagination.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/pagination/pagination.cy.ts @@ -35,7 +35,7 @@ describe('Pagination', { tags: ['@ess', '@serverless'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'host_uncommon_processes'); + cy.task('esArchiverUnload', { archiveName: 'host_uncommon_processes' }); }); it('pagination updates results and page number', () => { @@ -109,7 +109,7 @@ describe('Pagination', { tags: ['@ess', '@serverless'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'all_users'); + cy.task('esArchiverUnload', { archiveName: 'all_users' }); }); it(`reset all Hosts pagination when sorting column`, () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/users/users_tabs.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/users/users_tabs.cy.ts index f80453e809832..83321290917cd 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/users/users_tabs.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/users/users_tabs.cy.ts @@ -33,8 +33,8 @@ describe('Users stats and tables', { tags: ['@ess', '@serverless'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'users'); - cy.task('esArchiverUnload', 'risk_users'); + cy.task('esArchiverUnload', { archiveName: 'users' }); + cy.task('esArchiverUnload', { archiveName: 'risk_users' }); }); describe('Users page tabs', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alert_table_action_column.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alert_table_action_column.cy.ts index b8e31186a1366..b6c9e8f7b443d 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alert_table_action_column.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alert_table_action_column.cy.ts @@ -31,7 +31,7 @@ describe.skip('Alerts Table Action column', { tags: ['@ess', '@serverless'] }, ( }); after(() => { - cy.task('esArchiverUnload', 'process_ancestry'); + cy.task('esArchiverUnload', { archiveName: 'process_ancestry' }); }); it('should have session viewer button visible & open session viewer on click', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_details.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_details.cy.ts index 0f24575d8a2a2..99c56ca845bd7 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_details.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/alerts_details.cy.ts @@ -79,7 +79,7 @@ describe('Alert details flyout', { tags: ['@ess', '@serverless'] }, () => { }); after(() => { - cy.task('esArchiverUnload', 'unmapped_fields'); + cy.task('esArchiverUnload', { archiveName: 'unmapped_fields' }); }); it.skip('should display user and system defined highlighted fields', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/building_block_alerts.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/building_block_alerts.cy.ts index 718feeca31533..1cede221c3632 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/building_block_alerts.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/building_block_alerts.cy.ts @@ -23,7 +23,7 @@ describe('Alerts generated by building block rules', { tags: ['@ess', '@serverle }); after(() => { - cy.task('esArchiverUnload', 'auditbeat_multiple'); + cy.task('esArchiverUnload', { archiveName: 'auditbeat_multiple' }); }); beforeEach(() => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/changing_alert_status.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/changing_alert_status.cy.ts index 8a49b4eb02065..f173e78988638 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/changing_alert_status.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/changing_alert_status.cy.ts @@ -46,7 +46,7 @@ describe('Changing alert status', { tags: ['@ess', '@brokenInServerless'] }, () }); after(() => { - cy.task('esArchiverUnload', 'auditbeat_multiple'); + cy.task('esArchiverUnload', { archiveName: 'auditbeat_multiple' }); }); context('Opening alerts', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/ransomware_detection.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/ransomware_detection.cy.ts index c8da8308b76a4..a225d08780166 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/ransomware_detection.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/ransomware_detection.cy.ts @@ -26,7 +26,7 @@ describe('Ransomware Detection Alerts', { tags: ['@ess', '@serverless'] }, () => }); after(() => { - cy.task('esArchiverUnload', 'ransomware_detection'); + cy.task('esArchiverUnload', { archiveName: 'ransomware_detection' }); }); describe('Ransomware in Alerts Page', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/ransomware_prevention.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/ransomware_prevention.cy.ts index 099f2e751458d..abc00b14c466a 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/ransomware_prevention.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/ransomware_prevention.cy.ts @@ -26,7 +26,7 @@ describe('Ransomware Prevention Alerts', { tags: ['@ess', '@serverless'] }, () = }); after(() => { - cy.task('esArchiverUnload', 'ransomware_prevention'); + cy.task('esArchiverUnload', { archiveName: 'ransomware_prevention' }); }); describe('Ransomware in Alerts Page', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/bulk_add_to_timeline.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/bulk_add_to_timeline.cy.ts index 0518326e4ca32..2ef234a3a5f89 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/bulk_add_to_timeline.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/bulk_add_to_timeline.cy.ts @@ -29,7 +29,7 @@ describe('Bulk Investigate in Timeline', { tags: ['@ess', '@serverless'] }, () = }); after(() => { - cy.task('esArchiverUnload', 'bulk_process'); + cy.task('esArchiverUnload', { archiveName: 'bulk_process' }); }); context('Alerts', () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/pagination.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/pagination.cy.ts index 4c64f23167578..d1d1bdb84bc23 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/pagination.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/pagination.cy.ts @@ -35,7 +35,7 @@ describe('Timeline Pagination', { tags: ['@ess', '@serverless'] }, () => { }); afterEach(() => { - cy.task('esArchiverUnload', 'timeline'); + cy.task('esArchiverUnload', { archiveName: 'timeline' }); }); it(`should paginate records correctly`, () => { diff --git a/x-pack/test/security_solution_cypress/cypress/support/es_archiver.ts b/x-pack/test/security_solution_cypress/cypress/support/es_archiver.ts index 083b30b12ae51..63ae27669c320 100644 --- a/x-pack/test/security_solution_cypress/cypress/support/es_archiver.ts +++ b/x-pack/test/security_solution_cypress/cypress/support/es_archiver.ts @@ -54,10 +54,34 @@ export const esArchiver = ( baseDir: '../es_archives', }); + const ftrEsArchiverInstance = new EsArchiver({ + log, + client, + kbnClient, + baseDir: '../../functional/es_archives/security_solution', + }); + on('task', { - esArchiverLoad: async ({ archiveName, ...options }) => - esArchiverInstance.load(archiveName, options), - esArchiverUnload: async (archiveName) => esArchiverInstance.unload(archiveName), + esArchiverLoad: async ({ archiveName, type = 'cypress', ...options }) => { + if (type === 'cypress') { + return esArchiverInstance.load(archiveName, options); + } else if (type === 'ftr') { + return ftrEsArchiverInstance.load(archiveName, options); + } else { + throw new Error( + `Unable to load the specified archive: ${JSON.stringify({ archiveName, type, options })}` + ); + } + }, + esArchiverUnload: async ({ archiveName, type = 'cypress' }) => { + if (type === 'cypress') { + return esArchiverInstance.unload(archiveName); + } else if (type === 'ftr') { + return ftrEsArchiverInstance.unload(archiveName); + } else { + throw new Error('It is not possible to unload the archive.'); + } + }, }); return esArchiverInstance;