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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
|
///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
import {PnfModel} from '../../support/jsonBuilders/models/pnf.model';
import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
import {AaiServiceInstancesModel} from '../../support/jsonBuilders/models/serviceInstances.model';
import {AAISubDetailsModel} from '../../support/jsonBuilders/models/aaiSubDetails.model';
import {AAISubViewEditModel} from '../../support/jsonBuilders/models/aaiSubViewEdit.model';
describe('Soft delete tests', function () {
describe('basic UI tests', () => {
var jsonBuilderAAIService: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
var jsonBuilderAAISubViewEditModel: JsonBuilder<AAISubViewEditModel> = new JsonBuilder<AAISubViewEditModel>();
var jsonBuilderAAISubDetailsModel: JsonBuilder<AAISubDetailsModel> = new JsonBuilder<AAISubDetailsModel>();
var jsonBuilderAaiServiceInstances: JsonBuilder<AaiServiceInstancesModel> = new JsonBuilder<AaiServiceInstancesModel>();
beforeEach(() => {
cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => {
jsonBuilderAAIService.basicJson(
res,
Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d674c44",
200, 0,
"service-complexService",
changeServiceModel)
});
cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForServiceWithSomeVFModule.json').then((res) => {
jsonBuilderAAISubViewEditModel.basicJson(
res,
Cypress.config('baseUrl') + "/aai_sub_viewedit/**/**/**/3f93c7cb-2fd0-4557-9514-e189b7b04f9d",
200,
0,
"aai-sub-view-edit")
});
cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => {
jsonBuilderAAISubDetailsModel.basicJson(
res,
Cypress.config('baseUrl') + "/aai_sub_details/**",
200,
0,
"aai-sub-details")
});
cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiServiceInstances.json').then((res) => {
jsonBuilderAaiServiceInstances.basicJson(
res,
Cypress.config('baseUrl') + "/search_service_instances**",
200,
0,
"aai-get-service-instances")
});
cy.initVidMock();
cy.initTenants();
cy.login();
});
afterEach(() => {
cy.screenshot();
});
it(`Soft delete button will be display also if base module is true`, function () {
cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=USP%20VOICE&serviceType=VIRTUAL%20USP&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
cy.wait('@service-complexService');
checkSoftDeleteAndDeletePopup('aa', 'vfModuleTreeNode-pendingactivation', true, true);
});
it(`Soft delete button not display in assigned orch status`, function () {
cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=USP%20VOICE&serviceType=VIRTUAL%20USP&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
cy.wait('@service-complexService');
checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true);
});
it(`Resume button display in orch status - pendingactivation, assigned - feature FLAG_VF_MODULE_RESUME_STATUS_CREATE - is OFF`, function () {
cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/flags.json').then((res) => {
cy.server()
.route({
method: 'GET',
delay : 0,
status : 200,
url : Cypress.config('baseUrl') + "/flags**",
response : {
"FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE": true,
"FLAG_VF_MODULE_RESUME_STATUS_CREATE": false
}
}).as('initFlags');
});
cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=USP%20VOICE&serviceType=VIRTUAL%20USP&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
cy.wait('@service-complexService');
checkResumeAndPopup('aa', 'vfModuleTreeNode-pendingactivation');
checkResumeAndPopup('gg', 'vfModuleTreeNode-assigned');
cy.get('.vfModuleTreeNode-created')
.getElementByDataTestsId('resumeVFModuleButton-ABC').should('not.be.visible');
cy.get('.vfModuleTreeNode-pending-delete')
.getElementByDataTestsId('resumeVFModuleButton-my_vfModule').should('not.be.visible');
});
it(`Resume button display in orch status - pendingactivation, assigned, created - feature FLAG_VF_MODULE_RESUME_STATUS_CREATE - is ON`, function () {
cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=USP%20VOICE&serviceType=VIRTUAL%20USP&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
cy.wait('@service-complexService');
checkResumeAndPopup('aa', 'vfModuleTreeNode-pendingactivation');
checkResumeAndPopup('gg', 'vfModuleTreeNode-assigned');
checkResumeAndPopup('ABC', 'vfModuleTreeNode-created');
cy.get('.vfModuleTreeNode-pending-delete')
.getElementByDataTestsId('resumeVFModuleButton-my_vfModule').should('not.be.visible');
});
it(`Delete popup with not homing data from AAI`, function () {
cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=USP%20VOICE&serviceType=VIRTUAL%20USP&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
cy.wait('@service-complexService');
checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true);
cy.selectDropdownOptionByText('lcpRegion', 'JANET25');
cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled');
cy.typeToInput("lcpRegionText", "just another region");
cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled');
cy.selectDropdownOptionByText('tenant', 'USP-SIP-IC-24335-T-01');
cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.have.attr', 'disabled');
cy.selectDropdownOptionByText('lcpRegion', 'hvf6');
cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled');
cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testalexandria');
cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.have.attr', 'disabled');
cy.getElementByDataTestsId('cancel').click({force: true})
cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.be.visible');
});
it(`Soft delete button display with partial homing data from AAI`, function () {
cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/aaiGetHomingData.json').then((res) => {
jsonBuilderAaiServiceInstances.basicJson(
res,
Cypress.config('baseUrl') + "/aai_get_homing_by_vfmodule/c015cc0f-0f37-4488-aabf-53795fd93cd3/a231a99c-7e75-4d6d-a0fb-5c7d26f30f77",
200,
0,
"aai-get-homing-data")
});
cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=USP%20VOICE&serviceType=VIRTUAL%20USP&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
cy.wait('@service-complexService');
checkSoftDeleteAndDeletePopup('my_vfModule', 'vfModuleTreeNode-pending-delete', true, true);
cy.getElementByDataTestsId('lcpRegionText').should('be.visible');
cy.getElementByDataTestsId('lcpRegion').contains('JANET25');
cy.getElementByDataTestsId('tenant').contains('USP-SIP-IC-24335-T-01');
});
it(`Soft delete button display with with homing data from AAI`, function () {
cy.readFile('../vid-automation/src/test/resources/viewEdit/aaiHomingDataResponse.json').then((res) => {
jsonBuilderAaiServiceInstances.basicJson(
res,
Cypress.config('baseUrl') + "/aai_get_homing_by_vfmodule/0846287b-65bf-45a6-88f6-6a1af4149fac/a9b70ac0-5917-4203-a308-0e6920e6d09b",
200,
0,
"aai-get-homing-data")
});
cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=USP%20VOICE&serviceType=VIRTUAL%20USP&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
cy.wait('@service-complexService');
checkSoftDeleteAndDeletePopup('vf_module2', 'vfModuleTreeNode-pendingcreate', true, false);
});
it(`Soft delete and Delete - Mega region is JANET25 - not 'olson3', 'olson5a'`, function () {
cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=USP%20VOICE&serviceType=VIRTUAL%20USP&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
cy.wait('@service-complexService');
//Delete
checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true);
checkLegacyRegion();
cy.getElementByDataTestsId('cancel').click();
//Soft delete
checkSoftDeleteAndDeletePopup('aa', 'vfModuleTreeNode-pendingactivation', true, true);
checkLegacyRegion();
cy.getElementByDataTestsId('cancel').click();
//Resume
cy.get('div').find('.vfModuleTreeNode-pendingactivation')
.getElementByDataTestsId('resumeVFModuleButton-aa').click().then(()=> {
checkLegacyRegion();
});
});
function checkLegacyRegion() {
checkIsLegacyRegionTextIsDisplay('JANET25', true);
checkIsLegacyRegionTextIsDisplay('olson3', false);
checkIsLegacyRegionTextIsDisplay('olson5a', false);
checkIsLegacyRegionTextIsDisplay('hvf6', false);
}
function checkIsLegacyRegionTextIsDisplay(lcpRegionName: string, isVisible: boolean) {
const isVisibleText = isVisible ? 'be.visible' : 'not.be.visible';
cy.selectDropdownOptionByText('lcpRegion', lcpRegionName);
cy.getElementByDataTestsId('lcpRegionText').should(isVisibleText);
}
function checkResumeAndPopup(vfModuleName:string, vfModuleClassName:string) {
cy.get('div').find('.' + vfModuleClassName)
.getElementByDataTestsId('resumeVFModuleButton-' + vfModuleName).click().then(()=> {
cy.getElementByDataTestsId('confirmResumeDeleteButton').should('be.visible')
.getElementByDataTestsId('softDeleteButton').should('not.be.visible')
.getElementByDataTestsId('lcpRegion').should('be.visible')
.getElementByDataTestsId('tenant').should('be.visible')
.getElementByDataTestsId('modalTitle').contains('Instantiate')
.getElementByDataTestsId('confirmResumeDeleteButton').contains('Instantiate')
.getElementByDataTestsId('cancel').click();
});
}
function checkSoftDeleteAndDeletePopup(vfModuleName:string, vfModuleClassName:string, softDeleteEnable:boolean, isNoHomingData:boolean) {
const visibleString = 'be.visible';
const NOT = 'not.';
const softDeleteVisibleString = (softDeleteEnable) ? visibleString : NOT + visibleString;
const isNoHomingDataVisibleString = (isNoHomingData) ? visibleString : NOT + visibleString;
cy.get('div').find('.' + vfModuleClassName)
.getElementByDataTestsId('deleteVFModuleButton-' + vfModuleName).click({force: true}).then(()=> {
cy.getElementByDataTestsId('confirmResumeDeleteButton').should('be.visible')
.getElementByDataTestsId('softDeleteButton').should(softDeleteVisibleString)
.getElementByDataTestsId('lcpRegion').should(isNoHomingDataVisibleString)
.getElementByDataTestsId('tenant').should(isNoHomingDataVisibleString);
});
}
});
function changeServiceModel(serviceModel: ServiceModel) {
serviceModel.service.uuid = "6e59c5de-f052-46fa-aa7e-2fca9d674c44";
return serviceModel;
}
});
|