aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/integration/iFrames/vnfGroups.e2e.ts
blob: 60fbfeaba63d0b16a57abd49f79a9c6225195e97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';

describe('Vnf Groups', function () {
  var jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();

  beforeEach(() => {
      cy.clearSessionStorage();
      cy.setReduxState();
      cy.preventErrorsOnLoading();
      cy.initAAIMock();
      cy.initVidMock();
      cy.permissionVidMock();
      cy.setTestApiParamToGR();
      cy.login();
  });

  afterEach(() => {
    cy.screenshot();
  });

  describe('Vnf Group model basic view', function () {

      it('Vnf group open new view edit', function () {
        const instanceName: string = 'ABC';
        const groupName = 'groupingservicefortest..ResourceInstanceGroup..0';
        const nodeId = 'daeb6568-cef8-417f-9075-ed259ce59f48';
        const serviceId = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
        cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + "/rest/models/services/" + serviceId,
            200,
            0,
            "ServiceWithVnfGroup",
          );

          cy.buildReduxStateWithServiceRespone(res, serviceId, false);
          cy.openIframe('app/ui/#/servicePlanning?serviceModelId=' + serviceId);
          cy.getElementByDataTestsId('node-' + groupName).find(`[data-tests-id='node-type-indicator']`).contains('G');
          cy.getElementByDataTestsId('node-' + groupName).contains('' + groupName);
          cy.getElementByDataTestsId('node-' + groupName + '-add-btn').get('i').should('have.class', 'fa-plus-circle');
          cy.getElementByDataTestsId('node-' + groupName + '-add-btn').click({force: true});
          cy.getElementByDataTestsId('instanceName').clear();
          cy.typeToInput('instanceName', instanceName);
          cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
            cy.getElementByDataTestsId('numberButton').contains('1');
            cy.getElementByDataTestsId('node-' + nodeId + '-' + groupName).contains(instanceName);
            cy.getElementByDataTestsId('node-' + nodeId + '-' + groupName + '-menu-btn')
              .click({force: true});
            cy.getElementByDataTestsId('context-menu-edit').click();
            cy.getElementByDataTestsId('instanceName').clear();
            cy.typeToInput('instanceName', instanceName + instanceName);
            cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
              cy.getElementByDataTestsId('node-' + nodeId + '-' + groupName + '-menu-btn').click({force: true})
                .getElementByDataTestsId('context-menu-remove').click();
            });
          });
        });
      });

      it('Create new service with vnf group', () => {

        const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
        const GROUP_NAME_TO_DEPLOY = 'groupingservicefortest..ResourceInstanceGroup..1';
        const NODE_ID = 'c2b300e6-45de-4e5e-abda-3032bee2de56';
        let serviceModel: JSON;
        let basicServiceInstance: JSON;

        cy.server().route({
          url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
          method: 'POST',
          status: 200,
          response: "[]",
        }).as("expectedPostAsyncInstantiation");

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
          serviceModel = res;
        });

        cy.readFile('cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json').then((res) => {
          basicServiceInstance = res;
        });

        cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((reduxRes) => {

          reduxRes.service.serviceHierarchy[SERVICE_MODEL_ID] = serviceModel;
          reduxRes.service.serviceInstance[SERVICE_MODEL_ID] = basicServiceInstance;

          cy.setReduxState(<any>reduxRes);

          cy.openIframe('app/ui/#/servicePlanning?serviceModelId=' + SERVICE_MODEL_ID);
          cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY).find(`[data-tests-id='node-type-indicator']`).contains('G');
          cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY).contains('' + GROUP_NAME_TO_DEPLOY);
          cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY + '-add-btn').get('i').should('have.class', 'fa-plus-circle');
          cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY + '-add-btn').click({force: true});
          cy.getElementByDataTestsId('node-' + NODE_ID + '-' + GROUP_NAME_TO_DEPLOY + '-menu-btn')
            .click({force: true});
          cy.getElementByDataTestsId('context-menu-edit').click();
          cy.getElementByDataTestsId('instanceName').clear();
          cy.typeToInput('instanceName', "ABC");
          cy.getElementByDataTestsId('form-set').click({force: true});
          cy.getElementByDataTestsId('deployBtn').should('have.text', 'DEPLOY').click();
          cy.getElementByDataTestsId('isViewOnly-status-test').contains('IN DESIGN');
          cy.getReduxState().then((state) => {
            const vnfGroup = state.service.serviceInstance[SERVICE_MODEL_ID].vnfGroups[GROUP_NAME_TO_DEPLOY];

            cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
                cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupCreateRequest.json').then((expectedResult) => {
                expectedResult.vnfGroups[GROUP_NAME_TO_DEPLOY].trackById = vnfGroup.trackById;
                cy.deepCompare(xhr.request.body, expectedResult);
              });
            });
          });

        });

      });

      it('Delete vnf group with members', () => {
        cy.initSearchVNFMemebers();
        const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
        let serviceModel: JSON;
        let basicServiceInstance: JSON;

        cy.server().route({
          url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
          method: 'POST',
          status: 200,
          response: "[]",
        }).as("expectedPostAsyncInstantiation");

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
          serviceModel = res;
        });

        cy.readFile('cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json').then((res) => {
          basicServiceInstance = res;
        });

        cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((reduxRes) => {

          reduxRes.service.serviceHierarchy[SERVICE_MODEL_ID] = serviceModel;
          reduxRes.service.serviceInstance[SERVICE_MODEL_ID] = basicServiceInstance;
          reduxRes.global.genericModalHelper = {};

          cy.setReduxState(<any>reduxRes);

          cy.openIframe('app/ui/#/servicePlanning?serviceModelId=' + SERVICE_MODEL_ID);
          cy.getElementByDataTestsId('node-groupingservicefortest..ResourceInstanceGroup..0-add-btn').click({force: true});
          removeVnfGroup();
          cy.getElementByDataTestsId('node-groupingservicefortest..ResourceInstanceGroup..0-add-btn').click({force: true});
          cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
            .click({force: true});
          cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
            cy.get('.allCheckboxAreSelected input').click({force: true});
            cy.getElementByDataTestsId('setMembersBtn').click({force: true})
          });
          cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0').click({force: true});
          removeVnfGroup();
          cy.getElementByDataTestsId('button-remove-group').click({force: true});
          cy.get('#model-actions').should('not.exist');

        });

      });

      it('Vnf group edit mode delete empty service instance', () => {
        const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
        const SERVICE_TYPE: string = "TYLER SILVIA";
        const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
        const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
        let expectedResult: JSON;

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
            200,
            0,
            "ServiceWithVnfGrouping_serviceModel",
          );
        });

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroping_serviceInstance.json').then((res) => {
          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
            200, 0,
            "serviceWithVnfGroping_serviceInstance",
          )
        });

        cy.server().route({
          url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
          method: 'POST',
          status: 200,
          response: "[]",
        }).as("expectedPostAsyncInstantiation");

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/ServiceWithVnfGroupsDeleteRequest.json').then((res) => {
          expectedResult = res;
        });

        cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
        cy.getElementByDataTestsId('orchStatusValue').should('not.have.class', 'tag-status-value');
        cy.getElementByDataTestsId('openMenuBtn').click();
        cy.getElementByDataTestsId('context-menu-header-delete-item').should('have.text', 'Delete');
        cy.getElementByDataTestsId('context-menu-header-delete-item').click();
        cy.getElementByDataTestsId('serviceName').should('have.css', 'text-decoration');
        cy.getElementByDataTestsId('openMenuBtn').click();
        cy.getElementByDataTestsId('context-menu-header-delete-item').should('have.text', 'Undo delete');
        cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click();

        cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
          cy.deepCompare(xhr.request.body, expectedResult);

        });
      });

      it('Delete service with two vnf groups', () => {
        const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
        const SERVICE_TYPE: string = "TYLER SILVIA";
        const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
        const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
        let expectedResult: JSON;

        cy.server().route({
          url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
          method: 'POST',
          status: 200,
          response: "[]",
        }).as("expectedPostAsyncInstantiation");

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
            200, 0,
            "serviceWithVnfGroupsChildren_serviceInstance",
          )
        });

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
            200,
            0,
            "ServiceTreeWithMultipleChildren_serviceModel",
          )
        });

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/deleteServiceWith2VnfGroupsRequest_AndThreeGroupMembers.json').then((expectedResult) => {
          cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
          cy.getElementByDataTestsId('openMenuBtn').click();
          cy.getElementByDataTestsId('context-menu-header-delete-item').should('have.text', 'Delete').click();
          cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click();
          cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
            cy.deepCompare(xhr.request.body, expectedResult);
          });
        });
      });

      it(`when open service with group in EDIT mode, service instance is shown as expected - e2e with input and output API's tests"`, function () {
        const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
        const SERVICE_TYPE: string = "TYLER SILVIA";
        const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
        const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';

        cy.server().route({
          url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
          method: 'POST',
          status: 200,
          response: "[]",
        }).as("expectedPostAsyncInstantiation");

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
            200,
            0,
            "ServiceTreeWithMultipleChildren_serviceModel",
          )
        });

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
            200, 0,
            "serviceWithVnfGroupsChildren_serviceInstance",
          )
        });

        cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);

        /*
        0. title area -> generic stuff
                         instance name
                         orch status
                         service name
        */
        cy.getElementByDataTestsId("serviceInstance").should('have.text', 'Service instance:');
        cy.getElementByDataTestsId("orchStatusLabel").should('have.text', 'Orch Status:');
        // ERROR! cy.getElementByDataTestsId("quantityLabel").should('not.be.visible');
        // ERROR! cy.getElementByDataTestsId("servicesQuantity").should('not.be.visible');

        // specific
        cy.getElementByDataTestsId("serviceName").should('have.text', 'SERVICE_INSTANCE_NAME');
        cy.getElementByDataTestsId("orchStatusValue").should('have.text', 'GARBAGE DATA');
        cy.get('span#service-model-name').contains('Grouping Service for Test');

        // no need to expand anything
        cy.get('available-models-tree').find('.toggle-children').should('not.exist');

        /*
        1. Left tree
        */
        const leftShouldHaves: { [dataTestId: string]: { [dataTestId: string]: string; }; } = {
          'node-groupingservicefortest..ResourceInstanceGroup..0': {
            'node-type-indicator': 'G',
            'node-name': 'groupingservicefortest..ResourceInstanceGroup..0',
            'numberButton': '2',
          },
          'node-groupingservicefortest..ResourceInstanceGroup..1': {
            'node-type-indicator': 'G',
            'node-name': 'groupingservicefortest..ResourceInstanceGroup..1',
            'numberButton': '',
          },
        };
        cy.getElementByDataTestsId('search-left-tree-input').type('group');
        for (let node in leftShouldHaves) {
          cy.getElementByDataTestsId(node).find(`[data-tests-id= '${'node-name'}']`).find('.highlight').eq(0).should('have.text', 'group');

          for (let span in leftShouldHaves[node]) {
            const expected = leftShouldHaves[node][span];
            cy.getElementByDataTestsId(node).find(`[data-tests-id='${span}']`).should(expected ? 'have.text' : 'not.exist', expected);
          }
        }


        /*
        2. Right tree
        */
        const rightShouldHaves: { [dataTestId: string]: { [dataTestId: string]: string; }; } = {
          'node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0:0': {
            'node-type-indicator': 'G',
            'node-name': 'VNF_GROUP1_INSTANCE_NAME',
            'status-property-orchStatus': '',
            'status-property-provStatus': '',
            // 'status-property-inMaint': '', not exists for false in maint
          },
          'node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0:1': {
            'node-type-indicator': 'G',
            'node-name': 'VNF_GROUP2_INSTANCE_NAME',
            'status-property-orchStatus': '',
            'status-property-provStatus': '',
            // 'status-property-inMaint': 'false',
          },
        };
        cy.getElementByDataTestsId('search-right-tree-input').type('vnf');

        for (let node in rightShouldHaves) {
          var [nodeName, nodeEq] = node.split(":");
          for (let span in rightShouldHaves[node]) {
            cy.getElementByDataTestsId(nodeName).eq(+nodeEq).find(`[data-tests-id='${span}']`).should('have.text', rightShouldHaves[node][span]);
            cy.getElementByDataTestsId(nodeName).eq(+nodeEq).find(`[data-tests-id= '${'node-name'}']`).find('.highlight').eq(0).should('have.text', 'VNF');

          }
        }

        /*
        3. Left to right connections
        */
        const leftShouldHighlight: { [text: string]: string[] } = {
          'groupingservicefortest..ResourceInstanceGroup..0': ['VNF_GROUP1_INSTANCE_NAME', 'VNF_GROUP2_INSTANCE_NAME'],
          'groupingservicefortest..ResourceInstanceGroup..1': [],
        };

        for (let text in leftShouldHighlight) {
          cy.get('available-models-tree').contains(text).click();
          cy.get('.node-content-wrapper-active').find(`[data-tests-id='node-name']`).should('have.text', text + leftShouldHighlight[text].join(''));
        }

        /*
        4. Right to left connections
         */
        const rightShouldHighlight: { [text: string]: string[] } = {
          'VNF_GROUP1_INSTANCE_NAME': ['groupingservicefortest..ResourceInstanceGroup..0'],
          'VNF_GROUP2_INSTANCE_NAME': ['groupingservicefortest..ResourceInstanceGroup..0'],
        };

        for (let node in rightShouldHighlight) {
          cy.get('drawing-board-tree').contains(node).click();
          cy.get('.node-content-wrapper-active').find(`[data-tests-id='node-name']`).should('have.text', rightShouldHighlight[node].join('') + node);
        }

        /*
        Menus
         */
        // SETUP: delete one group on the right; add one group from the left
        const myNode = 'node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0';

        cy.getElementByDataTestsId(`${myNode}-menu-btn`).eq(0).click({force: true})
          .getElementByDataTestsId('context-menu-delete').click();

        cy.getElementByDataTestsId('node-groupingservicefortest..ResourceInstanceGroup..0-add-btn').click({force: true});
        cy.getElementByDataTestsId(`${myNode}-menu-btn`).eq(2).click({force: true})
          .getElementByDataTestsId('context-menu-edit').click();
        cy.getElementByDataTestsId('instanceName').clear();
        cy.typeToInput('instanceName', 'VNF_GROUP3_INSTANCE_NAME');
        cy.getElementByDataTestsId('form-set').click({force: true});

        // TEST:
        // #2 is just added
        // #1 is from AAI
        // #0 is deleted
        const menuShouldHave: { [text: string]: string[] } = {
          [`${myNode}-menu-btn:2`]: ['remove', 'addGroupMember'],
          [`${myNode}-menu-btn:1`]: ['showAuditInfo', 'addGroupMember', 'delete'],
          [`${myNode}-menu-btn:0`]: ['showAuditInfo', 'undoDelete'],
        };

        for (let node in menuShouldHave) {
          const [nodeName, nodeEq] = node.split(":");
          let enabledActions:string[] = menuShouldHave[node];
          cy.assertMenuItemsForNode(enabledActions, nodeName, +nodeEq);
        }

        const GROUP_NAME_TO_DEPLOY: string = 'groupingservicefortest..ResourceInstanceGroup..0';
        cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click();

        cy.getReduxState().then((state) => {
          const addedVnfGroup = state.service.serviceInstance[SERVICE_MODEL_ID].vnfGroups[GROUP_NAME_TO_DEPLOY];

          cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
            cy.readFile('../vid-automation/src/test/resources/VnfGroup/VnfGroupCreate1Delete1None1Request.json').then((expectedResult) => {
              expectedResult.vnfGroups[GROUP_NAME_TO_DEPLOY].trackById = addedVnfGroup.trackById;
              cy.deepCompare(xhr.request.body, expectedResult);
            });
          });
        });
      });

      it(`vnf group with vnf members should display correctly and should have delete option"`, function () {
        const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
        const SERVICE_TYPE: string = "TYLER SILVIA";
        const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
        const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
            200,
            0,
            "ServiceTreeWithMultipleChildren_serviceModel",
          )
        });

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {
          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
            200, 0,
            "serviceWithVnfGroupsChildren_serviceInstance",
          )
        });

        cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&mode=EDIT`);
        cy.getElementByDataTestsId('deployBtn').should('have.attr', 'disabled');
        cy.get('#VnfGroup_VNF .icon-browse').eq(0).click({force: true}).then(() => {
          cy.getElementByDataTestsId('context-menu-delete').click({force: true});
          cy.getElementByDataTestsId('deployBtn').should('not.have.attr', 'disabled');

          cy.get('#VnfGroup_VNF .icon-browse').eq(0).click({force: true}).then(() => {
            cy.getElementByDataTestsId('context-menu-undoDelete').click({force: true});
            cy.getElementByDataTestsId('deployBtn').should('have.attr', 'disabled');
          });
        });


        cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
          .eq(0).click({force: true}).then(() => {
          cy.getElementByDataTestsId('context-menu-delete').click({force: true});
          cy.getElementByDataTestsId('deployBtn').should('not.have.attr', 'disabled');
        })
      });

      it('Delete 2 from 3 VNF members and check request body of deploy', function () {
        const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
        const SERVICE_TYPE: string = "TYLER SILVIA";
        const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
        const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';

        cy.server().route({
          url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
          method: 'POST',
          status: 200,
          response: "[]",
        }).as("expectedPostAsyncInstantiation");

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
            200,
            0,
            "ServiceTreeWithMultipleChildren_serviceModel",
          )
        });

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {

          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
            200, 0,
            "serviceWithVnfGroupsChildren_serviceInstance",
          )
        });

        cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&mode=EDIT`);
        cy.getElementByDataTestsId('deployBtn').should('have.attr', 'disabled');

        for (let index = 0; index < 2; index++) {
          cy.get('#VnfGroup_VNF .icon-browse').eq(index).click({force: true}).then(() => {
            cy.getElementByDataTestsId('context-menu-delete').click({force: true});
            cy.getElementByDataTestsId('deployBtn').should('not.have.attr', 'disabled');
          });
        }

        cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click();

        cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
          cy.readFile('../vid-automation/src/test/resources/VnfGroup/payloadTemplate1VnfGroupWith3MembersRequest.json').then((expectedResult) => {
            expectedResult.vnfGroups.VNF_GROUP1_INSTANCE_ID.action = 'None';
            expectedResult.vnfGroups.VNF_GROUP1_INSTANCE_ID.vnfs.RELATED_VNF1_INSTANCE_ID.action = 'None_Delete';
            expectedResult.vnfGroups.VNF_GROUP1_INSTANCE_ID.vnfs.RELATED_VNF2_INSTANCE_ID.action = 'None_Delete';
            cy.deepCompare(xhr.request.body, expectedResult);
          });
        });
      });

      it(`vnf group with vnf members, add group members option open modal`, () => {
        const SUBSCRIBER_ID: string = "global-customer-id";
        const SERVICE_TYPE: string = "service-instance-type";
        const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
        const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
        const SERVICE_INVARIANT_ID: string = '24632e6b-584b-4f45-80d4-fefd75fd9f14';
        const GROUP_ROLE: string = 'SERVICE-ACCESS';
        const GROUP_TYPE: string = 'LOAD-GROUP';

        cy.server().route({
          url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
          method: 'POST',
          status: 200,
          response: "[]",
        }).as("expectedPostAsyncInstantiation");

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
            200,
            0,
            "ServiceTreeWithMultipleChildren_serviceModel",
          )
        });

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {

          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
            200, 0,
            "serviceWithVnfGroupsChildren_serviceInstance",
          )
        });
        cy.readFile('../vid-automation/src/test/resources/VnfGroup/searchMembersResponse.json').then((res) => {

          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/aai_search_group_members/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INVARIANT_ID}/${GROUP_TYPE}/${GROUP_ROLE}`,
            200, 0,
            "VnfGroup_searchMembersResponse",
          )
        });
        cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&mode=EDIT`);

        cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
          .eq(0).click({force: true}).then(() => {
          cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
            cy.getElementByDataTestsId('sourceModelName').contains("vDOROTHEA_Svc_vPRS");
            cy.getElementByDataTestsId('sourceModelInvariant').contains("24632e6b-584b-4f45-80d4-fefd75fd9f14");
            cy.get('#vnfName').eq(0).get('#VNF1_INSTANCE_NAME').contains('VNF1_INSTANCE_NAME');
            cy.get('#vnfName').eq(0).get('#VNF1_INSTANCE_ID').contains('VNF1_INSTANCE_ID');
            cy.getElementByDataTestsId('total-amount').should('have.text', '4 VNFs match your criteria |');
            cy.getElementByDataTestsId('total-selected').should('have.text', '0 VNF selected');
            cy.getElementByDataTestsId('setMembersBtn').should('have.attr', 'disabled');
            testCheckbox();
            testResetAddMemberModal();
            testUpdateBtn();
          });
        });
      });

      it(`vnf group add member get optional members return empty table"`, () => {
        const SUBSCRIBER_ID: string = "global-customer-id";
        const SERVICE_TYPE: string = "service-instance-type";
        const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
        const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
        const SERVICE_INVARIANT_ID: string = '24632e6b-584b-4f45-80d4-fefd75fd9f14';
        const GROUP_ROLE: string = 'SERVICE-ACCESS';
        const GROUP_TYPE: string = 'LOAD-GROUP';

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
            200,
            0,
            "ServiceTreeWithMultipleChildren_serviceModel",
          )
        });

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {

          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
            200, 0,
            "serviceWithVnfGroupsChildren_serviceInstance",
          )
        });
        cy.server()
          .route({
            method: 'GET',
            status: 200,
            url: Cypress.config('baseUrl') + `/aai_search_group_members/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INVARIANT_ID}/${GROUP_TYPE}/${GROUP_ROLE}`,
            response: []
          }).as('VnfGroup_searchMembersResponse');

        cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&mode=EDIT`);

        cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
          .eq(0).click({force: true}).then(() => {
          cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
            cy.getElementByDataTestsId('total-amount').should('have.text', '0 VNFs match your criteria |');
            cy.getElementByDataTestsId('total-selected').should('have.text', '0 VNF selected');
            cy.get('.no-result').should('have.text', 'No VNFs were found that can belong to this group.');
          });
        })
      });

      it('Check scaling policy - in Create new service mode', () => {
        const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
        const SERVICE_TYPE: string = "TYLER SILVIA";
        const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
        const SERVICE_INVARIANT_ID: string = 'c989ab9a-33c7-46ec-b521-1b2daef5f047';
        const GROUP_ROLE: string = 'SERVICE-ACCESS';
        const GROUP_TYPE: string = 'LOAD-GROUP';
        const GROUP_NAME_TO_DEPLOY = 'groupingservicefortest..ResourceInstanceGroup..1';
        const NODE_ID = 'c2b300e6-45de-4e5e-abda-3032bee2de56';
        const FULL_GROUP_NAME = 'node-' + NODE_ID + '-' + GROUP_NAME_TO_DEPLOY;
        let serviceModel: JSON;
        let basicServiceInstance: JSON;

        cy.server().route({
          url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
          method: 'POST',
          status: 200,
          response: "[]",
        }).as("expectedPostAsyncInstantiation");

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
          serviceModel = res;
        });

        cy.readFile('./cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json').then((res) => {
          res.optionalGroupMembersMap = {};
          basicServiceInstance = res;
        });

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/searchMembersResponse.json').then((res) => {
          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/aai_search_group_members/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INVARIANT_ID}/${GROUP_TYPE}/${GROUP_ROLE}`,
            200, 0,
            "VnfGroup_searchMembersResponse",
          )
        });

        cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((reduxRes) => {

          reduxRes.service.serviceHierarchy[SERVICE_MODEL_ID] = serviceModel;

          reduxRes.service.serviceInstance[SERVICE_MODEL_ID] = basicServiceInstance;

          cy.setReduxState(<any>reduxRes);

          cy.openIframe('app/ui/#/servicePlanning?serviceModelId=' + SERVICE_MODEL_ID);
          cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY).find(`[data-tests-id='node-type-indicator']`).contains('G');
          cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY).contains('' + GROUP_NAME_TO_DEPLOY);
          cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY + '-add-btn').get('i').should('have.class', 'fa-plus-circle');

          cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY + '-add-btn').click({force: true});
          cy.getElementByDataTestsId('node-' + GROUP_NAME_TO_DEPLOY + '-add-btn').click({force: true});

          cy.getElementByDataTestsId('node-' + NODE_ID + '-' + GROUP_NAME_TO_DEPLOY + '-menu-btn').each((row, index) => {
            cy.wrap(row).click({force: true}).then(() => {
              cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {

              });
            });
          });
        });
      });

      it(`Check scaling policy in Edit mode`, () => {
        const SUBSCRIBER_ID: string = "global-customer-id";
        const SERVICE_TYPE: string = "service-instance-type";
        const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
        const SERVICE_MODEL_ID: string = '4117a0b6-e234-467d-b5b9-fe2f68c8b0fc';
        const SERVICE_INVARIANT_ID: string = '24632e6b-584b-4f45-80d4-fefd75fd9f14';
        const GROUP_ROLE: string = 'SERVICE-ACCESS';
        const GROUP_TYPE: string = 'LOAD-GROUP';
        const NODE_ID = 'daeb6568-cef8-417f-9075-ed259ce59f48';
        const GROUP_NAME_TO_DEPLOY = 'groupingservicefortest..ResourceInstanceGroup..0';
        const FULL_GROUP_NAME = 'node-' + NODE_ID + '-' + GROUP_NAME_TO_DEPLOY;

        cy.server().route({
          url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
          method: 'POST',
          status: 200,
          response: "[]",
        }).as("expectedPostAsyncInstantiation");

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/groupingServiceRoleResponse.json').then((res) => {
          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/rest/models/services/${SERVICE_MODEL_ID}`,
            200,
            0,
            "ServiceTreeWithMultipleChildren_serviceModel",
          )
        });

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroupsChildren_serviceInstance.json').then((res) => {

          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/aai_get_service_instance_topology/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INSTANCE_ID}`,
            200, 0,
            "serviceWithVnfGroupsChildren_serviceInstance",
          )
        });

        cy.readFile('../vid-automation/src/test/resources/VnfGroup/searchMembersResponse.json').then((res) => {

          jsonBuilderAndMock.basicJson(
            res,
            Cypress.config('baseUrl') + `/aai_search_group_members/${SUBSCRIBER_ID}/${SERVICE_TYPE}/${SERVICE_INVARIANT_ID}/${GROUP_TYPE}/${GROUP_ROLE}`,
            200, 0,
            "VnfGroup_searchMembersResponse",
          )
        });

        cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&mode=EDIT`);
        cy.getElementByDataTestsId('node-' + NODE_ID + '-' + GROUP_NAME_TO_DEPLOY + '-menu-btn')
          .eq(0).click({force: true}).then(() => {
          cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
            cy.getElementByDataTestsId('total-amount').should('have.text', '4 VNFs match your criteria |');
            cy.get('.allCheckboxAreSelected input').click({force: true});
            cy.getElementByDataTestsId('setMembersBtn').click({force: true}).then(() => {
              checkIsErrorAppear(true, FULL_GROUP_NAME, 4, 0);

              clickOnVnfMemberAndAssertScaling(6, 'context-menu-remove', true, FULL_GROUP_NAME, 4, 0);
              clickOnVnfMemberAndAssertScaling(5, 'context-menu-remove', true, FULL_GROUP_NAME, 4, 0);
              clickOnVnfMemberAndAssertScaling(0, 'context-menu-delete', false, FULL_GROUP_NAME, 4, 0);
              clickOnVnfMemberAndAssertScaling(0, 'context-menu-undoDelete', true, FULL_GROUP_NAME, 4, 0);
              clickOnVnfMemberAndAssertScaling(4, 'context-menu-remove', false, FULL_GROUP_NAME, 4, 0);
              testResetAddMemberModal();
              testUpdateBtn();
            })
          });
        });
      });

      function removeVnfGroup() {
        cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
          .click({force: true});
        cy.getElementByDataTestsId('context-menu-remove').click({force: true});
      }

      function testUpdateBtn() {
        cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click();
        cy.getReduxState().then((state) => {
          cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
            cy.readFile('../vid-automation/src/test/resources/VnfGroup/vnfGroupWithExistingAndNewVnfMembers.json').then((expectedResult) => {
              cy.deepCompare(xhr.request.body, expectedResult);
            });
          });
        });
      }

      function testCheckbox() {
        let totalNumber = 4;
        cy.get('.allCheckboxAreSelected input').click({force: true});
        cy.getElementByDataTestsId('setMembersBtn').should('not.have.attr', 'disabled');
        cy.getElementByDataTestsId('numberOfNotHideRows').contains(totalNumber);
        cy.getElementByDataTestsId('numberOfSelectedRows').contains(totalNumber);
        cy.get('.sdcCheckboxMember input').eq(0).click({force: true});
        cy.getElementByDataTestsId('numberOfSelectedRows').contains(totalNumber - 1);
        cy.get('.sdcCheckboxMember input').eq(1).click({force: true});
        cy.getElementByDataTestsId('numberOfSelectedRows').contains(totalNumber - 2);
        cy.get('.allCheckboxAreSelected input').click({force: true});
        cy.getElementByDataTestsId('numberOfSelectedRows').contains(totalNumber);
        cy.get('.allCheckboxAreSelected input').click({force: true});
        cy.getElementByDataTestsId('numberOfSelectedRows').contains(0);

        cy.getElementByDataTestsId("vnf-members-search").find('input').type("2.0");
        cy.getElementByDataTestsId('numberOfNotHideRows').contains(1);
        cy.getElementByDataTestsId("vnf-members-search").find('input').clear().type("vnf1");
        cy.getElementByDataTestsId('numberOfNotHideRows').contains(1);
        cy.get('.allCheckboxAreSelected input').click({force: true});
        cy.getElementByDataTestsId('numberOfSelectedRows').contains(1);
        cy.getElementByDataTestsId("vnf-members-search").find('input').clear();
        cy.getElementByDataTestsId('numberOfSelectedRows').contains(1);

        cy.getElementByDataTestsId('setMembersBtn').click({force: true});
        //check second time behavior (selected VNFs should be filtered)
        cy.getElementByDataTestsId('node-daeb6568-cef8-417f-9075-ed259ce59f48-groupingservicefortest..ResourceInstanceGroup..0-menu-btn')
          .eq(1).click({force: true}).then(() => {
          cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
            cy.getElementByDataTestsId('numberOfNotHideRows').contains(totalNumber - 1);
            cy.getElementByDataTestsId('cancelBtn').click({force: true});
          });
        });

      }
      function testResetAddMemberModal(): void{
        cy.getElementByDataTestsId('node-groupingservicefortest..ResourceInstanceGroup..1-add-btn').click({force: true})
          .getElementByDataTestsId('node-c2b300e6-45de-4e5e-abda-3032bee2de56-groupingservicefortest..ResourceInstanceGroup..1-menu-btn').eq(0).click({force: true}).then(() => {
          cy.getElementByDataTestsId('context-menu-addGroupMember').click({force: true}).then(() => {
            cy.getElementByDataTestsId('numberOfNotHideRows').contains(0);
            cy.getElementByDataTestsId('cancelBtn').click({force: true});
          });
          cy.getElementByDataTestsId('node-c2b300e6-45de-4e5e-abda-3032bee2de56-groupingservicefortest..ResourceInstanceGroup..1-menu-btn').eq(0).click({force: true}).then(() => {
            cy.getElementByDataTestsId('context-menu-remove').click({force: true});
          });
        });
      }
      function checkIsErrorAppear(isError: boolean, groupRowId: string, limit: number, index: number) {
        const isErrorPrefix = isError ? '' : 'not.';
        cy.getElementByDataTestsId('error-msg-wrapper').should(isErrorPrefix + 'exist');
        cy.getElementByDataTestsId('deployBtn').should(isErrorPrefix + 'have.attr', 'disabled');
        cy.getElementByDataTestsId(groupRowId).eq(index).find("[data-tests-id='scaling-policy']").should(isErrorPrefix + 'have.text', 'Limit' + limit);
        cy.getElementByDataTestsId('error-msg-title').should(isErrorPrefix + 'exist');
        cy.getElementByDataTestsId('error-msg-sub-title').should(isErrorPrefix + 'exist');
        cy.getElementByDataTestsId('error-msg-description').should(isErrorPrefix + 'exist');
      }

      function clickOnVnfMemberAndAssertScaling(childIndex: number, menuItemTestId: string, isError: boolean, groupRowId: string, limit: number, index: number) {
        cy.get('.tree-children').find('.node-wrapper').eq(childIndex).find('.icon-browse').click({force: true})
          .getElementByDataTestsId(menuItemTestId).click({force: true}).then(() => {
          checkIsErrorAppear(isError, groupRowId, limit, index);
        });
      }
    }
  );
});