-
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.
[Security Solution] [Cases] Cypress for case connector selector optio…
…ns (#80745)
- Loading branch information
1 parent
7a77900
commit 99ea48f
Showing
7 changed files
with
412 additions
and
16 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
72 changes: 72 additions & 0 deletions
72
x-pack/plugins/security_solution/cypress/integration/cases_connector_options.spec.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,72 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { loginAndWaitForPageWithoutDateRange } from '../tasks/login'; | ||
import { | ||
case1, | ||
connectorIds, | ||
mockConnectorsResponse, | ||
executeResponses, | ||
ibmResilientConnectorOptions, | ||
jiraConnectorOptions, | ||
serviceNowConnectorOpions, | ||
} from '../objects/case'; | ||
import { | ||
createCase, | ||
fillCasesMandatoryfields, | ||
fillIbmResilientConnectorOptions, | ||
fillJiraConnectorOptions, | ||
fillServiceNowConnectorOptions, | ||
} from '../tasks/create_new_case'; | ||
import { goToCreateNewCase } from '../tasks/all_cases'; | ||
import { deleteCase } from '../tasks/case_details'; | ||
import { CASES_URL } from '../urls/navigation'; | ||
import { CONNECTOR_CARD_DETAILS, CONNECTOR_TITLE } from '../screens/case_details'; | ||
|
||
describe('Cases connector incident fields', () => { | ||
before(() => { | ||
cy.server(); | ||
cy.route('GET', '**/api/cases/configure/connectors/_find', mockConnectorsResponse); | ||
cy.route2('POST', `**/api/actions/action/${connectorIds.jira}/_execute`, (req) => { | ||
const response = | ||
JSON.parse(req.body).params.subAction === 'issueTypes' | ||
? executeResponses.jira.issueTypes | ||
: executeResponses.jira.fieldsByIssueType; | ||
req.reply(JSON.stringify(response)); | ||
}); | ||
cy.route2('POST', `**/api/actions/action/${connectorIds.resilient}/_execute`, (req) => { | ||
const response = | ||
JSON.parse(req.body).params.subAction === 'incidentTypes' | ||
? executeResponses.resilient.incidentTypes | ||
: executeResponses.resilient.severity; | ||
req.reply(JSON.stringify(response)); | ||
}); | ||
}); | ||
|
||
after(() => { | ||
deleteCase(); | ||
}); | ||
|
||
it('Correct incident fields show when connector is changed', () => { | ||
loginAndWaitForPageWithoutDateRange(CASES_URL); | ||
goToCreateNewCase(); | ||
fillCasesMandatoryfields(case1); | ||
fillJiraConnectorOptions(jiraConnectorOptions); | ||
fillServiceNowConnectorOptions(serviceNowConnectorOpions); | ||
fillIbmResilientConnectorOptions(ibmResilientConnectorOptions); | ||
createCase(); | ||
|
||
cy.get(CONNECTOR_TITLE).should('have.text', ibmResilientConnectorOptions.title); | ||
cy.get(CONNECTOR_CARD_DETAILS).should( | ||
'have.text', | ||
`${ | ||
ibmResilientConnectorOptions.title | ||
}Incident Types: ${ibmResilientConnectorOptions.incidentTypes.join(', ')}Severity: ${ | ||
ibmResilientConnectorOptions.severity | ||
}` | ||
); | ||
}); | ||
}); |
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
29 changes: 29 additions & 0 deletions
29
x-pack/plugins/security_solution/cypress/screens/edit_connector.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,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { connectorIds } from '../objects/case'; | ||
|
||
export const CONNECTOR_RESILIENT = `[data-test-subj="connector-settings-resilient"]`; | ||
|
||
export const CONNECTOR_SELECTOR = '[data-test-subj="dropdown-connectors"]'; | ||
|
||
export const SELECT_IMPACT = `[data-test-subj="impactSelect"]`; | ||
|
||
export const SELECT_INCIDENT_TYPE = `[data-test-subj="incidentTypeComboBox"] input[data-test-subj="comboBoxSearchInput"]`; | ||
|
||
export const SELECT_ISSUE_TYPE = `[data-test-subj="issueTypeSelect"]`; | ||
|
||
export const SELECT_JIRA = `[data-test-subj="dropdown-connector-${connectorIds.jira}"]`; | ||
|
||
export const SELECT_PRIORITY = `[data-test-subj="prioritySelect"]`; | ||
|
||
export const SELECT_RESILIENT = `[data-test-subj="dropdown-connector-${connectorIds.resilient}"]`; | ||
|
||
export const SELECT_SEVERITY = `[data-test-subj="severitySelect"]`; | ||
|
||
export const SELECT_SN = `[data-test-subj="dropdown-connector-${connectorIds.sn}"]`; | ||
|
||
export const SELECT_URGENCY = `[data-test-subj="urgencySelect"]`; |
Oops, something went wrong.