blob: ef1db686432b3b42ffbc1f7fb89d5c248056ec77 [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';
Ittay Stern6f900cc2018-08-29 17:01:32 +03003import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
4import {AaiServiceInstancesModel} from '../../support/jsonBuilders/models/serviceInstances.model';
5import {AAISubDetailsModel} from '../../support/jsonBuilders/models/aaiSubDetails.model';
6import {AAISubViewEditModel} from '../../support/jsonBuilders/models/aaiSubViewEdit.model';
7
8describe('Soft delete tests', function () {
9 describe('basic UI tests', () => {
10
11 var jsonBuilderAAIService: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
12 var jsonBuilderAAISubViewEditModel: JsonBuilder<AAISubViewEditModel> = new JsonBuilder<AAISubViewEditModel>();
13 var jsonBuilderAAISubDetailsModel: JsonBuilder<AAISubDetailsModel> = new JsonBuilder<AAISubDetailsModel>();
14 var jsonBuilderAaiServiceInstances: JsonBuilder<AaiServiceInstancesModel> = new JsonBuilder<AaiServiceInstancesModel>();
15 beforeEach(() => {
Ittay Stern607ea3d2019-10-23 17:10:52 +030016 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030017 jsonBuilderAAIService.basicJson(
18 res,
19 Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d674c44",
20 200, 0,
21 "service-complexService",
22 changeServiceModel)
23 });
24
25
Ittay Stern607ea3d2019-10-23 17:10:52 +030026 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForServiceWithSomeVFModule.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030027 jsonBuilderAAISubViewEditModel.basicJson(
28 res,
29 Cypress.config('baseUrl') + "/aai_sub_viewedit/**/**/**/3f93c7cb-2fd0-4557-9514-e189b7b04f9d",
30 200,
31 0,
32 "aai-sub-view-edit")
33 });
34
Ittay Stern607ea3d2019-10-23 17:10:52 +030035 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030036 jsonBuilderAAISubDetailsModel.basicJson(
37 res,
38 Cypress.config('baseUrl') + "/aai_sub_details/**",
39 200,
40 0,
41 "aai-sub-details")
42 });
43
Ittay Stern607ea3d2019-10-23 17:10:52 +030044 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiServiceInstances.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030045 jsonBuilderAaiServiceInstances.basicJson(
46 res,
47 Cypress.config('baseUrl') + "/search_service_instances**",
48 200,
49 0,
50 "aai-get-service-instances")
51 });
52
53 cy.initVidMock();
54
55 cy.initTenants();
56
57 cy.login();
58 });
59
60 afterEach(() => {
61 cy.screenshot();
62 });
63
64 it(`Soft delete button will be display also if base module is true`, function () {
Ittay Sternf7926712019-07-07 19:23:03 +030065 cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
Ittay Stern6f900cc2018-08-29 17:01:32 +030066 cy.wait('@service-complexService');
67 checkSoftDeleteAndDeletePopup('aa', 'vfModuleTreeNode-pendingactivation', true, true);
68 });
69
70 it(`Soft delete button not display in assigned orch status`, function () {
Ittay Sternf7926712019-07-07 19:23:03 +030071 cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
Ittay Stern6f900cc2018-08-29 17:01:32 +030072 cy.wait('@service-complexService');
73 checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true);
74 });
75
76 it(`Resume button display in orch status - pendingactivation, assigned - feature FLAG_VF_MODULE_RESUME_STATUS_CREATE - is OFF`, function () {
77
Sara Weisseed69432019-11-20 14:50:33 +020078 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json').then(() => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030079 cy.server()
80 .route({
81 method: 'GET',
82 delay : 0,
83 status : 200,
84 url : Cypress.config('baseUrl') + "/flags**",
85 response : {
86 "FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE": true,
87 "FLAG_VF_MODULE_RESUME_STATUS_CREATE": false
88 }
89 }).as('initFlags');
90 });
91
Ittay Sternf7926712019-07-07 19:23:03 +030092 cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
Ittay Stern6f900cc2018-08-29 17:01:32 +030093 cy.wait('@service-complexService');
94
95 checkResumeAndPopup('aa', 'vfModuleTreeNode-pendingactivation');
96 checkResumeAndPopup('gg', 'vfModuleTreeNode-assigned');
97
98 cy.get('.vfModuleTreeNode-created')
99 .getElementByDataTestsId('resumeVFModuleButton-ABC').should('not.be.visible');
100 cy.get('.vfModuleTreeNode-pending-delete')
101 .getElementByDataTestsId('resumeVFModuleButton-my_vfModule').should('not.be.visible');
102
103 });
104
105 it(`Resume button display in orch status - pendingactivation, assigned, created - feature FLAG_VF_MODULE_RESUME_STATUS_CREATE - is ON`, function () {
106
Ittay Sternf7926712019-07-07 19:23:03 +0300107 cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300108 cy.wait('@service-complexService');
109
110 checkResumeAndPopup('aa', 'vfModuleTreeNode-pendingactivation');
111 checkResumeAndPopup('gg', 'vfModuleTreeNode-assigned');
112 checkResumeAndPopup('ABC', 'vfModuleTreeNode-created');
113
114 cy.get('.vfModuleTreeNode-pending-delete')
115 .getElementByDataTestsId('resumeVFModuleButton-my_vfModule').should('not.be.visible');
116
117 });
118
119 it(`Delete popup with not homing data from AAI`, function () {
Ittay Sternf7926712019-07-07 19:23:03 +0300120 cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300121 cy.wait('@service-complexService');
122 checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true);
Alexey Sandler453a7bd2019-08-22 15:16:48 +0300123 cy.selectDropdownOptionByText('lcpRegion', 'AAIAIC25 (AIC)');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300124 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled');
125 cy.typeToInput("lcpRegionText", "just another region");
126 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled');
127 cy.selectDropdownOptionByText('tenant', 'USP-SIP-IC-24335-T-01');
128 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.have.attr', 'disabled');
Alexey Sandler453a7bd2019-08-22 15:16:48 +0300129 cy.selectDropdownOptionByText('lcpRegion', 'hvf6 (AIC)');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300130 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled');
131 cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testalexandria');
132 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.have.attr', 'disabled');
Alexey Sandler453a7bd2019-08-22 15:16:48 +0300133 cy.getElementByDataTestsId('cancel').click({force: true});
Ittay Stern6f900cc2018-08-29 17:01:32 +0300134 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.be.visible');
135 });
136
137 it(`Soft delete button display with partial homing data from AAI`, function () {
138
Ittay Stern607ea3d2019-10-23 17:10:52 +0300139 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiGetHomingData.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300140 jsonBuilderAaiServiceInstances.basicJson(
141 res,
142 Cypress.config('baseUrl') + "/aai_get_homing_by_vfmodule/c015cc0f-0f37-4488-aabf-53795fd93cd3/a231a99c-7e75-4d6d-a0fb-5c7d26f30f77",
143 200,
144 0,
145 "aai-get-homing-data")
146 });
147
148
Ittay Sternf7926712019-07-07 19:23:03 +0300149 cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300150 cy.wait('@service-complexService');
151 checkSoftDeleteAndDeletePopup('my_vfModule', 'vfModuleTreeNode-pending-delete', true, true);
152 cy.getElementByDataTestsId('lcpRegionText').should('be.visible');
Ittay Sternf7926712019-07-07 19:23:03 +0300153 cy.getElementByDataTestsId('lcpRegion').contains('AAIAIC25');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300154 cy.getElementByDataTestsId('tenant').contains('USP-SIP-IC-24335-T-01');
155 });
156
157 it(`Soft delete button display with with homing data from AAI`, function () {
158
159 cy.readFile('../vid-automation/src/test/resources/viewEdit/aaiHomingDataResponse.json').then((res) => {
160 jsonBuilderAaiServiceInstances.basicJson(
161 res,
162 Cypress.config('baseUrl') + "/aai_get_homing_by_vfmodule/0846287b-65bf-45a6-88f6-6a1af4149fac/a9b70ac0-5917-4203-a308-0e6920e6d09b",
163 200,
164 0,
165 "aai-get-homing-data")
166 });
167
Ittay Sternf7926712019-07-07 19:23:03 +0300168 cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300169 cy.wait('@service-complexService');
170 checkSoftDeleteAndDeletePopup('vf_module2', 'vfModuleTreeNode-pendingcreate', true, false);
171 });
172
Ittay Sternf7926712019-07-07 19:23:03 +0300173 it(`Soft delete and Delete - Mega region is AAIAIC25 - not 'olson3', 'olson5a'`, function () {
174 cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300175 cy.wait('@service-complexService');
176 //Delete
177 checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true);
178 checkLegacyRegion();
179 cy.getElementByDataTestsId('cancel').click();
180 //Soft delete
181 checkSoftDeleteAndDeletePopup('aa', 'vfModuleTreeNode-pendingactivation', true, true);
182 checkLegacyRegion();
183 cy.getElementByDataTestsId('cancel').click();
184 //Resume
185 cy.get('div').find('.vfModuleTreeNode-pendingactivation')
186 .getElementByDataTestsId('resumeVFModuleButton-aa').click().then(()=> {
187 checkLegacyRegion();
188 });
189 });
190
191 function checkLegacyRegion() {
Alexey Sandler453a7bd2019-08-22 15:16:48 +0300192 checkIsLegacyRegionTextIsDisplay('AAIAIC25 (AIC)', true);
193 checkIsLegacyRegionTextIsDisplay('olson3 (AIC)', false);
194 checkIsLegacyRegionTextIsDisplay('olson5a (AIC)', false);
195 checkIsLegacyRegionTextIsDisplay('hvf6 (AIC)', false);
Ittay Stern6f900cc2018-08-29 17:01:32 +0300196 }
197
198 function checkIsLegacyRegionTextIsDisplay(lcpRegionName: string, isVisible: boolean) {
199 const isVisibleText = isVisible ? 'be.visible' : 'not.be.visible';
200 cy.selectDropdownOptionByText('lcpRegion', lcpRegionName);
201 cy.getElementByDataTestsId('lcpRegionText').should(isVisibleText);
202
203 }
204
205 function checkResumeAndPopup(vfModuleName:string, vfModuleClassName:string) {
206 cy.get('div').find('.' + vfModuleClassName)
207 .getElementByDataTestsId('resumeVFModuleButton-' + vfModuleName).click().then(()=> {
208 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('be.visible')
209 .getElementByDataTestsId('softDeleteButton').should('not.be.visible')
210 .getElementByDataTestsId('lcpRegion').should('be.visible')
211 .getElementByDataTestsId('tenant').should('be.visible')
212 .getElementByDataTestsId('modalTitle').contains('Instantiate')
213 .getElementByDataTestsId('confirmResumeDeleteButton').contains('Instantiate')
214 .getElementByDataTestsId('cancel').click();
215 });
216 }
217
218 function checkSoftDeleteAndDeletePopup(vfModuleName:string, vfModuleClassName:string, softDeleteEnable:boolean, isNoHomingData:boolean) {
219 const visibleString = 'be.visible';
220 const NOT = 'not.';
221 const softDeleteVisibleString = (softDeleteEnable) ? visibleString : NOT + visibleString;
222 const isNoHomingDataVisibleString = (isNoHomingData) ? visibleString : NOT + visibleString;
223 cy.get('div').find('.' + vfModuleClassName)
224 .getElementByDataTestsId('deleteVFModuleButton-' + vfModuleName).click({force: true}).then(()=> {
225 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('be.visible')
226 .getElementByDataTestsId('softDeleteButton').should(softDeleteVisibleString)
227 .getElementByDataTestsId('lcpRegion').should(isNoHomingDataVisibleString)
228 .getElementByDataTestsId('tenant').should(isNoHomingDataVisibleString);
229 });
230 }
231 });
232
233
234
235 function changeServiceModel(serviceModel: ServiceModel) {
236 serviceModel.service.uuid = "6e59c5de-f052-46fa-aa7e-2fca9d674c44";
237 return serviceModel;
238 }
239});
240