Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 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"; |
| 6 | |
Einat Vinouze | e1f7974 | 2019-08-27 16:01:01 +0300 | [diff] [blame] | 7 | var jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>(); |
| 8 | var jsonBuilderInstantiationBuilder: JsonBuilder<AsyncInstantiationModel> = new JsonBuilder<AsyncInstantiationModel>(); |
| 9 | const SERVICE_MODEL_ID: string = '6e59c5de-f052-46fa-aa7e-2fca9d674c44'; |
| 10 | const SERVICE_INVARIANT_ID: string = "d27e42cf-087e-4d31-88ac-6c4b7585f800"; |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 11 | |
Einat Vinouze | e1f7974 | 2019-08-27 16:01:01 +0300 | [diff] [blame] | 12 | export const initServicePlanning = function (viewOrEdit: string, customModelFilePath?: string ){ |
| 13 | const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89"; |
| 14 | const SERVICE_TYPE: string = "TYLER SILVIA"; |
| 15 | const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb"; |
| 16 | if (Cypress._.isNil(customModelFilePath)){ |
| 17 | customModelFilePath = '../vid-automation/src/test/resources/aaiGetInstanceTopology/ServiceTreeWithMultipleChildren_serviceInstance.json'; |
| 18 | } |
| 19 | |
| 20 | cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/ServiceTreeWithMultipleChildren_serviceModel.json').then((res) => { |
| 21 | jsonBuilderAndMock.basicJson( |
| 22 | res, |
| 23 | Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d674c44", |
| 24 | 200, |
| 25 | 0, |
| 26 | "ServiceTreeWithMultipleChildren_serviceModel", |
| 27 | ) |
| 28 | }); |
| 29 | |
| 30 | cy.readFile(customModelFilePath).then((res) => { |
| 31 | jsonBuilderAndMock.basicJson( |
| 32 | res, |
| 33 | Cypress.config('baseUrl') + "/aai_get_service_instance_topology/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/f8791436-8d55-4fde-b4d5-72dd2cf13cfb", |
| 34 | 200, 0, |
| 35 | "ServiceTreeWithMultipleChildren_serviceInstance", |
| 36 | ); |
| 37 | }); |
| 38 | cy.openIframe(`app/ui/#/servicePlanning/${viewOrEdit}?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`); |
| 39 | } |
| 40 | |
| 41 | describe('View only drawing board', function () { |
| 42 | const _VIEW = "VIEW"; |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 43 | |
| 44 | beforeEach(() => { |
| 45 | cy.window().then((win) => { |
| 46 | win.sessionStorage.clear(); |
| 47 | cy.preventErrorsOnLoading(); |
| 48 | cy.initAAIMock(); |
Einat Vinouze | e1f7974 | 2019-08-27 16:01:01 +0300 | [diff] [blame] | 49 | cy.initVidMock({serviceUuid:SERVICE_MODEL_ID, invariantId: SERVICE_INVARIANT_ID}); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 50 | cy.initZones(); |
| 51 | cy.permissionVidMock(); |
| 52 | cy.login(); |
| 53 | }); |
| 54 | }); |
| 55 | |
| 56 | afterEach(() => { |
| 57 | cy.screenshot(); |
| 58 | }); |
| 59 | |
| 60 | it('error should display on api error', function () { |
| 61 | const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89"; |
| 62 | const SERVICE_TYPE: string = "TYLER SILVIA"; |
| 63 | const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb"; |
| 64 | const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450'; |
| 65 | |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 66 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 67 | jsonBuilderInstantiationBuilder.basicJson( |
| 68 | res, |
| 69 | Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450", |
| 70 | 500, |
| 71 | 0, |
| 72 | "error 500 getServiceInstanceTopology" |
| 73 | ); |
| 74 | |
| 75 | cy.openIframe(`app/ui/#/servicePlanning/VIEW?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`); |
| 76 | |
| 77 | cy.get('div.title') |
| 78 | .contains('Server not available'); |
| 79 | |
| 80 | }); |
| 81 | }); |
| 82 | |
| 83 | it(`when open service planning in view mode service instance is shown as expected`, function () { |
| 84 | const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89"; |
| 85 | const SERVICE_TYPE: string = "TYLER SILVIA"; |
| 86 | const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb"; |
| 87 | const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450'; |
| 88 | |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 89 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 90 | jsonBuilderAndMock.basicJson( |
| 91 | res, |
| 92 | Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450", |
| 93 | 200, |
| 94 | 0, |
| 95 | "ecompNamingFalseModel", |
| 96 | ) |
| 97 | }); |
| 98 | |
| 99 | cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json').then((res) => { |
| 100 | jsonBuilderAndMock.basicJson( |
| 101 | res, |
| 102 | Cypress.config('baseUrl') + "/aai_get_service_instance_topology/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/f8791436-8d55-4fde-b4d5-72dd2cf13cfb", |
| 103 | 200, 0, |
| 104 | "initServiceInstanceTopology", |
| 105 | ) |
| 106 | }); |
| 107 | |
| 108 | cy.openIframe(`app/ui/#/servicePlanning/VIEW?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`); |
| 109 | //cy.visit("welcome.htm"); //relaod page to not break the following tests |
| 110 | |
| 111 | //testing left side |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 112 | cy.getElementByDataTestsId('node-2017-388_PASQUALE-vPE 1').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'VNF'); |
| 113 | cy.getElementByDataTestsId('node-2017-488_PASQUALE-vPE 0').click({force: true}); |
| 114 | cy.getElementByDataTestsId('node-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'M'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 115 | |
| 116 | //testing right side |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 117 | cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find(`[data-tests-id='node-type-indicator']`).should('have.text', 'VNF'); |
| 118 | cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').click({force: true}); |
| 119 | cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0').eq(0).find(`[data-tests-id='node-type-indicator']`).should('have.text', 'M'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 120 | |
| 121 | //check vnf node tree sub header |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 122 | cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-orchStatus']").should('have.text', 'Created'); |
| 123 | cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-provStatus']").should('have.text', ''); |
| 124 | cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').find("[data-tests-id='status-property-inMaint']").should('not.exist'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 125 | |
| 126 | //check vf Module node tree sub header |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 127 | cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0').find("[data-tests-id='status-property-provStatus']").eq(0).should('have.text', 'Prov Status'); |
| 128 | cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0').find("[data-tests-id='status-property-orchStatus']").eq(0).should('have.text', 'Active'); |
| 129 | cy.getElementByDataTestsId('node-f8360508-3f17-4414-a2ed-6bc71161e8db-2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0').find("[data-tests-id='status-property-inMaint']").eq(0).should('have.text', ''); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 130 | |
| 131 | cy.getElementByDataTestsId("serviceInstance").should('have.text', 'Service instance:'); |
| 132 | cy.getElementByDataTestsId("serviceName").should('have.text', 'mCaNkinstancename'); |
| 133 | cy.getElementByDataTestsId("orchStatusLabel").should('have.text', 'Orch Status:'); |
| 134 | cy.getElementByDataTestsId("orchStatusValue").should('have.text', 'Active'); |
| 135 | cy.getElementByDataTestsId("quantityLabel").should('be.visible'); |
| 136 | cy.getElementByDataTestsId("servicesQuantity").should('have.text', ' 1 '); |
| 137 | |
| 138 | |
| 139 | }); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 140 | |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 141 | it('check component info for 2 trees for vnf, vf-module, and network', function(){ |
Einat Vinouze | e1f7974 | 2019-08-27 16:01:01 +0300 | [diff] [blame] | 142 | initServicePlanning(_VIEW); |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 143 | testComponentInfoForVNF(); |
| 144 | testComponentInfoForVFMODULE(); |
| 145 | testComponentInfoForNetwork(); |
| 146 | }); |
| 147 | |
| 148 | it(`when open service planning in view mode service instance is shown as expected - e2e with API's ServiceTreeWithMultipleChildren`, function () { |
Einat Vinouze | e1f7974 | 2019-08-27 16:01:01 +0300 | [diff] [blame] | 149 | initServicePlanning(_VIEW); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 150 | /* |
| 151 | 0. title area -> generic stuff |
| 152 | instance name |
| 153 | orch status |
| 154 | service name |
| 155 | */ |
| 156 | cy.getElementByDataTestsId("serviceInstance").should('have.text', 'Service instance:'); |
| 157 | cy.getElementByDataTestsId("orchStatusLabel").should('have.text', 'Orch Status:'); |
| 158 | cy.getElementByDataTestsId("quantityLabel").should('be.visible'); |
| 159 | cy.getElementByDataTestsId("servicesQuantity").should('have.text', ' 1 '); |
| 160 | |
| 161 | // specific |
| 162 | cy.getElementByDataTestsId("serviceName").should('have.text', 'SERVICE_INSTANCE_NAME'); |
| 163 | cy.getElementByDataTestsId("orchStatusValue").should('have.text', 'GARBAGE DATA'); |
| 164 | cy.get('span#service-model-name').should('have.text', 'ComplexService'); |
| 165 | |
| 166 | // test component info of service-level |
| 167 | let labelsAndValues = [ |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 168 | ['Model version', '1.0'], |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 169 | ['Instance ID', 'service-instance-id'], |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 170 | ['Service type', 'service-instance-type'], |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 171 | ]; |
| 172 | cy.assertComponentInfoTitleLabelsAndValues('Service Instance INFO', labelsAndValues); |
| 173 | |
| 174 | |
| 175 | // expand all |
| 176 | cy.get('available-models-tree').find('.toggle-children').click({ multiple: true }); |
| 177 | |
| 178 | /* |
| 179 | 1. Left tree -> VNF with 3 vf modules |
| 180 | Network |
| 181 | Configuration |
| 182 | */ |
| 183 | const leftShouldHaves: { [dataTestId: string]: { [dataTestId: string]: string; }; } = { |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 184 | 'node-VF_vGeraldine 0': { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 185 | 'node-type-indicator': 'VNF', |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 186 | 'node-name': 'VF_vGeraldine 0', |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 187 | 'numberButton': '1', |
| 188 | }, |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 189 | 'node-vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0': { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 190 | 'node-type-indicator': 'M', |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 191 | 'node-name': 'vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0', |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 192 | 'numberButton': '', |
| 193 | }, |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 194 | 'node-vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1': { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 195 | 'node-type-indicator': 'M', |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 196 | 'node-name': 'vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1', |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 197 | 'numberButton': '1', |
| 198 | }, |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 199 | 'node-vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2': { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 200 | 'node-type-indicator': 'M', |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 201 | 'node-name': 'vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2', |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 202 | 'numberButton': '', |
| 203 | }, |
| 204 | 'node-ExtVL 0': { |
| 205 | 'node-type-indicator': 'N', |
| 206 | 'node-name': 'ExtVL 0', |
| 207 | 'numberButton': '2', |
| 208 | }, |
| 209 | 'node-Port Mirroring Configuration By Policy 0': { |
| 210 | 'node-type-indicator': 'C', |
| 211 | 'node-name': 'Port Mirroring Configuration By Policy 0', |
| 212 | 'numberButton': '', |
| 213 | }, |
| 214 | }; |
| 215 | |
| 216 | for (let node in leftShouldHaves) { |
| 217 | for (let span in leftShouldHaves[node]) { |
| 218 | const expected = leftShouldHaves[node][span]; |
| 219 | cy.getElementByDataTestsId(node).find(`[data-tests-id='${span}']`).should(expected ? 'have.text' : 'not.exist', expected); |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | /* |
| 224 | 2. Right tree -> VNF with 2 vf modules |
| 225 | 2 networks |
| 226 | IGNORE, don't check: first node, which have no Service connection |
| 227 | */ |
| 228 | const rightShouldHaves: { [dataTestId: string]: { [dataTestId: string]: string; }; } = { |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 229 | 'node-d6557200-ecf2-4641-8094-5393ae3aae60-VF_vGeraldine 0:0': { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 230 | 'node-type-indicator': 'VNF', |
| 231 | 'node-name': 'VNF2_INSTANCE_NAME', |
| 232 | 'status-property-orchStatus': '', |
| 233 | 'status-property-provStatus': '', |
| 234 | 'status-property-inMaint': '', |
| 235 | }, |
| 236 | 'node-undefined-dc229cd8-c132-4455-8517-5c1787c18b14:0': { |
| 237 | 'node-type-indicator': 'M', |
| 238 | 'node-name': 'ss820f_0918_base', |
| 239 | 'status-property-orchStatus': 'Assigned', |
| 240 | 'status-property-provStatus': '', |
| 241 | }, |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 242 | 'node-522159d5-d6e0-4c2a-aa44-5a542a12a830-vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1:0': { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 243 | 'node-type-indicator': 'M', |
| 244 | 'node-name': 'ss820f_0918_db', |
| 245 | 'status-property-orchStatus': 'deleted', |
| 246 | 'status-property-provStatus': '', |
| 247 | 'status-property-inMaint': '', |
| 248 | }, |
| 249 | 'node-ddc3f20c-08b5-40fd-af72-c6d14636b986-ExtVL 0:0': { |
| 250 | 'node-type-indicator': 'N', |
| 251 | 'node-name': 'NETWORK3_INSTANCE_NAME', |
| 252 | 'status-property-orchStatus': 'Assigned', |
| 253 | 'status-property-provStatus': 'nvtprov', |
| 254 | }, |
| 255 | 'node-ddc3f20c-08b5-40fd-af72-c6d14636b986-ExtVL 0:1': { |
| 256 | 'node-type-indicator': 'N', |
| 257 | 'node-name': 'NETWORK4_INSTANCE_NAME', |
| 258 | 'status-property-orchStatus': 'Created', |
| 259 | 'status-property-provStatus': 'preprov', |
| 260 | }, |
| 261 | }; |
| 262 | |
| 263 | for (let node in rightShouldHaves) { |
| 264 | var [nodeName, nodeEq] = node.split(":"); |
| 265 | for (let span in rightShouldHaves[node]) { |
| 266 | cy.getElementByDataTestsId(nodeName).eq(+nodeEq).find(`[data-tests-id='${span}']`).should('have.text', rightShouldHaves[node][span]); |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | /* |
| 271 | 3. Left to right connections -> |
| 272 | vnf: # of instances = 1, click -> vnf selected |
| 273 | vf module1: # of instances = 1, click -> 1 vfmodule "ss820f_0918_db" selected |
| 274 | vf module2: # of instances = 0, click -> nothing |
| 275 | vf module3: # of instances = 0, click -> nothing |
| 276 | network: # of instances = 2, click -> 2 networks selected |
| 277 | configuration: # of instances = 0, click -> nothing |
| 278 | */ |
| 279 | const leftShouldHighlight: { [text: string]: string[] } = { |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 280 | 'VF_vGeraldine 0': ['VNF2_INSTANCE_NAME'], |
| 281 | 'vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0': [], |
| 282 | 'vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1': ['ss820f_0918_db'], |
| 283 | 'vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2': [], |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 284 | 'ExtVL 0': ['NETWORK3_INSTANCE_NAME', 'NETWORK4_INSTANCE_NAME'], |
| 285 | 'Port Mirroring Configuration By Policy 0': [], |
| 286 | }; |
| 287 | |
| 288 | for (let text in leftShouldHighlight) { |
| 289 | cy.get('available-models-tree').contains(text).click(); |
| 290 | |
| 291 | cy.get('.node-content-wrapper-active').find(`[data-tests-id='node-name']`).should('have.text', text + leftShouldHighlight[text].join('')); |
| 292 | } |
| 293 | |
| 294 | /* |
| 295 | 4. Right to left connections -> |
| 296 | vnf: click -> vnf selected |
| 297 | vf module1: click -> nothing |
| 298 | vf module2: click -> vemme0 selected |
| 299 | network1: click -> network selected |
| 300 | network2: click -> network selected |
| 301 | */ |
| 302 | const rightShouldHighlight: { [text: string]: string[] } = { |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 303 | 'VNF2_INSTANCE_NAME': ['VF_vGeraldine 0'], |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 304 | 'ss820f_0918_base': [], |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 305 | 'ss820f_0918_db': ['vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1'], |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 306 | 'NETWORK3_INSTANCE_NAME': ['ExtVL 0'], |
| 307 | 'NETWORK4_INSTANCE_NAME': ['ExtVL 0'], |
| 308 | }; |
| 309 | |
| 310 | for (let node in rightShouldHighlight) { |
| 311 | cy.get('drawing-board-tree').contains(node).click(); |
| 312 | cy.get('.node-content-wrapper-active').find(`[data-tests-id='node-name']`).should('have.text', rightShouldHighlight[node].join('') + node); |
| 313 | } |
| 314 | cy.getElementByDataTestsId('isViewOnly-status-test').contains('VIEW ONLY'); |
| 315 | |
| 316 | |
| 317 | /* |
| 318 | 5. Click outside should remove highlight from all trees. |
| 319 | */ |
| 320 | |
| 321 | cy.clickOutside('search-left-tree-input', ()=>{ |
| 322 | cy.get('.node-content-wrapper-active.node-content-wrapper-focused').should('have.length', 2) |
| 323 | }, ()=>{ |
| 324 | cy.get('.node-content-wrapper-active.node-content-wrapper-focused').should('have.length', 0); |
| 325 | }); |
| 326 | |
| 327 | |
| 328 | }); |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 329 | |
| 330 | function testComponentInfoForVNF(){ |
| 331 | const labelsAndValuesForModel = [ |
| 332 | ['Model version', '2.0'], |
| 333 | ['Model customization ID', '91415b44-753d-494c-926a-456a9172bbb9'], |
| 334 | ['Min instances', '0'], |
| 335 | ['Max instances', '1'] |
| 336 | ]; |
| 337 | const extraLabelsAndValuesForInstance = [['Instance type', 'VNF2_INSTANCE_TYPE'],['In maintenance','true'], ['Instance ID', 'VNF2_INSTANCE_ID']]; |
| 338 | testComponentInfoByType('node-VF_vGeraldine 0', labelsAndValuesForModel,'VNF INFO', |
| 339 | 'VNF2_INSTANCE_NAME', extraLabelsAndValuesForInstance,'VNF Instance INFO'); |
| 340 | |
| 341 | } |
| 342 | |
| 343 | function testComponentInfoForVFMODULE(){ |
| 344 | const labelsAndValuesForModel = [ |
| 345 | ['Model version', '2'], |
| 346 | ['Model customization ID', '55b1be94-671a-403e-a26c-667e9c47d091'], |
| 347 | ['Base module', 'false'], |
| 348 | ['Min instances', '0'], |
| 349 | ['Initial instances count', '0'] |
| 350 | ]; |
| 351 | const extraLabelsAndValuesForInstance = [['In maintenance','true'], ['Instance ID', '2c1ca484-cbc2-408b-ab86-25a2c15ce280']]; |
| 352 | testComponentInfoByType('node-vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1',labelsAndValuesForModel,'VFModule INFO', |
| 353 | 'ss820f_0918_db',extraLabelsAndValuesForInstance,'VFModule Instance INFO') |
| 354 | |
| 355 | } |
| 356 | |
| 357 | function testComponentInfoForNetwork(){ |
| 358 | const labelsAndValuesForModel = [ |
| 359 | ['Model version', '37.0'], |
| 360 | ['Model customization ID', '94fdd893-4a36-4d70-b16a-ec29c54c184f'], |
| 361 | ['Network role','network role 1, network role 2'] |
| 362 | ]; |
| 363 | const extraLabelsAndValuesForInstance = [['In maintenance','false'], ['Instance ID', 'NETWORK3_INSTANCE_ID'],['Instance type', 'CONTRAIL30_BASIC']]; |
| 364 | testComponentInfoByType('node-ExtVL 0',labelsAndValuesForModel,'Network INFO', |
| 365 | 'NETWORK3_INSTANCE_NAME',extraLabelsAndValuesForInstance,'Network Instance INFO'); |
| 366 | |
| 367 | } |
| 368 | |
| 369 | function testComponentInfoByType(leftNode:string, labelsAndValuesForModel: string[][], expectedTitleForModel:string, rightNode:string, extraLabelsAndValuesForInstance: string[][], expectedTitleForInstance:string){ |
| 370 | cy.getElementByDataTestsId(leftNode).eq(0).click({force: true}); |
| 371 | cy.assertComponentInfoTitleLabelsAndValues(expectedTitleForModel, labelsAndValuesForModel); |
| 372 | |
| 373 | let labelsAndValuesForInstance = labelsAndValuesForModel.concat(extraLabelsAndValuesForInstance); |
| 374 | cy.get('drawing-board-tree').contains(rightNode).click(); |
| 375 | cy.assertComponentInfoTitleLabelsAndValues(expectedTitleForInstance, labelsAndValuesForInstance); |
| 376 | } |
| 377 | |
| 378 | |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 379 | }); |