-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into eui-ghost/fleet
- Loading branch information
Showing
14 changed files
with
455 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
...ity_solution/public/management/cypress/e2e/response_actions/alerts_response_console.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { closeAllToasts } from '../../tasks/toasts'; | ||
import { | ||
getAlertsTableRows, | ||
openAlertDetailsView, | ||
openInvestigateInTimelineView, | ||
openResponderFromEndpointAlertDetails, | ||
} from '../../screens/alerts'; | ||
import { ensureOnResponder } from '../../screens/responder'; | ||
import { cleanupRule, loadRule } from '../../tasks/api_fixtures'; | ||
import type { PolicyData } from '../../../../../common/endpoint/types'; | ||
import type { CreateAndEnrollEndpointHostResponse } from '../../../../../scripts/endpoint/common/endpoint_host_services'; | ||
import { waitForEndpointListPageToBeLoaded } from '../../tasks/response_console'; | ||
import type { IndexedFleetEndpointPolicyResponse } from '../../../../../common/endpoint/data_loaders/index_fleet_endpoint_policy'; | ||
import { createAgentPolicyTask, getEndpointIntegrationVersion } from '../../tasks/fleet'; | ||
import { toggleRuleOffAndOn, visitRuleAlerts } from '../../tasks/isolate'; | ||
|
||
import { login } from '../../tasks/login'; | ||
import { enableAllPolicyProtections } from '../../tasks/endpoint_policy'; | ||
import { createEndpointHost } from '../../tasks/create_endpoint_host'; | ||
import { deleteAllLoadedEndpointData } from '../../tasks/delete_all_endpoint_data'; | ||
|
||
describe('Response console', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => { | ||
let indexedPolicy: IndexedFleetEndpointPolicyResponse; | ||
let policy: PolicyData; | ||
let createdHost: CreateAndEnrollEndpointHostResponse; | ||
|
||
beforeEach(() => { | ||
login(); | ||
}); | ||
|
||
before(() => { | ||
getEndpointIntegrationVersion().then((version) => | ||
createAgentPolicyTask(version).then((data) => { | ||
indexedPolicy = data; | ||
policy = indexedPolicy.integrationPolicies[0]; | ||
|
||
return enableAllPolicyProtections(policy.id).then(() => { | ||
// Create and enroll a new Endpoint host | ||
return createEndpointHost(policy.policy_id).then((host) => { | ||
createdHost = host as CreateAndEnrollEndpointHostResponse; | ||
}); | ||
}); | ||
}) | ||
); | ||
}); | ||
|
||
after(() => { | ||
if (createdHost) { | ||
cy.task('destroyEndpointHost', createdHost); | ||
} | ||
|
||
if (indexedPolicy) { | ||
cy.task('deleteIndexedFleetEndpointPolicies', indexedPolicy); | ||
} | ||
|
||
if (createdHost) { | ||
deleteAllLoadedEndpointData({ endpointAgentIds: [createdHost.agentId] }); | ||
} | ||
}); | ||
|
||
describe('From Alerts', () => { | ||
let ruleId: string; | ||
let ruleName: string; | ||
|
||
before(() => { | ||
loadRule( | ||
{ query: `agent.name: ${createdHost.hostname} and agent.type: endpoint` }, | ||
false | ||
).then((data) => { | ||
ruleId = data.id; | ||
ruleName = data.name; | ||
}); | ||
}); | ||
|
||
after(() => { | ||
if (ruleId) { | ||
cleanupRule(ruleId); | ||
} | ||
}); | ||
|
||
it('should open responder from alert details flyout', () => { | ||
waitForEndpointListPageToBeLoaded(createdHost.hostname); | ||
toggleRuleOffAndOn(ruleName); | ||
visitRuleAlerts(ruleName); | ||
closeAllToasts(); | ||
getAlertsTableRows().should('have.length.greaterThan', 0); | ||
openAlertDetailsView(); | ||
|
||
openResponderFromEndpointAlertDetails(); | ||
ensureOnResponder(); | ||
}); | ||
|
||
it('should open responder from timeline view alert details flyout', () => { | ||
waitForEndpointListPageToBeLoaded(createdHost.hostname); | ||
toggleRuleOffAndOn(ruleName); | ||
visitRuleAlerts(ruleName); | ||
closeAllToasts(); | ||
|
||
getAlertsTableRows().should('have.length.greaterThan', 0); | ||
openInvestigateInTimelineView(); | ||
cy.getByTestSubj('timeline-flyout').within(() => { | ||
openAlertDetailsView(); | ||
}); | ||
openResponderFromEndpointAlertDetails(); | ||
ensureOnResponder(); | ||
}); | ||
}); | ||
}); |
122 changes: 122 additions & 0 deletions
122
...rity_solution/public/management/cypress/e2e/response_actions/cases_response_console.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { loadPage } from '../../tasks/common'; | ||
import { closeAllToasts } from '../../tasks/toasts'; | ||
import { | ||
addAlertToCase, | ||
getAlertsTableRows, | ||
openAlertDetailsView, | ||
openResponderFromEndpointAlertDetails, | ||
} from '../../screens/alerts'; | ||
import { ensureOnResponder } from '../../screens/responder'; | ||
import { cleanupCase, cleanupRule, loadCase, loadRule } from '../../tasks/api_fixtures'; | ||
import type { PolicyData } from '../../../../../common/endpoint/types'; | ||
import type { CreateAndEnrollEndpointHostResponse } from '../../../../../scripts/endpoint/common/endpoint_host_services'; | ||
import { waitForEndpointListPageToBeLoaded } from '../../tasks/response_console'; | ||
import type { IndexedFleetEndpointPolicyResponse } from '../../../../../common/endpoint/data_loaders/index_fleet_endpoint_policy'; | ||
import { createAgentPolicyTask, getEndpointIntegrationVersion } from '../../tasks/fleet'; | ||
import { openCaseAlertDetails, toggleRuleOffAndOn, visitRuleAlerts } from '../../tasks/isolate'; | ||
|
||
import { login } from '../../tasks/login'; | ||
import { enableAllPolicyProtections } from '../../tasks/endpoint_policy'; | ||
import { createEndpointHost } from '../../tasks/create_endpoint_host'; | ||
import { deleteAllLoadedEndpointData } from '../../tasks/delete_all_endpoint_data'; | ||
import { APP_CASES_PATH } from '../../../../../common/constants'; | ||
|
||
describe('Response console', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => { | ||
let indexedPolicy: IndexedFleetEndpointPolicyResponse; | ||
let policy: PolicyData; | ||
let createdHost: CreateAndEnrollEndpointHostResponse; | ||
|
||
before(() => { | ||
getEndpointIntegrationVersion().then((version) => | ||
createAgentPolicyTask(version).then((data) => { | ||
indexedPolicy = data; | ||
policy = indexedPolicy.integrationPolicies[0]; | ||
|
||
return enableAllPolicyProtections(policy.id).then(() => { | ||
// Create and enroll a new Endpoint host | ||
return createEndpointHost(policy.policy_id).then((host) => { | ||
createdHost = host as CreateAndEnrollEndpointHostResponse; | ||
}); | ||
}); | ||
}) | ||
); | ||
}); | ||
|
||
beforeEach(() => { | ||
login(); | ||
}); | ||
|
||
after(() => { | ||
if (createdHost) { | ||
cy.task('destroyEndpointHost', createdHost); | ||
} | ||
|
||
if (indexedPolicy) { | ||
cy.task('deleteIndexedFleetEndpointPolicies', indexedPolicy); | ||
} | ||
|
||
if (createdHost) { | ||
deleteAllLoadedEndpointData({ endpointAgentIds: [createdHost.agentId] }); | ||
} | ||
}); | ||
|
||
describe('From Cases', () => { | ||
let ruleId: string; | ||
let ruleName: string; | ||
let caseId: string; | ||
const caseOwner = 'securitySolution'; | ||
|
||
beforeEach(() => { | ||
loadRule( | ||
{ query: `agent.name: ${createdHost.hostname} and agent.type: endpoint` }, | ||
false | ||
).then((data) => { | ||
ruleId = data.id; | ||
ruleName = data.name; | ||
}); | ||
loadCase(caseOwner).then((data) => { | ||
caseId = data.id; | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
if (ruleId) { | ||
cleanupRule(ruleId); | ||
} | ||
if (caseId) { | ||
cleanupCase(caseId); | ||
} | ||
}); | ||
|
||
it('should open responder', () => { | ||
waitForEndpointListPageToBeLoaded(createdHost.hostname); | ||
toggleRuleOffAndOn(ruleName); | ||
visitRuleAlerts(ruleName); | ||
closeAllToasts(); | ||
|
||
getAlertsTableRows().should('have.length.greaterThan', 0); | ||
openAlertDetailsView(); | ||
addAlertToCase(caseId, caseOwner); | ||
|
||
// visit case details page | ||
cy.intercept('GET', `/api/cases/${caseId}/user_actions/_find*`).as('case'); | ||
loadPage(`${APP_CASES_PATH}/${caseId}`); | ||
|
||
cy.wait('@case', { timeout: 30000 }).then(({ response: res }) => { | ||
const caseAlertId = res?.body.userActions[1].id; | ||
closeAllToasts(); | ||
openCaseAlertDetails(caseAlertId); | ||
}); | ||
|
||
openResponderFromEndpointAlertDetails(); | ||
ensureOnResponder(); | ||
}); | ||
}); | ||
}); |
69 changes: 69 additions & 0 deletions
69
...tion/public/management/cypress/e2e/response_actions/endpoints_list_response_console.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { ensureOnResponder } from '../../screens/responder'; | ||
import type { PolicyData } from '../../../../../common/endpoint/types'; | ||
import type { CreateAndEnrollEndpointHostResponse } from '../../../../../scripts/endpoint/common/endpoint_host_services'; | ||
import { | ||
openResponseConsoleFromEndpointList, | ||
waitForEndpointListPageToBeLoaded, | ||
} from '../../tasks/response_console'; | ||
import type { IndexedFleetEndpointPolicyResponse } from '../../../../../common/endpoint/data_loaders/index_fleet_endpoint_policy'; | ||
import { createAgentPolicyTask, getEndpointIntegrationVersion } from '../../tasks/fleet'; | ||
|
||
import { login } from '../../tasks/login'; | ||
import { enableAllPolicyProtections } from '../../tasks/endpoint_policy'; | ||
import { createEndpointHost } from '../../tasks/create_endpoint_host'; | ||
import { deleteAllLoadedEndpointData } from '../../tasks/delete_all_endpoint_data'; | ||
|
||
describe('Response console', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => { | ||
beforeEach(() => { | ||
login(); | ||
}); | ||
|
||
describe('From endpoint list', () => { | ||
let indexedPolicy: IndexedFleetEndpointPolicyResponse; | ||
let policy: PolicyData; | ||
let createdHost: CreateAndEnrollEndpointHostResponse; | ||
|
||
before(() => { | ||
getEndpointIntegrationVersion().then((version) => | ||
createAgentPolicyTask(version).then((data) => { | ||
indexedPolicy = data; | ||
policy = indexedPolicy.integrationPolicies[0]; | ||
|
||
return enableAllPolicyProtections(policy.id).then(() => { | ||
// Create and enroll a new Endpoint host | ||
return createEndpointHost(policy.policy_id).then((host) => { | ||
createdHost = host as CreateAndEnrollEndpointHostResponse; | ||
}); | ||
}); | ||
}) | ||
); | ||
}); | ||
|
||
after(() => { | ||
if (createdHost) { | ||
cy.task('destroyEndpointHost', createdHost); | ||
} | ||
|
||
if (indexedPolicy) { | ||
cy.task('deleteIndexedFleetEndpointPolicies', indexedPolicy); | ||
} | ||
|
||
if (createdHost) { | ||
deleteAllLoadedEndpointData({ endpointAgentIds: [createdHost.agentId] }); | ||
} | ||
}); | ||
|
||
it('should open responder', () => { | ||
waitForEndpointListPageToBeLoaded(createdHost.hostname); | ||
openResponseConsoleFromEndpointList(); | ||
ensureOnResponder(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.