forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcases_connector_options.spec.ts
72 lines (67 loc) · 2.5 KB
/
cases_connector_options.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
}`
);
});
});