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