summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts
blob: 2f98ba86450dd13f09d0a7fc94d8b5d9a89c6280 (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
///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
describe('Drawing board', function () {
  describe('basic UI tests', () => {

    beforeEach(() => {
      cy.window().then((win) => {
        win.sessionStorage.clear();
        cy.setReduxState();
        cy.preventErrorsOnLoading();
        cy.initAAIMock();
        cy.initVidMock();
        cy.login();
      });
    });


    it('should display service model name', function () {
      cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
        cy.setReduxState(<any>res);
        cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
        cy.get('#service-model-name').contains('action-data');
      });
    });

    it('should display icon and message if no vnf and vnfModules', function () {
      cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
        cy.setReduxState(<any>res);
        cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');

        cy.get('#not-node-img-id').and('be.visible');
      });
    });

    it('should show alert on remove vnf with modules', function () {
      cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => {
        cy.setReduxState(<any>res);
        cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
        cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_ADIOD-vPE 0-menu-btn')
          .click({force: true});
        // assert vfModules are enabled
        cy.get('.tree-node-disabled div[data-tests-id="node-2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1"]')
          .should('not.be.visible');
        cy.get('.icon-trash').click();
        cy.get('.title').contains('Remove VNF');
        cy.get('.sdc-button').contains('Remove VNF').click();
        // assert vfModules are disabled after remove parent vnf
        cy.get('.tree-node-disabled div[data-tests-id="node-2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1"]')
          .should('be.visible');
      });
    });

    it('should not show alert on remove vnf without modules', function () {
      cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => {
        cy.setReduxState(<any>res);
        cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
        cy.getElementByDataTestsId('node-0903e1c0-8e03-4936-b5c2-260653b96413-2017-388_ADIOD-vPE 1-menu-btn')
          .click({force: true});
        cy.get('.icon-trash').click();
      });
    });

    it('should show <Automatically Assigned> if ecomp is true', function () {
      cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
        cy.setReduxState(<any>res);
        cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
        cy.getElementByDataTestsId('node-2017-488_ADIOD-vPE 0-add-btn').click({force: true});

        cy.selectDropdownOptionByText('productFamily', 'DHV');
        cy.selectDropdownOptionByText('lcpRegion', 'mtn6');
        cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testgamma');
        cy.selectDropdownOptionByText('lineOfBusiness', 'ECOMP');
        cy.selectDropdownOptionByText('platform', 'platform');

        cy.getElementByDataTestsId('vnf-form-set').click({force: true});

        cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_ADIOD-vPE 0').contains('<Automatically Assigned>');
      });
    });

    it('should show model nameif ecomp is false', function () {
      const vnfModelName: string = '2017-488_ADIOD-vPE 0';
      cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
        res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs[vnfModelName].properties.ecomp_generated_naming = 'false';
        cy.setReduxState(<any>res);
        cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
        cy.getElementByDataTestsId('node-2017-488_ADIOD-vPE 0-add-btn').click({force: true});

        cy.selectDropdownOptionByText('productFamily', 'DHV');
        cy.selectDropdownOptionByText('lcpRegion', 'mtn6');
        cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testgamma');
        cy.selectDropdownOptionByText('lineOfBusiness', 'ECOMP');
        cy.selectDropdownOptionByText('platform', 'platform');

        cy.getElementByDataTestsId('vnf-form-set').click({force: true});

        cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_ADIOD-vPE 0').contains(vnfModelName);
      });
    });

    // describe('add instance open a popup', () => {
    //
    //   it('shouldn add vfModule without popup with no empty required fields', function () {
    //     cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => {
    //       res.service.serviceInstance["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].vnfs["2017-488_ADIOD-vPE 0"].vfModules = [];
    //       cy.setReduxState(<any>res);
    //       cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
    //       cy.get('available-models-tree tree-node-expander').eq(2).click();
    //       cy.getElementByDataTestsId('node-2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1-add-btn').click();
    //       cy.get('drawing-board-tree .toggle-children').click();
    //       cy.getElementByDataTestsId('node-25284168-24bb-4698-8cb4-3f509146eca5-2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1')
    //         .and('be.visible');
    //     });
    //   });
    //
    //   it('should add vfModule with popup if empty required dynamic input', function () {
    //     cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => {
    //       res.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].vnfs["2017-488_ADIOD-vPE 0"].vfModules["2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1"].inputs["adiodvpe0_bandwidth"].default = '';
    //       res.service.serviceInstance["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].vnfs["2017-488_ADIOD-vPE 0"].vfModules = [];
    //       cy.setReduxState(<any>res);
    //       cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
    //       cy.get('available-models-tree tree-node-expander').eq(2).click();
    //       cy.getElementByDataTestsId('node-2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1-add-btn').click();
    //       cy.get('#instance-popup').and('be.visible');
    //     });
    //
    //   });
    //
    // });
  });
});