Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 1 | ///<reference path="../../../node_modules/cypress/types/index.d.ts"/> / <reference types="Cypress" /> |
| 2 | import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder'; |
| 3 | import {PnfModel} from '../../support/jsonBuilders/models/pnf.model'; |
| 4 | import {ServiceModel} from '../../support/jsonBuilders/models/service.model'; |
| 5 | import {AaiServiceInstancesModel} from '../../support/jsonBuilders/models/serviceInstances.model'; |
| 6 | import {AAISubDetailsModel} from '../../support/jsonBuilders/models/aaiSubDetails.model'; |
| 7 | import {AAISubViewEditModel} from '../../support/jsonBuilders/models/aaiSubViewEdit.model'; |
| 8 | |
| 9 | describe('Service With VNF network', function () { |
| 10 | describe('basic UI tests', () => { |
| 11 | var jsonBuilderAAIService: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>(); |
| 12 | |
| 13 | |
| 14 | var jsonBuilderAAISubViewEditModel: JsonBuilder<AAISubViewEditModel> = new JsonBuilder<AAISubViewEditModel>(); |
| 15 | var jsonBuilderAAISubDetailsModel: JsonBuilder<AAISubDetailsModel> = new JsonBuilder<AAISubDetailsModel>(); |
| 16 | var jsonBuilderPNF: JsonBuilder<PnfModel> = new JsonBuilder<PnfModel>(); |
| 17 | var jsonBuilderAaiServiceInstances: JsonBuilder<AaiServiceInstancesModel> = new JsonBuilder<AaiServiceInstancesModel>(); |
| 18 | var jsonBuilderEmpty: JsonBuilder<Object> = new JsonBuilder<Object>(); |
| 19 | beforeEach(() => { |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 20 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 21 | jsonBuilderAAIService.basicJson( |
| 22 | res, |
| 23 | Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d674c44", |
| 24 | 200, 0, |
| 25 | "service-complexService", |
| 26 | changeServiceModel) |
| 27 | }); |
| 28 | |
| 29 | |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 30 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForComplexService.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 31 | jsonBuilderAAISubViewEditModel.basicJson( |
| 32 | res, |
| 33 | Cypress.config('baseUrl') + "/aai_sub_viewedit/**/**/**/3f93c7cb-2fd0-4557-9514-e189b7b04f9d", |
| 34 | 200, |
| 35 | 0, |
| 36 | "aai-sub-view-edit") |
| 37 | }); |
| 38 | |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 39 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 40 | jsonBuilderAAISubDetailsModel.basicJson( |
| 41 | res, |
| 42 | Cypress.config('baseUrl') + "/aai_sub_details/**", |
| 43 | 200, |
| 44 | 0, |
| 45 | "aai-sub-details") |
| 46 | }); |
| 47 | |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 48 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiServiceInstances.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 49 | jsonBuilderAaiServiceInstances.basicJson( |
| 50 | res, |
| 51 | Cypress.config('baseUrl') + "/search_service_instances**", |
| 52 | 200, |
| 53 | 0, |
| 54 | "aai-get-service-instances") |
| 55 | }); |
| 56 | |
| 57 | cy.readFile('../vid-automation/src/test/resources/serviceWithNetwork/aaiGetNetworksWithVlansToVnfByServiceInstance.json').then((res) => { |
| 58 | jsonBuilderAAIService.basicJson( |
| 59 | res, |
| 60 | Cypress.config('baseUrl') + '/aai/standardQuery/vlansByNetworks?' + |
| 61 | 'globalCustomerId=e433710f-9217-458d-a79d-1c7aff376d89' + |
| 62 | '&serviceType=TYLER SILVIA' + |
| 63 | '&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d' + |
| 64 | '&sdcModelUuid=6e59c5de-f052-46fa-aa7e-2fca9d674c44', |
| 65 | 200, |
| 66 | 0, |
| 67 | "aai-aaiGetNetworksToVlans-By-Service-Instance") |
| 68 | }); |
| 69 | |
| 70 | cy.initVidMock(); // just for subsequent "initFlags()" |
| 71 | |
| 72 | cy.login(); |
| 73 | }); |
| 74 | |
| 75 | afterEach(() => { |
| 76 | cy.screenshot(); |
| 77 | }); |
| 78 | |
| 79 | it(`Display VNF's network and its vlans hierarchically`, function () { |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 80 | cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 81 | cy.wait('@service-complexService'); |
| 82 | cy.get('div').contains('VNF: fsd') |
| 83 | .get('div').contains('NETWORK: AAAAABBBBCCCC') |
| 84 | .get('div').contains('NETWORK: DDDEEEE') |
| 85 | .get('.vlansTreeNode').should('have.length', 4); |
| 86 | }); |
| 87 | }); |
| 88 | |
| 89 | function changeServiceModel(serviceModel: ServiceModel) { |
| 90 | serviceModel.service.uuid = "6e59c5de-f052-46fa-aa7e-2fca9d674c44"; |
| 91 | return serviceModel; |
| 92 | } |
| 93 | }); |
| 94 | |