blob: f9c188bd74e7332f55c27a6c5df698e4f5646074 [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;
Ittay Sternf7926712019-07-07 19:23:03 +0300148 reduxRes.global.genericModalHelper = {};
Ittay Stern6f900cc2018-08-29 17:01:32 +0300149
150 cy.setReduxState(<any>reduxRes);
151
152 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=' + SERVICE_MODEL_ID);
153 cy.getElementByDataTestsId('node-groupingservicefortest..ResourceInstanceGroup..0-add-btn').click({force: true});
154 removeVnfGroup();
155 cy.getElementByDataTestsId('node-groupingservicefortest..ResourceInstanceGroup..0-add-btn').click({force: true});
156 cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
157 .click({force: true});
158 cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
159 cy.get('.allCheckboxAreSelected input').click({force: true});
160 cy.getElementByDataTestsId('setMembersBtn').click({force: true})
161 });
162 cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0').click({force: true});
163 removeVnfGroup();
164 cy.getElementByDataTestsId('button-remove-group').click({force: true});
165 cy.get('#model-actions').should('not.exist');
166
167 });
168
169 });
170
171 it('Vnf group edit mode delete empty service instance', () => {
172 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
173 const SERVICE_TYPE: string = "TYLER SILVIA";
174 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
175 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
176 let expectedResult: JSON;
177
178 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
179 jsonBuilderAndMock.basicJson(
180 res,
181 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
182 200,
183 0,
184 "ServiceWithVnfGrouping_serviceModel",
185 );
186 });
187
188 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroping_serviceInstance.json').then((res) => {
189 jsonBuilderAndMock.basicJson(
190 res,
191 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
192 200, 0,
193 "serviceWithVnfGroping_serviceInstance",
194 )
195 });
196
197 cy.server().route({
198 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
199 method: 'POST',
200 status: 200,
201 response: "[]",
202 }).as("expectedPostAsyncInstantiation");
203
204 cy.readFile('../vid-automation/src/test/resources/VnfGroup/ServiceWithVnfGroupsDeleteRequest.json').then((res) => {
205 expectedResult = res;
206 });
207
208 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
Ittay Sternf7926712019-07-07 19:23:03 +0300209 cy.getElementByDataTestsId('orchStatusValue').should('not.have.class', 'tag-status-value');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300210 cy.getElementByDataTestsId('openMenuBtn').click();
211 cy.getElementByDataTestsId('context-menu-header-delete-item').should('have.text', 'Delete');
212 cy.getElementByDataTestsId('context-menu-header-delete-item').click();
213 cy.getElementByDataTestsId('serviceName').should('have.css', 'text-decoration');
214 cy.getElementByDataTestsId('openMenuBtn').click();
215 cy.getElementByDataTestsId('context-menu-header-delete-item').should('have.text', 'Undo delete');
216 cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click();
217
218 cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
219 cy.deepCompare(xhr.request.body, expectedResult);
220
221 });
222 });
223
224 it('Delete service with two vnf groups', () => {
225 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
226 const SERVICE_TYPE: string = "TYLER SILVIA";
227 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
228 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
229 let expectedResult: JSON;
230
231 cy.server().route({
232 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
233 method: 'POST',
234 status: 200,
235 response: "[]",
236 }).as("expectedPostAsyncInstantiation");
237
238 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
239 jsonBuilderAndMock.basicJson(
240 res,
241 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
242 200, 0,
243 "serviceWithVnfGroupsChildren_serviceInstance",
244 )
245 });
246
247 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
248 jsonBuilderAndMock.basicJson(
249 res,
250 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
251 200,
252 0,
253 "ServiceTreeWithMultipleChildren_serviceModel",
254 )
255 });
256
257 cy.readFile('../vid-automation/src/test/resources/VnfGroup/deleteServiceWith2VnfGroupsRequest_AndThreeGroupMembers.json').then((expectedResult) => {
258 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
259 cy.getElementByDataTestsId('openMenuBtn').click();
260 cy.getElementByDataTestsId('context-menu-header-delete-item').should('have.text', 'Delete').click();
261 cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click();
262 cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
263 cy.deepCompare(xhr.request.body, expectedResult);
264 });
265 });
266 });
267
268 it(`when open service with group in EDIT mode, service instance is shown as expected - e2e with input and output API's tests"`, function () {
269 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
270 const SERVICE_TYPE: string = "TYLER SILVIA";
271 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
272 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
273
274 cy.server().route({
275 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
276 method: 'POST',
277 status: 200,
278 response: "[]",
279 }).as("expectedPostAsyncInstantiation");
280
281 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
282 jsonBuilderAndMock.basicJson(
283 res,
284 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
285 200,
286 0,
287 "ServiceTreeWithMultipleChildren_serviceModel",
288 )
289 });
290
291 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
292 jsonBuilderAndMock.basicJson(
293 res,
294 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
295 200, 0,
296 "serviceWithVnfGroupsChildren_serviceInstance",
297 )
298 });
299
300 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
301
302 /*
303 0. title area -> generic stuff
304 instance name
305 orch status
306 service name
307 */
308 cy.getElementByDataTestsId("serviceInstance").should('have.text', 'Service instance:');
309 cy.getElementByDataTestsId("orchStatusLabel").should('have.text', 'Orch Status:');
310 // ERROR! cy.getElementByDataTestsId("quantityLabel").should('not.be.visible');
311 // ERROR! cy.getElementByDataTestsId("servicesQuantity").should('not.be.visible');
312
313 // specific
314 cy.getElementByDataTestsId("serviceName").should('have.text', 'SERVICE_INSTANCE_NAME');
315 cy.getElementByDataTestsId("orchStatusValue").should('have.text', 'GARBAGE DATA');
316 cy.get('span#service-model-name').contains('Grouping Service for Test');
317
318 // no need to expand anything
319 cy.get('available-models-tree').find('.toggle-children').should('not.exist');
320
321 /*
322 1. Left tree
323 */
324 const leftShouldHaves: { [dataTestId: string]: { [dataTestId: string]: string; }; } = {
325 'node-groupingservicefortest..ResourceInstanceGroup..0': {
326 'node-type-indicator': 'G',
327 'node-name': 'groupingservicefortest..ResourceInstanceGroup..0',
328 'numberButton': '2',
329 },
330 'node-groupingservicefortest..ResourceInstanceGroup..1': {
331 'node-type-indicator': 'G',
332 'node-name': 'groupingservicefortest..ResourceInstanceGroup..1',
333 'numberButton': '',
334 },
335 };
336 cy.getElementByDataTestsId('search-left-tree-input').type('group');
337 for (let node in leftShouldHaves) {
338 cy.getElementByDataTestsId(node).find(`[data-tests-id= '${'node-name'}']`).find('.highlight').eq(0).should('have.text', 'group');
339
340 for (let span in leftShouldHaves[node]) {
341 const expected = leftShouldHaves[node][span];
342 cy.getElementByDataTestsId(node).find(`[data-tests-id='${span}']`).should(expected ? 'have.text' : 'not.exist', expected);
343 }
344 }
345
346
347 /*
348 2. Right tree
349 */
350 const rightShouldHaves: { [dataTestId: string]: { [dataTestId: string]: string; }; } = {
351 'node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0:0': {
352 'node-type-indicator': 'G',
353 'node-name': 'VNF_GROUP1_INSTANCE_NAME',
354 'status-property-orchStatus': '',
355 'status-property-provStatus': '',
356 // 'status-property-inMaint': '', not exists for false in maint
357 },
358 'node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0:1': {
359 'node-type-indicator': 'G',
360 'node-name': 'VNF_GROUP2_INSTANCE_NAME',
361 'status-property-orchStatus': '',
362 'status-property-provStatus': '',
363 // 'status-property-inMaint': 'false',
364 },
365 };
366 cy.getElementByDataTestsId('search-right-tree-input').type('vnf');
367
368 for (let node in rightShouldHaves) {
369 var [nodeName, nodeEq] = node.split(":");
370 for (let span in rightShouldHaves[node]) {
371 cy.getElementByDataTestsId(nodeName).eq(+nodeEq).find(`[data-tests-id='${span}']`).should('have.text', rightShouldHaves[node][span]);
372 cy.getElementByDataTestsId(nodeName).eq(+nodeEq).find(`[data-tests-id= '${'node-name'}']`).find('.highlight').eq(0).should('have.text', 'VNF');
373
374 }
375 }
376
377 /*
378 3. Left to right connections
379 */
380 const leftShouldHighlight: { [text: string]: string[] } = {
381 'groupingservicefortest..ResourceInstanceGroup..0': ['VNF_GROUP1_INSTANCE_NAME', 'VNF_GROUP2_INSTANCE_NAME'],
382 'groupingservicefortest..ResourceInstanceGroup..1': [],
383 };
384
385 for (let text in leftShouldHighlight) {
386 cy.get('available-models-tree').contains(text).click();
387 cy.get('.node-content-wrapper-active').find(`[data-tests-id='node-name']`).should('have.text', text + leftShouldHighlight[text].join(''));
388 }
389
390 /*
391 4. Right to left connections
392 */
393 const rightShouldHighlight: { [text: string]: string[] } = {
394 'VNF_GROUP1_INSTANCE_NAME': ['groupingservicefortest..ResourceInstanceGroup..0'],
395 'VNF_GROUP2_INSTANCE_NAME': ['groupingservicefortest..ResourceInstanceGroup..0'],
396 };
397
398 for (let node in rightShouldHighlight) {
399 cy.get('drawing-board-tree').contains(node).click();
400 cy.get('.node-content-wrapper-active').find(`[data-tests-id='node-name']`).should('have.text', rightShouldHighlight[node].join('') + node);
401 }
402
403 /*
404 Menus
405 */
406 // SETUP: delete one group on the right; add one group from the left
407 const myNode = 'node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0';
408
409 cy.getElementByDataTestsId(`${myNode}-menu-btn`).eq(0).click({force: true})
410 .getElementByDataTestsId('context-menu-delete').click();
411
412 cy.getElementByDataTestsId('node-groupingservicefortest..ResourceInstanceGroup..0-add-btn').click({force: true});
413 cy.getElementByDataTestsId(`${myNode}-menu-btn`).eq(2).click({force: true})
414 .getElementByDataTestsId('context-menu-edit').click();
415 cy.getElementByDataTestsId('instanceName').clear();
416 cy.typeToInput('instanceName', 'VNF_GROUP3_INSTANCE_NAME');
417 cy.getElementByDataTestsId('form-set').click({force: true});
418
419 // TEST:
420 // #2 is just added
421 // #1 is from AAI
422 // #0 is deleted
423 const menuShouldHave: { [text: string]: string[] } = {
424 [`${myNode}-menu-btn:2`]: ['remove', 'addGroupMember'],
425 [`${myNode}-menu-btn:1`]: ['showAuditInfo', 'addGroupMember', 'delete'],
426 [`${myNode}-menu-btn:0`]: ['showAuditInfo', 'undoDelete'],
427 };
428
429 for (let node in menuShouldHave) {
430 const [nodeName, nodeEq] = node.split(":");
431 let enabledActions:string[] = menuShouldHave[node];
432 cy.assertMenuItemsForNode(enabledActions, nodeName, +nodeEq);
433 }
434
435 const GROUP_NAME_TO_DEPLOY: string = 'groupingservicefortest..ResourceInstanceGroup..0';
436 cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click();
437
438 cy.getReduxState().then((state) => {
439 const addedVnfGroup = state.service.serviceInstance[SERVICE_MODEL_ID].vnfGroups[GROUP_NAME_TO_DEPLOY];
440
441 cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
442 cy.readFile('../vid-automation/src/test/resources/VnfGroup/VnfGroupCreate1Delete1None1Request.json').then((expectedResult) => {
443 expectedResult.vnfGroups[GROUP_NAME_TO_DEPLOY].trackById = addedVnfGroup.trackById;
444 cy.deepCompare(xhr.request.body, expectedResult);
445 });
446 });
447 });
448 });
449
450 it(`vnf group with vnf members should display correctly and should have delete option"`, function () {
451 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
452 const SERVICE_TYPE: string = "TYLER SILVIA";
453 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
454 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
455
456 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
457 jsonBuilderAndMock.basicJson(
458 res,
459 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
460 200,
461 0,
462 "ServiceTreeWithMultipleChildren_serviceModel",
463 )
464 });
465
466 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
467 jsonBuilderAndMock.basicJson(
468 res,
469 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
470 200, 0,
471 "serviceWithVnfGroupsChildren_serviceInstance",
472 )
473 });
474
475 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&mode=EDIT`);
476 cy.getElementByDataTestsId('deployBtn').should('have.attr', 'disabled');
477 cy.get('#VnfGroup_VNF .icon-browse').eq(0).click({force: true}).then(() => {
478 cy.getElementByDataTestsId('context-menu-delete').click({force: true});
479 cy.getElementByDataTestsId('deployBtn').should('not.have.attr', 'disabled');
480
481 cy.get('#VnfGroup_VNF .icon-browse').eq(0).click({force: true}).then(() => {
482 cy.getElementByDataTestsId('context-menu-undoDelete').click({force: true});
483 cy.getElementByDataTestsId('deployBtn').should('have.attr', 'disabled');
484 });
485 });
486
487
488 cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
489 .eq(0).click({force: true}).then(() => {
490 cy.getElementByDataTestsId('context-menu-delete').click({force: true});
491 cy.getElementByDataTestsId('deployBtn').should('not.have.attr', 'disabled');
492 })
493 });
494
495 it('Delete 2 from 3 VNF members and check request body of deploy', function () {
496 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
497 const SERVICE_TYPE: string = "TYLER SILVIA";
498 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
499 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
500
501 cy.server().route({
502 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
503 method: 'POST',
504 status: 200,
505 response: "[]",
506 }).as("expectedPostAsyncInstantiation");
507
508 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
509 jsonBuilderAndMock.basicJson(
510 res,
511 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
512 200,
513 0,
514 "ServiceTreeWithMultipleChildren_serviceModel",
515 )
516 });
517
518 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
519
520 jsonBuilderAndMock.basicJson(
521 res,
522 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
523 200, 0,
524 "serviceWithVnfGroupsChildren_serviceInstance",
525 )
526 });
527
528 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&mode=EDIT`);
529 cy.getElementByDataTestsId('deployBtn').should('have.attr', 'disabled');
530
531 for (let index = 0; index < 2; index++) {
532 cy.get('#VnfGroup_VNF .icon-browse').eq(index).click({force: true}).then(() => {
533 cy.getElementByDataTestsId('context-menu-delete').click({force: true});
534 cy.getElementByDataTestsId('deployBtn').should('not.have.attr', 'disabled');
535 });
536 }
537
538 cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click();
539
540 cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
541 cy.readFile('../vid-automation/src/test/resources/VnfGroup/payloadTemplate1VnfGroupWith3MembersRequest.json').then((expectedResult) => {
542 expectedResult.vnfGroups.VNF_GROUP1_INSTANCE_ID.action = 'None';
543 expectedResult.vnfGroups.VNF_GROUP1_INSTANCE_ID.vnfs.RELATED_VNF1_INSTANCE_ID.action = 'None_Delete';
544 expectedResult.vnfGroups.VNF_GROUP1_INSTANCE_ID.vnfs.RELATED_VNF2_INSTANCE_ID.action = 'None_Delete';
545 cy.deepCompare(xhr.request.body, expectedResult);
546 });
547 });
548 });
549
Ittay Sternf7926712019-07-07 19:23:03 +0300550 it(`vnf group with vnf members, add group members option open modal`, () => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300551 const SUBSCRIBER_ID: string = "global-customer-id";
552 const SERVICE_TYPE: string = "service-instance-type";
553 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
554 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
555 const SERVICE_INVARIANT_ID: string = '24632e6b-584b-4f45-80d4-fefd75fd9f14';
556 const GROUP_ROLE: string = 'SERVICE-ACCESS';
557 const GROUP_TYPE: string = 'LOAD-GROUP';
558
559 cy.server().route({
560 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
561 method: 'POST',
562 status: 200,
563 response: "[]",
564 }).as("expectedPostAsyncInstantiation");
565
566 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
567 jsonBuilderAndMock.basicJson(
568 res,
569 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
570 200,
571 0,
572 "ServiceTreeWithMultipleChildren_serviceModel",
573 )
574 });
575
576 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
577
578 jsonBuilderAndMock.basicJson(
579 res,
580 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
581 200, 0,
582 "serviceWithVnfGroupsChildren_serviceInstance",
583 )
584 });
585 cy.readFile('../vid-automation/src/test/resources/VnfGroup/searchMembersResponse.json').then((res) => {
586
587 jsonBuilderAndMock.basicJson(
588 res,
589 Cypress.config('baseUrl') + `/aai_search_group_members/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INVARIANT_ID}/${GROUP_TYPE}/${GROUP_ROLE}`,
590 200, 0,
591 "VnfGroup_searchMembersResponse",
592 )
593 });
594 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&mode=EDIT`);
595
596 cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
597 .eq(0).click({force: true}).then(() => {
598 cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
Ittay Sternf7926712019-07-07 19:23:03 +0300599 cy.getElementByDataTestsId('sourceModelName').contains("vDOROTHEA_Svc_vPRS");
Ittay Stern6f900cc2018-08-29 17:01:32 +0300600 cy.getElementByDataTestsId('sourceModelInvariant').contains("24632e6b-584b-4f45-80d4-fefd75fd9f14");
601 cy.get('#vnfName').eq(0).get('#VNF1_INSTANCE_NAME').contains('VNF1_INSTANCE_NAME');
602 cy.get('#vnfName').eq(0).get('#VNF1_INSTANCE_ID').contains('VNF1_INSTANCE_ID');
Ittay Sternf7926712019-07-07 19:23:03 +0300603 cy.getElementByDataTestsId('total-amount').should('have.text', '4 VNFs match your criteria |');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300604 cy.getElementByDataTestsId('total-selected').should('have.text', '0 VNF selected');
605 cy.getElementByDataTestsId('setMembersBtn').should('have.attr', 'disabled');
606 testCheckbox();
607 testResetAddMemberModal();
608 testUpdateBtn();
Ittay Stern6f900cc2018-08-29 17:01:32 +0300609 });
610 });
611 });
612
613 it(`vnf group add member get optional members return empty table"`, () => {
614 const SUBSCRIBER_ID: string = "global-customer-id";
615 const SERVICE_TYPE: string = "service-instance-type";
616 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
617 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
618 const SERVICE_INVARIANT_ID: string = '24632e6b-584b-4f45-80d4-fefd75fd9f14';
619 const GROUP_ROLE: string = 'SERVICE-ACCESS';
620 const GROUP_TYPE: string = 'LOAD-GROUP';
621
622 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
623 jsonBuilderAndMock.basicJson(
624 res,
625 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
626 200,
627 0,
628 "ServiceTreeWithMultipleChildren_serviceModel",
629 )
630 });
631
632 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
633
634 jsonBuilderAndMock.basicJson(
635 res,
636 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
637 200, 0,
638 "serviceWithVnfGroupsChildren_serviceInstance",
639 )
640 });
641 cy.server()
642 .route({
643 method: 'GET',
644 status: 200,
645 url: Cypress.config('baseUrl') + `/aai_search_group_members/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INVARIANT_ID}/${GROUP_TYPE}/${GROUP_ROLE}`,
646 response: []
647 }).as('VnfGroup_searchMembersResponse');
648
649 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&mode=EDIT`);
650
651 cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
652 .eq(0).click({force: true}).then(() => {
653 cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
Ittay Sternf7926712019-07-07 19:23:03 +0300654 cy.getElementByDataTestsId('total-amount').should('have.text', '0 VNFs match your criteria |');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300655 cy.getElementByDataTestsId('total-selected').should('have.text', '0 VNF selected');
656 cy.get('.no-result').should('have.text', 'No VNFs were found that can belong to this group.');
657 });
658 })
659 });
660
661 it('Check scaling policy - in Create new service mode', () => {
662 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
663 const SERVICE_TYPE: string = "TYLER SILVIA";
664 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
665 const SERVICE_INVARIANT_ID: string = 'c989ab9a-33c7-46ec-b521-1b2daef5f047';
666 const GROUP_ROLE: string = 'SERVICE-ACCESS';
667 const GROUP_TYPE: string = 'LOAD-GROUP';
668 const GROUP_NAME_TO_DEPLOY = 'groupingservicefortest..ResourceInstanceGroup..1';
669 const NODE_ID = 'c2b300e6-45de-4e5e-abda-3032bee2de56';
670 const FULL_GROUP_NAME = 'node-' + NODE_ID + '-' + GROUP_NAME_TO_DEPLOY;
671 let serviceModel: JSON;
672 let basicServiceInstance: JSON;
673
674 cy.server().route({
675 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
676 method: 'POST',
677 status: 200,
678 response: "[]",
679 }).as("expectedPostAsyncInstantiation");
680
681 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
682 serviceModel = res;
683 });
684
685 cy.readFile('./cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json').then((res) => {
686 res.optionalGroupMembersMap = {};
687 basicServiceInstance = res;
688 });
689
690 cy.readFile('../vid-automation/src/test/resources/VnfGroup/searchMembersResponse.json').then((res) => {
691 jsonBuilderAndMock.basicJson(
692 res,
693 Cypress.config('baseUrl') + `/aai_search_group_members/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INVARIANT_ID}/${GROUP_TYPE}/${GROUP_ROLE}`,
694 200, 0,
695 "VnfGroup_searchMembersResponse",
696 )
697 });
698
699 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((reduxRes) => {
700
701 reduxRes.service.serviceHierarchy[SERVICE_MODEL_ID] = serviceModel;
702
703 reduxRes.service.serviceInstance[SERVICE_MODEL_ID] = basicServiceInstance;
704
705 cy.setReduxState(<any>reduxRes);
706
707 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=' + SERVICE_MODEL_ID);
708 cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY).find(`[data-tests-id='node-type-indicator']`).contains('G');
709 cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY).contains('' + GROUP_NAME_TO_DEPLOY);
710 cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY + '-add-btn').get('i').should('have.class', 'fa-plus-circle');
711
712 cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY + '-add-btn').click({force: true});
713 cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY + '-add-btn').click({force: true});
714
715 cy.getElementByDataTestsId('node-' + NODE_ID + '-' + GROUP_NAME_TO_DEPLOY + '-menu-btn').each((row, index) => {
716 cy.wrap(row).click({force: true}).then(() => {
717 cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
Ittay Sternf7926712019-07-07 19:23:03 +0300718
Ittay Stern6f900cc2018-08-29 17:01:32 +0300719 });
720 });
721 });
Ittay Stern6f900cc2018-08-29 17:01:32 +0300722 });
723 });
724
725 it(`Check scaling policy in Edit mode`, () => {
726 const SUBSCRIBER_ID: string = "global-customer-id";
727 const SERVICE_TYPE: string = "service-instance-type";
728 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
729 const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
730 const SERVICE_INVARIANT_ID: string = '24632e6b-584b-4f45-80d4-fefd75fd9f14';
731 const GROUP_ROLE: string = 'SERVICE-ACCESS';
732 const GROUP_TYPE: string = 'LOAD-GROUP';
733 const NODE_ID = 'daeb6568-cef8-417f-9075-ed259ce59f48';
734 const GROUP_NAME_TO_DEPLOY = 'groupingservicefortest..ResourceInstanceGroup..0';
735 const FULL_GROUP_NAME = 'node-' + NODE_ID + '-' + GROUP_NAME_TO_DEPLOY;
736
737 cy.server().route({
738 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
739 method: 'POST',
740 status: 200,
741 response: "[]",
742 }).as("expectedPostAsyncInstantiation");
743
744 cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
745 jsonBuilderAndMock.basicJson(
746 res,
747 Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
748 200,
749 0,
750 "ServiceTreeWithMultipleChildren_serviceModel",
751 )
752 });
753
754 cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
755
756 jsonBuilderAndMock.basicJson(
757 res,
758 Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
759 200, 0,
760 "serviceWithVnfGroupsChildren_serviceInstance",
761 )
762 });
763
764 cy.readFile('../vid-automation/src/test/resources/VnfGroup/searchMembersResponse.json').then((res) => {
765
766 jsonBuilderAndMock.basicJson(
767 res,
768 Cypress.config('baseUrl') + `/aai_search_group_members/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INVARIANT_ID}/${GROUP_TYPE}/${GROUP_ROLE}`,
769 200, 0,
770 "VnfGroup_searchMembersResponse",
771 )
772 });
773
774 cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&mode=EDIT`);
775 cy.getElementByDataTestsId('node-' + NODE_ID + '-' + GROUP_NAME_TO_DEPLOY + '-menu-btn')
776 .eq(0).click({force: true}).then(() => {
777 cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
Ittay Sternf7926712019-07-07 19:23:03 +0300778 cy.getElementByDataTestsId('total-amount').should('have.text', '4 VNFs match your criteria |');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300779 cy.get('.allCheckboxAreSelected input').click({force: true});
780 cy.getElementByDataTestsId('setMembersBtn').click({force: true}).then(() => {
781 checkIsErrorAppear(true, FULL_GROUP_NAME, 4, 0);
782
783 clickOnVnfMemberAndAssertScaling(6, 'context-menu-remove', true, FULL_GROUP_NAME, 4, 0);
784 clickOnVnfMemberAndAssertScaling(5, 'context-menu-remove', true, FULL_GROUP_NAME, 4, 0);
785 clickOnVnfMemberAndAssertScaling(0, 'context-menu-delete', false, FULL_GROUP_NAME, 4, 0);
786 clickOnVnfMemberAndAssertScaling(0, 'context-menu-undoDelete', true, FULL_GROUP_NAME, 4, 0);
787 clickOnVnfMemberAndAssertScaling(4, 'context-menu-remove', false, FULL_GROUP_NAME, 4, 0);
788 testResetAddMemberModal();
789 testUpdateBtn();
790 })
791 });
792 });
793 });
794
795 function removeVnfGroup() {
796 cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
797 .click({force: true});
798 cy.getElementByDataTestsId('context-menu-remove').click({force: true});
799 }
800
801 function testUpdateBtn() {
802 cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click();
803 cy.getReduxState().then((state) => {
804 cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
805 cy.readFile('../vid-automation/src/test/resources/VnfGroup/vnfGroupWithExistingAndNewVnfMembers.json').then((expectedResult) => {
806 cy.deepCompare(xhr.request.body, expectedResult);
807 });
808 });
809 });
810 }
811
812 function testCheckbox() {
813 let totalNumber = 4;
814 cy.get('.allCheckboxAreSelected input').click({force: true});
815 cy.getElementByDataTestsId('setMembersBtn').should('not.have.attr', 'disabled');
Ittay Sternf7926712019-07-07 19:23:03 +0300816 cy.getElementByDataTestsId('numberOfNotHideRows').contains(totalNumber);
817 cy.getElementByDataTestsId('numberOfSelectedRows').contains(totalNumber);
Ittay Stern6f900cc2018-08-29 17:01:32 +0300818 cy.get('.sdcCheckboxMember input').eq(0).click({force: true});
Ittay Sternf7926712019-07-07 19:23:03 +0300819 cy.getElementByDataTestsId('numberOfSelectedRows').contains(totalNumber - 1);
Ittay Stern6f900cc2018-08-29 17:01:32 +0300820 cy.get('.sdcCheckboxMember input').eq(1).click({force: true});
Ittay Sternf7926712019-07-07 19:23:03 +0300821 cy.getElementByDataTestsId('numberOfSelectedRows').contains(totalNumber - 2);
Ittay Stern6f900cc2018-08-29 17:01:32 +0300822 cy.get('.allCheckboxAreSelected input').click({force: true});
Ittay Sternf7926712019-07-07 19:23:03 +0300823 cy.getElementByDataTestsId('numberOfSelectedRows').contains(totalNumber);
Ittay Stern6f900cc2018-08-29 17:01:32 +0300824 cy.get('.allCheckboxAreSelected input').click({force: true});
Ittay Sternf7926712019-07-07 19:23:03 +0300825 cy.getElementByDataTestsId('numberOfSelectedRows').contains(0);
Ittay Stern6f900cc2018-08-29 17:01:32 +0300826
827 cy.getElementByDataTestsId("vnf-members-search").find('input').type("2.0");
Ittay Sternf7926712019-07-07 19:23:03 +0300828 cy.getElementByDataTestsId('numberOfNotHideRows').contains(1);
Ittay Stern6f900cc2018-08-29 17:01:32 +0300829 cy.getElementByDataTestsId("vnf-members-search").find('input').clear().type("vnf1");
Ittay Sternf7926712019-07-07 19:23:03 +0300830 cy.getElementByDataTestsId('numberOfNotHideRows').contains(1);
Ittay Stern6f900cc2018-08-29 17:01:32 +0300831 cy.get('.allCheckboxAreSelected input').click({force: true});
Ittay Sternf7926712019-07-07 19:23:03 +0300832 cy.getElementByDataTestsId('numberOfSelectedRows').contains(1);
Ittay Stern6f900cc2018-08-29 17:01:32 +0300833 cy.getElementByDataTestsId("vnf-members-search").find('input').clear();
Ittay Sternf7926712019-07-07 19:23:03 +0300834 cy.getElementByDataTestsId('numberOfSelectedRows').contains(1);
Ittay Stern6f900cc2018-08-29 17:01:32 +0300835
836 cy.getElementByDataTestsId('setMembersBtn').click({force: true});
837 //check second time behavior (selected VNFs should be filtered)
838 cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
839 .eq(1).click({force: true}).then(() => {
840 cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
Ittay Sternf7926712019-07-07 19:23:03 +0300841 cy.getElementByDataTestsId('numberOfNotHideRows').contains(totalNumber - 1);
Ittay Stern6f900cc2018-08-29 17:01:32 +0300842 cy.getElementByDataTestsId('cancelBtn').click({force: true});
843 });
844 });
845
846 }
847 function testResetAddMemberModal(): void{
848 cy.getElementByDataTestsId('node-groupingservicefortest..ResourceInstanceGroup..1-add-btn').click({force: true})
849 .getElementByDataTestsId('node-c2b300e6-45de-4e5e-abda-3032bee2de56-groupingservicefortest..ResourceInstanceGroup..1-menu-btn').eq(0).click({force: true}).then(() => {
850 cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
Ittay Sternf7926712019-07-07 19:23:03 +0300851 cy.getElementByDataTestsId('numberOfNotHideRows').contains(0);
Ittay Stern6f900cc2018-08-29 17:01:32 +0300852 cy.getElementByDataTestsId('cancelBtn').click({force: true});
853 });
854 cy.getElementByDataTestsId('node-c2b300e6-45de-4e5e-abda-3032bee2de56-groupingservicefortest..ResourceInstanceGroup..1-menu-btn').eq(0).click({force: true}).then(() => {
855 cy.getElementByDataTestsId('context-menu-remove').click({force: true});
856 });
857 });
858 }
859 function checkIsErrorAppear(isError: boolean, groupRowId: string, limit: number, index: number) {
860 const isErrorPrefix = isError ? '' : 'not.';
861 cy.getElementByDataTestsId('error-msg-wrapper').should(isErrorPrefix + 'exist');
862 cy.getElementByDataTestsId('deployBtn').should(isErrorPrefix + 'have.attr', 'disabled');
863 cy.getElementByDataTestsId(groupRowId).eq(index).find("[data-tests-id='scaling-policy']").should(isErrorPrefix + 'have.text', 'Limit' + limit);
864 cy.getElementByDataTestsId('error-msg-title').should(isErrorPrefix + 'exist');
865 cy.getElementByDataTestsId('error-msg-sub-title').should(isErrorPrefix + 'exist');
866 cy.getElementByDataTestsId('error-msg-description').should(isErrorPrefix + 'exist');
867 }
868
869 function clickOnVnfMemberAndAssertScaling(childIndex: number, menuItemTestId: string, isError: boolean, groupRowId: string, limit: number, index: number) {
870 cy.get('.tree-children').find('.node-wrapper').eq(childIndex).find('.icon-browse').click({force: true})
871 .getElementByDataTestsId(menuItemTestId).click({force: true}).then(() => {
872 checkIsErrorAppear(isError, groupRowId, limit, index);
873 });
874 }
Ittay Stern6f900cc2018-08-29 17:01:32 +0300875 }
876 );
877});