blob: 5db0c751db1b59a4f442ed3a2e3abc17384ff2b4 [file] [log] [blame]
Ittay Stern6f900cc2018-08-29 17:01:32 +03001///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
3import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
4
5describe('Vnf Groups', function () {
6 var jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
7
8 beforeEach(() => {
9 cy.window().then((win) => {
10 win.sessionStorage.clear();
11 cy.setReduxState();
12 cy.preventErrorsOnLoading();
13 cy.initAAIMock();
14 cy.initVidMock();
15 cy.permissionVidMock();
16 cy.setTestApiParamToVNF();
17 cy.login();
18 });
19 });
20
21 afterEach(() => {
22 cy.screenshot();
23 });
24
25 describe('Vnf Group model basic view', function () {
26
27 it('Vnf group open new view edit', function () {
28 const instanceName: string = 'ABC';
29 const groupName = 'groupingservicefortest..ResourceInstanceGroup..0';
30 const nodeId = 'daeb6568-cef8-417f-9075-ed259ce59f48';
31 const serviceId = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
32 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
33 jsonBuilderAndMock.basicJson(
34 res,
35 Cypress.config('baseUrl') + "/rest/models/services/" + serviceId,
36 200,
37 0,
38 "ServiceWithVnfGroup",
39 );
40
41 cy.buildReduxStateWithServiceRespone(res, serviceId, false);
42 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=' + serviceId);
43 cy.getElementByDataTestsId('node-' + groupName).find(`[data-tests-id='node-type-indicator']`).contains('G');
44 cy.getElementByDataTestsId('node-' + groupName).contains('' + groupName);
45 cy.getElementByDataTestsId('node-' + groupName + '-add-btn').get('i').should('have.class', 'fa-plus-circle');
46 cy.getElementByDataTestsId('node-' + groupName + '-add-btn').click({force: true});
47 cy.getElementByDataTestsId('instanceName').clear();
48 cy.typeToInput('instanceName', instanceName);
49 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
50 cy.getElementByDataTestsId('numberButton').contains('1');
51 cy.getElementByDataTestsId('node-' + nodeId + '-' + groupName).contains(instanceName);
52 cy.getElementByDataTestsId('node-' + nodeId + '-' + groupName + '-menu-btn')
53 .click({force: true});
54 cy.getElementByDataTestsId('context-menu-edit').click();
55 cy.getElementByDataTestsId('instanceName').clear();
56 cy.typeToInput('instanceName', instanceName + instanceName);
57 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
58 cy.getElementByDataTestsId('node-' + nodeId + '-' + groupName + '-menu-btn').click({force: true})
59 .getElementByDataTestsId('context-menu-remove').click();
60 });
61 });
62 });
63 });
64
65 it('Create new service with vnf group', () => {
66
67 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
68 const GROUP_NAME_TO_DEPLOY = 'groupingservicefortest..ResourceInstanceGroup..1';
69 const NODE_ID = 'c2b300e6-45de-4e5e-abda-3032bee2de56';
70 let serviceModel: JSON;
71 let basicServiceInstance: JSON;
72
73 cy.server().route({
74 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
75 method: 'POST',
76 status: 200,
77 response: "[]",
78 }).as("expectedPostAsyncInstantiation");
79
80 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
81 serviceModel = res;
82 });
83
84 cy.readFile('./cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json').then((res) => {
85 basicServiceInstance = res;
86 });
87
88 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((reduxRes) => {
89
90 reduxRes.service.serviceHierarchy[SERVICE_MODEL_ID] = serviceModel;
91 reduxRes.service.serviceInstance[SERVICE_MODEL_ID] = basicServiceInstance;
92
93 cy.setReduxState(<any>reduxRes);
94
95 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=' + SERVICE_MODEL_ID);
96 cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY).find(`[data-tests-id='node-type-indicator']`).contains('G');
97 cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY).contains('' + GROUP_NAME_TO_DEPLOY);
98 cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY + '-add-btn').get('i').should('have.class', 'fa-plus-circle');
99 cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY + '-add-btn').click({force: true});
100 cy.getElementByDataTestsId('node-' + NODE_ID + '-' + GROUP_NAME_TO_DEPLOY + '-menu-btn')
101 .click({force: true});
102 cy.getElementByDataTestsId('context-menu-edit').click();
103 cy.getElementByDataTestsId('instanceName').clear();
104 cy.typeToInput('instanceName', "ABC");
105 cy.getElementByDataTestsId('form-set').click({force: true});
106 cy.getElementByDataTestsId('deployBtn').should('have.text', 'DEPLOY').click();
107 cy.getElementByDataTestsId('isViewOnly-status-test').contains('IN DESIGN');
108 cy.getReduxState().then((state) => {
109 const vnfGroup = state.service.serviceInstance[SERVICE_MODEL_ID].vnfGroups[GROUP_NAME_TO_DEPLOY];
110
111 cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
112 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupCreateRequest.json').then((expectedResult) => {
113 expectedResult.vnfGroups[GROUP_NAME_TO_DEPLOY].trackById = vnfGroup.trackById;
114 cy.deepCompare(xhr.request.body, expectedResult);
115 });
116 });
117 });
118
119 });
120
121 });
122
123 it('Delete vnf group with members', () => {
124 cy.initSearchVNFMemebers();
125 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
126 let serviceModel: JSON;
127 let basicServiceInstance: JSON;
128
129 cy.server().route({
130 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
131 method: 'POST',
132 status: 200,
133 response: "[]",
134 }).as("expectedPostAsyncInstantiation");
135
136 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
137 serviceModel = res;
138 });
139
140 cy.readFile('./cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json').then((res) => {
141 basicServiceInstance = res;
142 });
143
144 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((reduxRes) => {
145
146 reduxRes.service.serviceHierarchy[SERVICE_MODEL_ID] = serviceModel;
147 reduxRes.service.serviceInstance[SERVICE_MODEL_ID] = basicServiceInstance;
148
149 cy.setReduxState(<any>reduxRes);
150
151 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=' + SERVICE_MODEL_ID);
152 cy.getElementByDataTestsId('node-groupingservicefortest..ResourceInstanceGroup..0-add-btn').click({force: true});
153 removeVnfGroup();
154 cy.getElementByDataTestsId('node-groupingservicefortest..ResourceInstanceGroup..0-add-btn').click({force: true});
155 cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
156 .click({force: true});
157 cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
158 cy.get('.allCheckboxAreSelected input').click({force: true});
159 cy.getElementByDataTestsId('setMembersBtn').click({force: true})
160 });
161 cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0').click({force: true});
162 removeVnfGroup();
163 cy.getElementByDataTestsId('button-remove-group').click({force: true});
164 cy.get('#model-actions').should('not.exist');
165
166 });
167
168 });
169
170 it('Vnf group edit mode delete empty service instance', () => {
171 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
172 const SERVICE_TYPE: string = "TYLER SILVIA";
173 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
174 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
175 let expectedResult: JSON;
176
177 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
178 jsonBuilderAndMock.basicJson(
179 res,
180 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
181 200,
182 0,
183 "ServiceWithVnfGrouping_serviceModel",
184 );
185 });
186
187 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroping_serviceInstance.json').then((res) => {
188 jsonBuilderAndMock.basicJson(
189 res,
190 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
191 200, 0,
192 "serviceWithVnfGroping_serviceInstance",
193 )
194 });
195
196 cy.server().route({
197 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
198 method: 'POST',
199 status: 200,
200 response: "[]",
201 }).as("expectedPostAsyncInstantiation");
202
203 cy.readFile('../vid-automation/src/test/resources/VnfGroup/ServiceWithVnfGroupsDeleteRequest.json').then((res) => {
204 expectedResult = res;
205 });
206
207 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
208 cy.getElementByDataTestsId('openMenuBtn').click();
209 cy.getElementByDataTestsId('context-menu-header-delete-item').should('have.text', 'Delete');
210 cy.getElementByDataTestsId('context-menu-header-delete-item').click();
211 cy.getElementByDataTestsId('serviceName').should('have.css', 'text-decoration');
212 cy.getElementByDataTestsId('openMenuBtn').click();
213 cy.getElementByDataTestsId('context-menu-header-delete-item').should('have.text', 'Undo delete');
214 cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click();
215
216 cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
217 cy.deepCompare(xhr.request.body, expectedResult);
218
219 });
220 });
221
222 it('Delete service with two vnf groups', () => {
223 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
224 const SERVICE_TYPE: string = "TYLER SILVIA";
225 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
226 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
227 let expectedResult: JSON;
228
229 cy.server().route({
230 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
231 method: 'POST',
232 status: 200,
233 response: "[]",
234 }).as("expectedPostAsyncInstantiation");
235
236 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
237 jsonBuilderAndMock.basicJson(
238 res,
239 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
240 200, 0,
241 "serviceWithVnfGroupsChildren_serviceInstance",
242 )
243 });
244
245 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
246 jsonBuilderAndMock.basicJson(
247 res,
248 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
249 200,
250 0,
251 "ServiceTreeWithMultipleChildren_serviceModel",
252 )
253 });
254
255 cy.readFile('../vid-automation/src/test/resources/VnfGroup/deleteServiceWith2VnfGroupsRequest_AndThreeGroupMembers.json').then((expectedResult) => {
256 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
257 cy.getElementByDataTestsId('openMenuBtn').click();
258 cy.getElementByDataTestsId('context-menu-header-delete-item').should('have.text', 'Delete').click();
259 cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click();
260 cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
261 cy.deepCompare(xhr.request.body, expectedResult);
262 });
263 });
264 });
265
266 it(`when open service with group in EDIT mode, service instance is shown as expected - e2e with input and output API's tests"`, function () {
267 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
268 const SERVICE_TYPE: string = "TYLER SILVIA";
269 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
270 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
271
272 cy.server().route({
273 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
274 method: 'POST',
275 status: 200,
276 response: "[]",
277 }).as("expectedPostAsyncInstantiation");
278
279 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
280 jsonBuilderAndMock.basicJson(
281 res,
282 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
283 200,
284 0,
285 "ServiceTreeWithMultipleChildren_serviceModel",
286 )
287 });
288
289 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
290 jsonBuilderAndMock.basicJson(
291 res,
292 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
293 200, 0,
294 "serviceWithVnfGroupsChildren_serviceInstance",
295 )
296 });
297
298 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
299
300 /*
301 0. title area -> generic stuff
302 instance name
303 orch status
304 service name
305 */
306 cy.getElementByDataTestsId("serviceInstance").should('have.text', 'Service instance:');
307 cy.getElementByDataTestsId("orchStatusLabel").should('have.text', 'Orch Status:');
308 // ERROR! cy.getElementByDataTestsId("quantityLabel").should('not.be.visible');
309 // ERROR! cy.getElementByDataTestsId("servicesQuantity").should('not.be.visible');
310
311 // specific
312 cy.getElementByDataTestsId("serviceName").should('have.text', 'SERVICE_INSTANCE_NAME');
313 cy.getElementByDataTestsId("orchStatusValue").should('have.text', 'GARBAGE DATA');
314 cy.get('span#service-model-name').contains('Grouping Service for Test');
315
316 // no need to expand anything
317 cy.get('available-models-tree').find('.toggle-children').should('not.exist');
318
319 /*
320 1. Left tree
321 */
322 const leftShouldHaves: { [dataTestId: string]: { [dataTestId: string]: string; }; } = {
323 'node-groupingservicefortest..ResourceInstanceGroup..0': {
324 'node-type-indicator': 'G',
325 'node-name': 'groupingservicefortest..ResourceInstanceGroup..0',
326 'numberButton': '2',
327 },
328 'node-groupingservicefortest..ResourceInstanceGroup..1': {
329 'node-type-indicator': 'G',
330 'node-name': 'groupingservicefortest..ResourceInstanceGroup..1',
331 'numberButton': '',
332 },
333 };
334 cy.getElementByDataTestsId('search-left-tree-input').type('group');
335 for (let node in leftShouldHaves) {
336 cy.getElementByDataTestsId(node).find(`[data-tests-id= '${'node-name'}']`).find('.highlight').eq(0).should('have.text', 'group');
337
338 for (let span in leftShouldHaves[node]) {
339 const expected = leftShouldHaves[node][span];
340 cy.getElementByDataTestsId(node).find(`[data-tests-id='${span}']`).should(expected ? 'have.text' : 'not.exist', expected);
341 }
342 }
343
344
345 /*
346 2. Right tree
347 */
348 const rightShouldHaves: { [dataTestId: string]: { [dataTestId: string]: string; }; } = {
349 'node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0:0': {
350 'node-type-indicator': 'G',
351 'node-name': 'VNF_GROUP1_INSTANCE_NAME',
352 'status-property-orchStatus': '',
353 'status-property-provStatus': '',
354 // 'status-property-inMaint': '', not exists for false in maint
355 },
356 'node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0:1': {
357 'node-type-indicator': 'G',
358 'node-name': 'VNF_GROUP2_INSTANCE_NAME',
359 'status-property-orchStatus': '',
360 'status-property-provStatus': '',
361 // 'status-property-inMaint': 'false',
362 },
363 };
364 cy.getElementByDataTestsId('search-right-tree-input').type('vnf');
365
366 for (let node in rightShouldHaves) {
367 var [nodeName, nodeEq] = node.split(":");
368 for (let span in rightShouldHaves[node]) {
369 cy.getElementByDataTestsId(nodeName).eq(+nodeEq).find(`[data-tests-id='${span}']`).should('have.text', rightShouldHaves[node][span]);
370 cy.getElementByDataTestsId(nodeName).eq(+nodeEq).find(`[data-tests-id= '${'node-name'}']`).find('.highlight').eq(0).should('have.text', 'VNF');
371
372 }
373 }
374
375 /*
376 3. Left to right connections
377 */
378 const leftShouldHighlight: { [text: string]: string[] } = {
379 'groupingservicefortest..ResourceInstanceGroup..0': ['VNF_GROUP1_INSTANCE_NAME', 'VNF_GROUP2_INSTANCE_NAME'],
380 'groupingservicefortest..ResourceInstanceGroup..1': [],
381 };
382
383 for (let text in leftShouldHighlight) {
384 cy.get('available-models-tree').contains(text).click();
385 cy.get('.node-content-wrapper-active').find(`[data-tests-id='node-name']`).should('have.text', text + leftShouldHighlight[text].join(''));
386 }
387
388 /*
389 4. Right to left connections
390 */
391 const rightShouldHighlight: { [text: string]: string[] } = {
392 'VNF_GROUP1_INSTANCE_NAME': ['groupingservicefortest..ResourceInstanceGroup..0'],
393 'VNF_GROUP2_INSTANCE_NAME': ['groupingservicefortest..ResourceInstanceGroup..0'],
394 };
395
396 for (let node in rightShouldHighlight) {
397 cy.get('drawing-board-tree').contains(node).click();
398 cy.get('.node-content-wrapper-active').find(`[data-tests-id='node-name']`).should('have.text', rightShouldHighlight[node].join('') + node);
399 }
400
401 /*
402 Menus
403 */
404 // SETUP: delete one group on the right; add one group from the left
405 const myNode = 'node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0';
406
407 cy.getElementByDataTestsId(`${myNode}-menu-btn`).eq(0).click({force: true})
408 .getElementByDataTestsId('context-menu-delete').click();
409
410 cy.getElementByDataTestsId('node-groupingservicefortest..ResourceInstanceGroup..0-add-btn').click({force: true});
411 cy.getElementByDataTestsId(`${myNode}-menu-btn`).eq(2).click({force: true})
412 .getElementByDataTestsId('context-menu-edit').click();
413 cy.getElementByDataTestsId('instanceName').clear();
414 cy.typeToInput('instanceName', 'VNF_GROUP3_INSTANCE_NAME');
415 cy.getElementByDataTestsId('form-set').click({force: true});
416
417 // TEST:
418 // #2 is just added
419 // #1 is from AAI
420 // #0 is deleted
421 const menuShouldHave: { [text: string]: string[] } = {
422 [`${myNode}-menu-btn:2`]: ['remove', 'addGroupMember'],
423 [`${myNode}-menu-btn:1`]: ['showAuditInfo', 'addGroupMember', 'delete'],
424 [`${myNode}-menu-btn:0`]: ['showAuditInfo', 'undoDelete'],
425 };
426
427 for (let node in menuShouldHave) {
428 const [nodeName, nodeEq] = node.split(":");
429 let enabledActions:string[] = menuShouldHave[node];
430 cy.assertMenuItemsForNode(enabledActions, nodeName, +nodeEq);
431 }
432
433 const GROUP_NAME_TO_DEPLOY: string = 'groupingservicefortest..ResourceInstanceGroup..0';
434 cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click();
435
436 cy.getReduxState().then((state) => {
437 const addedVnfGroup = state.service.serviceInstance[SERVICE_MODEL_ID].vnfGroups[GROUP_NAME_TO_DEPLOY];
438
439 cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
440 cy.readFile('../vid-automation/src/test/resources/VnfGroup/VnfGroupCreate1Delete1None1Request.json').then((expectedResult) => {
441 expectedResult.vnfGroups[GROUP_NAME_TO_DEPLOY].trackById = addedVnfGroup.trackById;
442 cy.deepCompare(xhr.request.body, expectedResult);
443 });
444 });
445 });
446 });
447
448 it(`vnf group with vnf members should display correctly and should have delete option"`, function () {
449 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
450 const SERVICE_TYPE: string = "TYLER SILVIA";
451 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
452 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
453
454 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
455 jsonBuilderAndMock.basicJson(
456 res,
457 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
458 200,
459 0,
460 "ServiceTreeWithMultipleChildren_serviceModel",
461 )
462 });
463
464 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
465 jsonBuilderAndMock.basicJson(
466 res,
467 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
468 200, 0,
469 "serviceWithVnfGroupsChildren_serviceInstance",
470 )
471 });
472
473 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&mode=EDIT`);
474 cy.getElementByDataTestsId('deployBtn').should('have.attr', 'disabled');
475 cy.get('#VnfGroup_VNF .icon-browse').eq(0).click({force: true}).then(() => {
476 cy.getElementByDataTestsId('context-menu-delete').click({force: true});
477 cy.getElementByDataTestsId('deployBtn').should('not.have.attr', 'disabled');
478
479 cy.get('#VnfGroup_VNF .icon-browse').eq(0).click({force: true}).then(() => {
480 cy.getElementByDataTestsId('context-menu-undoDelete').click({force: true});
481 cy.getElementByDataTestsId('deployBtn').should('have.attr', 'disabled');
482 });
483 });
484
485
486 cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
487 .eq(0).click({force: true}).then(() => {
488 cy.getElementByDataTestsId('context-menu-delete').click({force: true});
489 cy.getElementByDataTestsId('deployBtn').should('not.have.attr', 'disabled');
490 })
491 });
492
493 it('Delete 2 from 3 VNF members and check request body of deploy', function () {
494 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
495 const SERVICE_TYPE: string = "TYLER SILVIA";
496 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
497 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
498
499 cy.server().route({
500 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
501 method: 'POST',
502 status: 200,
503 response: "[]",
504 }).as("expectedPostAsyncInstantiation");
505
506 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
507 jsonBuilderAndMock.basicJson(
508 res,
509 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
510 200,
511 0,
512 "ServiceTreeWithMultipleChildren_serviceModel",
513 )
514 });
515
516 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
517
518 jsonBuilderAndMock.basicJson(
519 res,
520 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
521 200, 0,
522 "serviceWithVnfGroupsChildren_serviceInstance",
523 )
524 });
525
526 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&mode=EDIT`);
527 cy.getElementByDataTestsId('deployBtn').should('have.attr', 'disabled');
528
529 for (let index = 0; index < 2; index++) {
530 cy.get('#VnfGroup_VNF .icon-browse').eq(index).click({force: true}).then(() => {
531 cy.getElementByDataTestsId('context-menu-delete').click({force: true});
532 cy.getElementByDataTestsId('deployBtn').should('not.have.attr', 'disabled');
533 });
534 }
535
536 cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click();
537
538 cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
539 cy.readFile('../vid-automation/src/test/resources/VnfGroup/payloadTemplate1VnfGroupWith3MembersRequest.json').then((expectedResult) => {
540 expectedResult.vnfGroups.VNF_GROUP1_INSTANCE_ID.action = 'None';
541 expectedResult.vnfGroups.VNF_GROUP1_INSTANCE_ID.vnfs.RELATED_VNF1_INSTANCE_ID.action = 'None_Delete';
542 expectedResult.vnfGroups.VNF_GROUP1_INSTANCE_ID.vnfs.RELATED_VNF2_INSTANCE_ID.action = 'None_Delete';
543 cy.deepCompare(xhr.request.body, expectedResult);
544 });
545 });
546 });
547
548 it(`vnf group with vnf members, add group members option open modal"`, () => {
549 const SUBSCRIBER_ID: string = "global-customer-id";
550 const SERVICE_TYPE: string = "service-instance-type";
551 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
552 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
553 const SERVICE_INVARIANT_ID: string = '24632e6b-584b-4f45-80d4-fefd75fd9f14';
554 const GROUP_ROLE: string = 'SERVICE-ACCESS';
555 const GROUP_TYPE: string = 'LOAD-GROUP';
556
557 cy.server().route({
558 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
559 method: 'POST',
560 status: 200,
561 response: "[]",
562 }).as("expectedPostAsyncInstantiation");
563
564 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
565 jsonBuilderAndMock.basicJson(
566 res,
567 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
568 200,
569 0,
570 "ServiceTreeWithMultipleChildren_serviceModel",
571 )
572 });
573
574 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
575
576 jsonBuilderAndMock.basicJson(
577 res,
578 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
579 200, 0,
580 "serviceWithVnfGroupsChildren_serviceInstance",
581 )
582 });
583 cy.readFile('../vid-automation/src/test/resources/VnfGroup/searchMembersResponse.json').then((res) => {
584
585 jsonBuilderAndMock.basicJson(
586 res,
587 Cypress.config('baseUrl') + `/aai_search_group_members/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INVARIANT_ID}/${GROUP_TYPE}/${GROUP_ROLE}`,
588 200, 0,
589 "VnfGroup_searchMembersResponse",
590 )
591 });
592 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&mode=EDIT`);
593
594 cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
595 .eq(0).click({force: true}).then(() => {
596 cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
597 cy.getElementByDataTestsId('sourceModelName').contains("vDBE_Svc_vPRS");
598 cy.getElementByDataTestsId('sourceModelInvariant').contains("24632e6b-584b-4f45-80d4-fefd75fd9f14");
599 cy.get('#vnfName').eq(0).get('#VNF1_INSTANCE_NAME').contains('VNF1_INSTANCE_NAME');
600 cy.get('#vnfName').eq(0).get('#VNF1_INSTANCE_ID').contains('VNF1_INSTANCE_ID');
601 cy.getElementByDataTestsId('total-amount').should('have.text', '4 VNFs match your criteria');
602 cy.getElementByDataTestsId('total-selected').should('have.text', '0 VNF selected');
603 cy.getElementByDataTestsId('setMembersBtn').should('have.attr', 'disabled');
604 testCheckbox();
605 testResetAddMemberModal();
606 testUpdateBtn();
607
608 });
609 });
610 });
611
612 it(`vnf group add member get optional members return empty table"`, () => {
613 const SUBSCRIBER_ID: string = "global-customer-id";
614 const SERVICE_TYPE: string = "service-instance-type";
615 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
616 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
617 const SERVICE_INVARIANT_ID: string = '24632e6b-584b-4f45-80d4-fefd75fd9f14';
618 const GROUP_ROLE: string = 'SERVICE-ACCESS';
619 const GROUP_TYPE: string = 'LOAD-GROUP';
620
621 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
622 jsonBuilderAndMock.basicJson(
623 res,
624 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
625 200,
626 0,
627 "ServiceTreeWithMultipleChildren_serviceModel",
628 )
629 });
630
631 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
632
633 jsonBuilderAndMock.basicJson(
634 res,
635 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
636 200, 0,
637 "serviceWithVnfGroupsChildren_serviceInstance",
638 )
639 });
640 cy.server()
641 .route({
642 method: 'GET',
643 status: 200,
644 url: Cypress.config('baseUrl') + `/aai_search_group_members/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INVARIANT_ID}/${GROUP_TYPE}/${GROUP_ROLE}`,
645 response: []
646 }).as('VnfGroup_searchMembersResponse');
647
648 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&mode=EDIT`);
649
650 cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
651 .eq(0).click({force: true}).then(() => {
652 cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
653 cy.getElementByDataTestsId('total-amount').should('have.text', '0 VNFs match your criteria');
654 cy.getElementByDataTestsId('total-selected').should('have.text', '0 VNF selected');
655 cy.get('.no-result').should('have.text', 'No VNFs were found that can belong to this group.');
656 });
657 })
658 });
659
660 it('Check scaling policy - in Create new service mode', () => {
661 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
662 const SERVICE_TYPE: string = "TYLER SILVIA";
663 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
664 const SERVICE_INVARIANT_ID: string = 'c989ab9a-33c7-46ec-b521-1b2daef5f047';
665 const GROUP_ROLE: string = 'SERVICE-ACCESS';
666 const GROUP_TYPE: string = 'LOAD-GROUP';
667 const GROUP_NAME_TO_DEPLOY = 'groupingservicefortest..ResourceInstanceGroup..1';
668 const NODE_ID = 'c2b300e6-45de-4e5e-abda-3032bee2de56';
669 const FULL_GROUP_NAME = 'node-' + NODE_ID + '-' + GROUP_NAME_TO_DEPLOY;
670 let serviceModel: JSON;
671 let basicServiceInstance: JSON;
672
673 cy.server().route({
674 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
675 method: 'POST',
676 status: 200,
677 response: "[]",
678 }).as("expectedPostAsyncInstantiation");
679
680 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
681 serviceModel = res;
682 });
683
684 cy.readFile('./cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json').then((res) => {
685 res.optionalGroupMembersMap = {};
686 basicServiceInstance = res;
687 });
688
689 cy.readFile('../vid-automation/src/test/resources/VnfGroup/searchMembersResponse.json').then((res) => {
690 jsonBuilderAndMock.basicJson(
691 res,
692 Cypress.config('baseUrl') + `/aai_search_group_members/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INVARIANT_ID}/${GROUP_TYPE}/${GROUP_ROLE}`,
693 200, 0,
694 "VnfGroup_searchMembersResponse",
695 )
696 });
697
698 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((reduxRes) => {
699
700 reduxRes.service.serviceHierarchy[SERVICE_MODEL_ID] = serviceModel;
701
702 reduxRes.service.serviceInstance[SERVICE_MODEL_ID] = basicServiceInstance;
703
704 cy.setReduxState(<any>reduxRes);
705
706 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=' + SERVICE_MODEL_ID);
707 cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY).find(`[data-tests-id='node-type-indicator']`).contains('G');
708 cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY).contains('' + GROUP_NAME_TO_DEPLOY);
709 cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY + '-add-btn').get('i').should('have.class', 'fa-plus-circle');
710
711 cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY + '-add-btn').click({force: true});
712 cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY + '-add-btn').click({force: true});
713
714 cy.getElementByDataTestsId('node-' + NODE_ID + '-' + GROUP_NAME_TO_DEPLOY + '-menu-btn').each((row, index) => {
715 cy.wrap(row).click({force: true}).then(() => {
716 cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
717 cy.getElementByDataTestsId('total-amount').should('have.text', '4 VNFs match your criteria');
718 cy.get('.allCheckboxAreSelected input').click({force: true});
719 cy.getElementByDataTestsId('setMembersBtn').click({force: true}).then(() => {
720 checkIsErrorAppear(true, 'node-' + NODE_ID + '-' + GROUP_NAME_TO_DEPLOY, 3, index);
721 cy.get('.toggle-children').click({force: true}).then(() => {
722 let memberIndex = 3;
723 while (!index && memberIndex >= 0) {
724 clickOnVnfMemberAndAssertScaling(memberIndex--, 'context-menu-remove', false, FULL_GROUP_NAME, 3, index);
725 }
726 });
727 });
728 });
729 });
730 });
731 clickOnVnfMemberAndAssertScaling(0, 'context-menu-remove', false, FULL_GROUP_NAME, 3, 1);
732 cy.getElementByDataTestsId('deployBtn').should('have.text', 'DEPLOY').click();
733 });
734 });
735
736 it(`Check scaling policy in Edit mode`, () => {
737 const SUBSCRIBER_ID: string = "global-customer-id";
738 const SERVICE_TYPE: string = "service-instance-type";
739 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
740 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
741 const SERVICE_INVARIANT_ID: string = '24632e6b-584b-4f45-80d4-fefd75fd9f14';
742 const GROUP_ROLE: string = 'SERVICE-ACCESS';
743 const GROUP_TYPE: string = 'LOAD-GROUP';
744 const NODE_ID = 'daeb6568-cef8-417f-9075-ed259ce59f48';
745 const GROUP_NAME_TO_DEPLOY = 'groupingservicefortest..ResourceInstanceGroup..0';
746 const FULL_GROUP_NAME = 'node-' + NODE_ID + '-' + GROUP_NAME_TO_DEPLOY;
747
748 cy.server().route({
749 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
750 method: 'POST',
751 status: 200,
752 response: "[]",
753 }).as("expectedPostAsyncInstantiation");
754
755 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
756 jsonBuilderAndMock.basicJson(
757 res,
758 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
759 200,
760 0,
761 "ServiceTreeWithMultipleChildren_serviceModel",
762 )
763 });
764
765 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
766
767 jsonBuilderAndMock.basicJson(
768 res,
769 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
770 200, 0,
771 "serviceWithVnfGroupsChildren_serviceInstance",
772 )
773 });
774
775 cy.readFile('../vid-automation/src/test/resources/VnfGroup/searchMembersResponse.json').then((res) => {
776
777 jsonBuilderAndMock.basicJson(
778 res,
779 Cypress.config('baseUrl') + `/aai_search_group_members/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INVARIANT_ID}/${GROUP_TYPE}/${GROUP_ROLE}`,
780 200, 0,
781 "VnfGroup_searchMembersResponse",
782 )
783 });
784
785 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&mode=EDIT`);
786 cy.getElementByDataTestsId('node-' + NODE_ID + '-' + GROUP_NAME_TO_DEPLOY + '-menu-btn')
787 .eq(0).click({force: true}).then(() => {
788 cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
789 cy.getElementByDataTestsId('total-amount').should('have.text', '4 VNFs match your criteria');
790 cy.get('.allCheckboxAreSelected input').click({force: true});
791 cy.getElementByDataTestsId('setMembersBtn').click({force: true}).then(() => {
792 checkIsErrorAppear(true, FULL_GROUP_NAME, 4, 0);
793
794 clickOnVnfMemberAndAssertScaling(6, 'context-menu-remove', true, FULL_GROUP_NAME, 4, 0);
795 clickOnVnfMemberAndAssertScaling(5, 'context-menu-remove', true, FULL_GROUP_NAME, 4, 0);
796 clickOnVnfMemberAndAssertScaling(0, 'context-menu-delete', false, FULL_GROUP_NAME, 4, 0);
797 clickOnVnfMemberAndAssertScaling(0, 'context-menu-undoDelete', true, FULL_GROUP_NAME, 4, 0);
798 clickOnVnfMemberAndAssertScaling(4, 'context-menu-remove', false, FULL_GROUP_NAME, 4, 0);
799 testResetAddMemberModal();
800 testUpdateBtn();
801 })
802 });
803 });
804 });
805
806 function removeVnfGroup() {
807 cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
808 .click({force: true});
809 cy.getElementByDataTestsId('context-menu-remove').click({force: true});
810 }
811
812 function testUpdateBtn() {
813 cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click();
814 cy.getReduxState().then((state) => {
815 cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
816 cy.readFile('../vid-automation/src/test/resources/VnfGroup/vnfGroupWithExistingAndNewVnfMembers.json').then((expectedResult) => {
817 cy.deepCompare(xhr.request.body, expectedResult);
818 });
819 });
820 });
821 }
822
823 function testCheckbox() {
824 let totalNumber = 4;
825 cy.get('.allCheckboxAreSelected input').click({force: true});
826 cy.getElementByDataTestsId('setMembersBtn').should('not.have.attr', 'disabled');
827 cy.getElementByDataTestsId('numberOfNotHideVnfMembers').contains(totalNumber);
828 cy.getElementByDataTestsId('numberOfSelectedVnfMembers').contains(totalNumber);
829 cy.get('.sdcCheckboxMember input').eq(0).click({force: true});
830 cy.getElementByDataTestsId('numberOfSelectedVnfMembers').contains(totalNumber - 1);
831 cy.get('.sdcCheckboxMember input').eq(1).click({force: true});
832 cy.getElementByDataTestsId('numberOfSelectedVnfMembers').contains(totalNumber - 2);
833 cy.get('.allCheckboxAreSelected input').click({force: true});
834 cy.getElementByDataTestsId('numberOfSelectedVnfMembers').contains(totalNumber);
835 cy.get('.allCheckboxAreSelected input').click({force: true});
836 cy.getElementByDataTestsId('numberOfSelectedVnfMembers').contains(0);
837
838 cy.getElementByDataTestsId("vnf-members-search").find('input').type("2.0");
839 cy.getElementByDataTestsId('numberOfNotHideVnfMembers').contains(1);
840 cy.getElementByDataTestsId("vnf-members-search").find('input').clear().type("vnf1");
841 cy.getElementByDataTestsId('numberOfNotHideVnfMembers').contains(1);
842 cy.get('.allCheckboxAreSelected input').click({force: true});
843 cy.getElementByDataTestsId('numberOfSelectedVnfMembers').contains(1);
844 cy.getElementByDataTestsId("vnf-members-search").find('input').clear();
845 cy.getElementByDataTestsId('numberOfSelectedVnfMembers').contains(1);
846
847 cy.getElementByDataTestsId('setMembersBtn').click({force: true});
848 //check second time behavior (selected VNFs should be filtered)
849 cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
850 .eq(1).click({force: true}).then(() => {
851 cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
852 cy.getElementByDataTestsId('numberOfNotHideVnfMembers').contains(totalNumber - 1);
853 cy.getElementByDataTestsId('cancelBtn').click({force: true});
854 });
855 });
856
857 }
858 function testResetAddMemberModal(): void{
859 cy.getElementByDataTestsId('node-groupingservicefortest..ResourceInstanceGroup..1-add-btn').click({force: true})
860 .getElementByDataTestsId('node-c2b300e6-45de-4e5e-abda-3032bee2de56-groupingservicefortest..ResourceInstanceGroup..1-menu-btn').eq(0).click({force: true}).then(() => {
861 cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
862 cy.getElementByDataTestsId('numberOfNotHideVnfMembers').contains(0);
863 cy.getElementByDataTestsId('cancelBtn').click({force: true});
864 });
865 cy.getElementByDataTestsId('node-c2b300e6-45de-4e5e-abda-3032bee2de56-groupingservicefortest..ResourceInstanceGroup..1-menu-btn').eq(0).click({force: true}).then(() => {
866 cy.getElementByDataTestsId('context-menu-remove').click({force: true});
867 });
868 });
869 }
870 function checkIsErrorAppear(isError: boolean, groupRowId: string, limit: number, index: number) {
871 const isErrorPrefix = isError ? '' : 'not.';
872 cy.getElementByDataTestsId('error-msg-wrapper').should(isErrorPrefix + 'exist');
873 cy.getElementByDataTestsId('deployBtn').should(isErrorPrefix + 'have.attr', 'disabled');
874 cy.getElementByDataTestsId(groupRowId).eq(index).find("[data-tests-id='scaling-policy']").should(isErrorPrefix + 'have.text', 'Limit' + limit);
875 cy.getElementByDataTestsId('error-msg-title').should(isErrorPrefix + 'exist');
876 cy.getElementByDataTestsId('error-msg-sub-title').should(isErrorPrefix + 'exist');
877 cy.getElementByDataTestsId('error-msg-description').should(isErrorPrefix + 'exist');
878 }
879
880 function clickOnVnfMemberAndAssertScaling(childIndex: number, menuItemTestId: string, isError: boolean, groupRowId: string, limit: number, index: number) {
881 cy.get('.tree-children').find('.node-wrapper').eq(childIndex).find('.icon-browse').click({force: true})
882 .getElementByDataTestsId(menuItemTestId).click({force: true}).then(() => {
883 checkIsErrorAppear(isError, groupRowId, limit, index);
884 });
885 }
886
887
888 }
889 );
890});