1 ///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2 /// <reference types="Cypress" />
3 import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
4 import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
5 import {AsyncInstantiationModel} from "../../support/jsonBuilders/models/asyncInstantiation.model";
7 describe('View only drawing board', function () {
8 var jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
10 var jsonBuilderInstantiationBuilder: JsonBuilder<AsyncInstantiationModel> = new JsonBuilder<AsyncInstantiationModel>();
13 cy.window().then((win) => {
14 win.sessionStorage.clear();
15 cy.preventErrorsOnLoading();
19 cy.permissionVidMock();
28 it('error should display on api error', function () {
29 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
30 const SERVICE_TYPE: string = "TYLER SILVIA";
31 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
32 const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450';
34 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => {
35 jsonBuilderInstantiationBuilder.basicJson(
37 Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450",
40 "error 500 getServiceInstanceTopology"
43 cy.openIframe(`app/ui/#/servicePlanning/VIEW?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
46 .contains('Server not available');
51 it(`when open service planning in view mode service instance is shown as expected`, function () {
52 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
53 const SERVICE_TYPE: string = "TYLER SILVIA";
54 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
55 const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450';
57 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => {
58 jsonBuilderAndMock.basicJson(
60 Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450",
63 "ecompNamingFalseModel",
67 cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json').then((res) => {
68 jsonBuilderAndMock.basicJson(
70 Cypress.config('baseUrl') + "/aai_get_service_instance_topology/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/f8791436-8d55-4fde-b4d5-72dd2cf13cfb",
72 "initServiceInstanceTopology",
76 cy.openIframe(`app/ui/#/servicePlanning/VIEW?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
77 //cy.visit("welcome.htm"); //relaod page to not break the following tests
80 cy.getElementByDataTestsId('node-2017-388_ADIOD-vPE 1').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'VNF');
81 cy.getElementByDataTestsId('node-2017-488_ADIOD-vPE 0').click({force: true});
82 cy.getElementByDataTestsId('node-2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'M');
85 cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_ADIOD-vPE 0').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'VNF');
86 cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_ADIOD-vPE 0').click({force: true});
87 cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0').eq(0).find(`[data-tests-id='node-type-indicator']`).should('have.text', 'M');
89 //check vnf node tree sub header
90 cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_ADIOD-vPE 0').find("[data-tests-id='status-property-orchStatus']").should('have.text', 'Created');
91 cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_ADIOD-vPE 0').find("[data-tests-id='status-property-provStatus']").should('have.text', '');
92 cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_ADIOD-vPE 0').find("[data-tests-id='status-property-inMaint']").should('not.exist');
94 //check vf Module node tree sub header
95 cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0').find("[data-tests-id='status-property-provStatus']").eq(0).should('have.text', 'Prov Status');
96 cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0').find("[data-tests-id='status-property-orchStatus']").eq(0).should('have.text', 'Active');
97 cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0').find("[data-tests-id='status-property-inMaint']").eq(0).should('have.text', '');
99 cy.getElementByDataTestsId("serviceInstance").should('have.text', 'Service instance:');
100 cy.getElementByDataTestsId("serviceName").should('have.text', 'mCaNkinstancename');
101 cy.getElementByDataTestsId("orchStatusLabel").should('have.text', 'Orch Status:');
102 cy.getElementByDataTestsId("orchStatusValue").should('have.text', 'Active');
103 cy.getElementByDataTestsId("quantityLabel").should('be.visible');
104 cy.getElementByDataTestsId("servicesQuantity").should('have.text', ' 1 ');
109 it(`when open service planning in view mode service instance is shown as expected - e2e with API's ServiceTreeWithMultipleChildren`, function () {
110 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
111 const SERVICE_TYPE: string = "TYLER SILVIA";
112 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
113 const SERVICE_MODEL_ID: string = '6e59c5de-f052-46fa-aa7e-2fca9d674c44';
115 cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/ServiceTreeWithMultipleChildren_serviceModel.json').then((res) => {
116 jsonBuilderAndMock.basicJson(
118 Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d674c44",
121 "ServiceTreeWithMultipleChildren_serviceModel",
125 cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/ServiceTreeWithMultipleChildren_serviceInstance.json').then((res) => {
126 jsonBuilderAndMock.basicJson(
128 Cypress.config('baseUrl') + "/aai_get_service_instance_topology/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/f8791436-8d55-4fde-b4d5-72dd2cf13cfb",
130 "ServiceTreeWithMultipleChildren_serviceInstance",
134 cy.openIframe(`app/ui/#/servicePlanning/VIEW?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`);
137 0. title area -> generic stuff
142 cy.getElementByDataTestsId("serviceInstance").should('have.text', 'Service instance:');
143 cy.getElementByDataTestsId("orchStatusLabel").should('have.text', 'Orch Status:');
144 cy.getElementByDataTestsId("quantityLabel").should('be.visible');
145 cy.getElementByDataTestsId("servicesQuantity").should('have.text', ' 1 ');
148 cy.getElementByDataTestsId("serviceName").should('have.text', 'SERVICE_INSTANCE_NAME');
149 cy.getElementByDataTestsId("orchStatusValue").should('have.text', 'GARBAGE DATA');
150 cy.get('span#service-model-name').should('have.text', 'ComplexService');
152 // test component info of service-level
153 let labelsAndValues = [
154 ['Model Version', '1.0'],
155 ['Instance ID', 'service-instance-id'],
156 ['Service Type', 'service-instance-type'],
158 cy.assertComponentInfoTitleLabelsAndValues('Service Instance INFO', labelsAndValues);
162 cy.get('available-models-tree').find('.toggle-children').click({ multiple: true });
165 1. Left tree -> VNF with 3 vf modules
169 const leftShouldHaves: { [dataTestId: string]: { [dataTestId: string]: string; }; } = {
171 'node-type-indicator': 'VNF',
172 'node-name': 'VF_vMee 0',
175 'node-vf_vmee0..VfVmee..base_vmme..module-0': {
176 'node-type-indicator': 'M',
177 'node-name': 'vf_vmee0..VfVmee..base_vmme..module-0',
180 'node-vf_vmee0..VfVmee..vmme_vlc..module-1': {
181 'node-type-indicator': 'M',
182 'node-name': 'vf_vmee0..VfVmee..vmme_vlc..module-1',
185 'node-vf_vmee0..VfVmee..vmme_gpb..module-2': {
186 'node-type-indicator': 'M',
187 'node-name': 'vf_vmee0..VfVmee..vmme_gpb..module-2',
191 'node-type-indicator': 'N',
192 'node-name': 'ExtVL 0',
195 'node-Port Mirroring Configuration By Policy 0': {
196 'node-type-indicator': 'C',
197 'node-name': 'Port Mirroring Configuration By Policy 0',
202 for (let node in leftShouldHaves) {
203 for (let span in leftShouldHaves[node]) {
204 const expected = leftShouldHaves[node][span];
205 cy.getElementByDataTestsId(node).find(`[data-tests-id='${span}']`).should(expected ? 'have.text' : 'not.exist', expected);
210 2. Right tree -> VNF with 2 vf modules
212 IGNORE, don't check: first node, which have no Service connection
214 const rightShouldHaves: { [dataTestId: string]: { [dataTestId: string]: string; }; } = {
215 'node-d6557200-ecf2-4641-8094-5393ae3aae60-VF_vMee 0:0': {
216 'node-type-indicator': 'VNF',
217 'node-name': 'VNF2_INSTANCE_NAME',
218 'status-property-orchStatus': '',
219 'status-property-provStatus': '',
220 'status-property-inMaint': '',
222 'node-undefined-dc229cd8-c132-4455-8517-5c1787c18b14:0': {
223 'node-type-indicator': 'M',
224 'node-name': 'ss820f_0918_base',
225 'status-property-orchStatus': 'Assigned',
226 'status-property-provStatus': '',
228 'node-522159d5-d6e0-4c2a-aa44-5a542a12a830-vf_vmee0..VfVmee..vmme_vlc..module-1:0': {
229 'node-type-indicator': 'M',
230 'node-name': 'ss820f_0918_db',
231 'status-property-orchStatus': 'deleted',
232 'status-property-provStatus': '',
233 'status-property-inMaint': '',
235 'node-ddc3f20c-08b5-40fd-af72-c6d14636b986-ExtVL 0:0': {
236 'node-type-indicator': 'N',
237 'node-name': 'NETWORK3_INSTANCE_NAME',
238 'status-property-orchStatus': 'Assigned',
239 'status-property-provStatus': 'nvtprov',
241 'node-ddc3f20c-08b5-40fd-af72-c6d14636b986-ExtVL 0:1': {
242 'node-type-indicator': 'N',
243 'node-name': 'NETWORK4_INSTANCE_NAME',
244 'status-property-orchStatus': 'Created',
245 'status-property-provStatus': 'preprov',
249 for (let node in rightShouldHaves) {
250 var [nodeName, nodeEq] = node.split(":");
251 for (let span in rightShouldHaves[node]) {
252 cy.getElementByDataTestsId(nodeName).eq(+nodeEq).find(`[data-tests-id='${span}']`).should('have.text', rightShouldHaves[node][span]);
257 3. Left to right connections ->
258 vnf: # of instances = 1, click -> vnf selected
259 vf module1: # of instances = 1, click -> 1 vfmodule "ss820f_0918_db" selected
260 vf module2: # of instances = 0, click -> nothing
261 vf module3: # of instances = 0, click -> nothing
262 network: # of instances = 2, click -> 2 networks selected
263 configuration: # of instances = 0, click -> nothing
265 const leftShouldHighlight: { [text: string]: string[] } = {
266 'VF_vMee 0': ['VNF2_INSTANCE_NAME'],
267 'vf_vmee0..VfVmee..base_vmme..module-0': [],
268 'vf_vmee0..VfVmee..vmme_vlc..module-1': ['ss820f_0918_db'],
269 'vf_vmee0..VfVmee..vmme_gpb..module-2': [],
270 'ExtVL 0': ['NETWORK3_INSTANCE_NAME', 'NETWORK4_INSTANCE_NAME'],
271 'Port Mirroring Configuration By Policy 0': [],
274 for (let text in leftShouldHighlight) {
275 cy.get('available-models-tree').contains(text).click();
277 cy.get('.node-content-wrapper-active').find(`[data-tests-id='node-name']`).should('have.text', text + leftShouldHighlight[text].join(''));
281 4. Right to left connections ->
282 vnf: click -> vnf selected
283 vf module1: click -> nothing
284 vf module2: click -> vemme0 selected
285 network1: click -> network selected
286 network2: click -> network selected
288 const rightShouldHighlight: { [text: string]: string[] } = {
289 'VNF2_INSTANCE_NAME': ['VF_vMee 0'],
290 'ss820f_0918_base': [],
291 'ss820f_0918_db': ['vf_vmee0..VfVmee..vmme_vlc..module-1'],
292 'NETWORK3_INSTANCE_NAME': ['ExtVL 0'],
293 'NETWORK4_INSTANCE_NAME': ['ExtVL 0'],
296 for (let node in rightShouldHighlight) {
297 cy.get('drawing-board-tree').contains(node).click();
298 cy.get('.node-content-wrapper-active').find(`[data-tests-id='node-name']`).should('have.text', rightShouldHighlight[node].join('') + node);
300 cy.getElementByDataTestsId('isViewOnly-status-test').contains('VIEW ONLY');
304 5. Click outside should remove highlight from all trees.
307 cy.clickOutside('search-left-tree-input', ()=>{
308 cy.get('.node-content-wrapper-active.node-content-wrapper-focused').should('have.length', 2)
310 cy.get('.node-content-wrapper-active.node-content-wrapper-focused').should('have.length', 0);