blob: 2f98ba86450dd13f09d0a7fc94d8b5d9a89c6280 [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2describe('Drawing board', function () {
3 describe('basic UI tests', () => {
4
5 beforeEach(() => {
6 cy.window().then((win) => {
7 win.sessionStorage.clear();
8 cy.setReduxState();
9 cy.preventErrorsOnLoading();
10 cy.initAAIMock();
11 cy.initVidMock();
12 cy.login();
13 });
14 });
15
16
17 it('should display service model name', function () {
18 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
19 cy.setReduxState(<any>res);
20 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
21 cy.get('#service-model-name').contains('action-data');
22 });
23 });
24
25 it('should display icon and message if no vnf and vnfModules', function () {
26 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
27 cy.setReduxState(<any>res);
28 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
29
30 cy.get('#not-node-img-id').and('be.visible');
31 });
32 });
33
34 it('should show alert on remove vnf with modules', function () {
35 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => {
36 cy.setReduxState(<any>res);
37 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
38 cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_ADIOD-vPE 0-menu-btn')
39 .click({force: true});
40 // assert vfModules are enabled
41 cy.get('.tree-node-disabled div[data-tests-id="node-2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1"]')
42 .should('not.be.visible');
43 cy.get('.icon-trash').click();
44 cy.get('.title').contains('Remove VNF');
45 cy.get('.sdc-button').contains('Remove VNF').click();
46 // assert vfModules are disabled after remove parent vnf
47 cy.get('.tree-node-disabled div[data-tests-id="node-2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1"]')
48 .should('be.visible');
49 });
50 });
51
52 it('should not show alert on remove vnf without modules', function () {
53 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => {
54 cy.setReduxState(<any>res);
55 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
56 cy.getElementByDataTestsId('node-0903e1c0-8e03-4936-b5c2-260653b96413-2017-388_ADIOD-vPE 1-menu-btn')
57 .click({force: true});
58 cy.get('.icon-trash').click();
59 });
60 });
61
62 it('should show <Automatically Assigned> if ecomp is true', function () {
63 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
64 cy.setReduxState(<any>res);
65 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
66 cy.getElementByDataTestsId('node-2017-488_ADIOD-vPE 0-add-btn').click({force: true});
67
68 cy.selectDropdownOptionByText('productFamily', 'DHV');
69 cy.selectDropdownOptionByText('lcpRegion', 'mtn6');
70 cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testgamma');
71 cy.selectDropdownOptionByText('lineOfBusiness', 'ECOMP');
72 cy.selectDropdownOptionByText('platform', 'platform');
73
74 cy.getElementByDataTestsId('vnf-form-set').click({force: true});
75
76 cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_ADIOD-vPE 0').contains('<Automatically Assigned>');
77 });
78 });
79
80 it('should show model nameif ecomp is false', function () {
81 const vnfModelName: string = '2017-488_ADIOD-vPE 0';
82 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
83 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs[vnfModelName].properties.ecomp_generated_naming = 'false';
84 cy.setReduxState(<any>res);
85 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
86 cy.getElementByDataTestsId('node-2017-488_ADIOD-vPE 0-add-btn').click({force: true});
87
88 cy.selectDropdownOptionByText('productFamily', 'DHV');
89 cy.selectDropdownOptionByText('lcpRegion', 'mtn6');
90 cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testgamma');
91 cy.selectDropdownOptionByText('lineOfBusiness', 'ECOMP');
92 cy.selectDropdownOptionByText('platform', 'platform');
93
94 cy.getElementByDataTestsId('vnf-form-set').click({force: true});
95
96 cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_ADIOD-vPE 0').contains(vnfModelName);
97 });
98 });
99
100 // describe('add instance open a popup', () => {
101 //
102 // it('shouldn add vfModule without popup with no empty required fields', function () {
103 // cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => {
104 // res.service.serviceInstance["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].vnfs["2017-488_ADIOD-vPE 0"].vfModules = [];
105 // cy.setReduxState(<any>res);
106 // cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
107 // cy.get('available-models-tree tree-node-expander').eq(2).click();
108 // cy.getElementByDataTestsId('node-2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1-add-btn').click();
109 // cy.get('drawing-board-tree .toggle-children').click();
110 // cy.getElementByDataTestsId('node-25284168-24bb-4698-8cb4-3f509146eca5-2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1')
111 // .and('be.visible');
112 // });
113 // });
114 //
115 // it('should add vfModule with popup if empty required dynamic input', function () {
116 // cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceWithVnfAndVfModules.json').then((res) => {
117 // 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 = '';
118 // res.service.serviceInstance["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].vnfs["2017-488_ADIOD-vPE 0"].vfModules = [];
119 // cy.setReduxState(<any>res);
120 // cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
121 // cy.get('available-models-tree tree-node-expander').eq(2).click();
122 // cy.getElementByDataTestsId('node-2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1-add-btn').click();
123 // cy.get('#instance-popup').and('be.visible');
124 // });
125 //
126 // });
127 //
128 // });
129 });
130});