blob: f390488a62eae819e4d486a0b7e1f40314f1a0a3 [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 : {
Ittay Stern6f900cc2018-08-29 17:01:32 +030086 "FLAG_VF_MODULE_RESUME_STATUS_CREATE": false
87 }
88 }).as('initFlags');
89 });
90
Ittay Sternf7926712019-07-07 19:23:03 +030091 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 +030092 cy.wait('@service-complexService');
93
94 checkResumeAndPopup('aa', 'vfModuleTreeNode-pendingactivation');
95 checkResumeAndPopup('gg', 'vfModuleTreeNode-assigned');
96
97 cy.get('.vfModuleTreeNode-created')
98 .getElementByDataTestsId('resumeVFModuleButton-ABC').should('not.be.visible');
99 cy.get('.vfModuleTreeNode-pending-delete')
100 .getElementByDataTestsId('resumeVFModuleButton-my_vfModule').should('not.be.visible');
101
102 });
103
104 it(`Resume button display in orch status - pendingactivation, assigned, created - feature FLAG_VF_MODULE_RESUME_STATUS_CREATE - is ON`, function () {
105
Ittay Sternf7926712019-07-07 19:23:03 +0300106 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 +0300107 cy.wait('@service-complexService');
108
109 checkResumeAndPopup('aa', 'vfModuleTreeNode-pendingactivation');
110 checkResumeAndPopup('gg', 'vfModuleTreeNode-assigned');
111 checkResumeAndPopup('ABC', 'vfModuleTreeNode-created');
112
113 cy.get('.vfModuleTreeNode-pending-delete')
114 .getElementByDataTestsId('resumeVFModuleButton-my_vfModule').should('not.be.visible');
115
116 });
117
118 it(`Delete popup with not homing data from AAI`, function () {
Ittay Sternf7926712019-07-07 19:23:03 +0300119 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 +0300120 cy.wait('@service-complexService');
121 checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true);
Alexey Sandler453a7bd2019-08-22 15:16:48 +0300122 cy.selectDropdownOptionByText('lcpRegion', 'AAIAIC25 (AIC)');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300123 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled');
124 cy.typeToInput("lcpRegionText", "just another region");
125 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled');
126 cy.selectDropdownOptionByText('tenant', 'USP-SIP-IC-24335-T-01');
127 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.have.attr', 'disabled');
Alexey Sandler453a7bd2019-08-22 15:16:48 +0300128 cy.selectDropdownOptionByText('lcpRegion', 'hvf6 (AIC)');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300129 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled');
130 cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testalexandria');
131 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.have.attr', 'disabled');
Alexey Sandler453a7bd2019-08-22 15:16:48 +0300132 cy.getElementByDataTestsId('cancel').click({force: true});
Ittay Stern6f900cc2018-08-29 17:01:32 +0300133 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.be.visible');
134 });
135
136 it(`Soft delete button display with partial homing data from AAI`, function () {
137
Ittay Stern607ea3d2019-10-23 17:10:52 +0300138 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiGetHomingData.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300139 jsonBuilderAaiServiceInstances.basicJson(
140 res,
141 Cypress.config('baseUrl') + "/aai_get_homing_by_vfmodule/c015cc0f-0f37-4488-aabf-53795fd93cd3/a231a99c-7e75-4d6d-a0fb-5c7d26f30f77",
142 200,
143 0,
144 "aai-get-homing-data")
145 });
146
147
Ittay Sternf7926712019-07-07 19:23:03 +0300148 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 +0300149 cy.wait('@service-complexService');
150 checkSoftDeleteAndDeletePopup('my_vfModule', 'vfModuleTreeNode-pending-delete', true, true);
151 cy.getElementByDataTestsId('lcpRegionText').should('be.visible');
Ittay Sternf7926712019-07-07 19:23:03 +0300152 cy.getElementByDataTestsId('lcpRegion').contains('AAIAIC25');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300153 cy.getElementByDataTestsId('tenant').contains('USP-SIP-IC-24335-T-01');
154 });
155
156 it(`Soft delete button display with with homing data from AAI`, function () {
157
158 cy.readFile('../vid-automation/src/test/resources/viewEdit/aaiHomingDataResponse.json').then((res) => {
159 jsonBuilderAaiServiceInstances.basicJson(
160 res,
161 Cypress.config('baseUrl') + "/aai_get_homing_by_vfmodule/0846287b-65bf-45a6-88f6-6a1af4149fac/a9b70ac0-5917-4203-a308-0e6920e6d09b",
162 200,
163 0,
164 "aai-get-homing-data")
165 });
166
Ittay Sternf7926712019-07-07 19:23:03 +0300167 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 +0300168 cy.wait('@service-complexService');
169 checkSoftDeleteAndDeletePopup('vf_module2', 'vfModuleTreeNode-pendingcreate', true, false);
170 });
171
Ittay Sternf7926712019-07-07 19:23:03 +0300172 it(`Soft delete and Delete - Mega region is AAIAIC25 - not 'olson3', 'olson5a'`, function () {
173 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 +0300174 cy.wait('@service-complexService');
175 //Delete
176 checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true);
177 checkLegacyRegion();
178 cy.getElementByDataTestsId('cancel').click();
179 //Soft delete
180 checkSoftDeleteAndDeletePopup('aa', 'vfModuleTreeNode-pendingactivation', true, true);
181 checkLegacyRegion();
182 cy.getElementByDataTestsId('cancel').click();
183 //Resume
184 cy.get('div').find('.vfModuleTreeNode-pendingactivation')
185 .getElementByDataTestsId('resumeVFModuleButton-aa').click().then(()=> {
186 checkLegacyRegion();
187 });
188 });
189
190 function checkLegacyRegion() {
Alexey Sandler453a7bd2019-08-22 15:16:48 +0300191 checkIsLegacyRegionTextIsDisplay('AAIAIC25 (AIC)', true);
192 checkIsLegacyRegionTextIsDisplay('olson3 (AIC)', false);
193 checkIsLegacyRegionTextIsDisplay('olson5a (AIC)', false);
194 checkIsLegacyRegionTextIsDisplay('hvf6 (AIC)', false);
Ittay Stern6f900cc2018-08-29 17:01:32 +0300195 }
196
197 function checkIsLegacyRegionTextIsDisplay(lcpRegionName: string, isVisible: boolean) {
198 const isVisibleText = isVisible ? 'be.visible' : 'not.be.visible';
199 cy.selectDropdownOptionByText('lcpRegion', lcpRegionName);
200 cy.getElementByDataTestsId('lcpRegionText').should(isVisibleText);
201
202 }
203
204 function checkResumeAndPopup(vfModuleName:string, vfModuleClassName:string) {
205 cy.get('div').find('.' + vfModuleClassName)
206 .getElementByDataTestsId('resumeVFModuleButton-' + vfModuleName).click().then(()=> {
207 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('be.visible')
208 .getElementByDataTestsId('softDeleteButton').should('not.be.visible')
209 .getElementByDataTestsId('lcpRegion').should('be.visible')
210 .getElementByDataTestsId('tenant').should('be.visible')
211 .getElementByDataTestsId('modalTitle').contains('Instantiate')
212 .getElementByDataTestsId('confirmResumeDeleteButton').contains('Instantiate')
213 .getElementByDataTestsId('cancel').click();
214 });
215 }
216
217 function checkSoftDeleteAndDeletePopup(vfModuleName:string, vfModuleClassName:string, softDeleteEnable:boolean, isNoHomingData:boolean) {
218 const visibleString = 'be.visible';
219 const NOT = 'not.';
220 const softDeleteVisibleString = (softDeleteEnable) ? visibleString : NOT + visibleString;
221 const isNoHomingDataVisibleString = (isNoHomingData) ? visibleString : NOT + visibleString;
222 cy.get('div').find('.' + vfModuleClassName)
223 .getElementByDataTestsId('deleteVFModuleButton-' + vfModuleName).click({force: true}).then(()=> {
224 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('be.visible')
225 .getElementByDataTestsId('softDeleteButton').should(softDeleteVisibleString)
226 .getElementByDataTestsId('lcpRegion').should(isNoHomingDataVisibleString)
227 .getElementByDataTestsId('tenant').should(isNoHomingDataVisibleString);
228 });
229 }
230 });
231
232
233
234 function changeServiceModel(serviceModel: ServiceModel) {
235 serviceModel.service.uuid = "6e59c5de-f052-46fa-aa7e-2fca9d674c44";
236 return serviceModel;
237 }
238});
239