blob: 19a3be93b96c097f7dfcfbbc869878b93d1c7d19 [file] [log] [blame]
Ittay Stern6f900cc2018-08-29 17:01:32 +03001///<reference path="../../../node_modules/cypress/types/index.d.ts"/> / <reference types="Cypress" />
2import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
3import {PnfModel} from '../../support/jsonBuilders/models/pnf.model';
4import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
5import {AaiServiceInstancesModel} from '../../support/jsonBuilders/models/serviceInstances.model';
6import {AAISubDetailsModel} from '../../support/jsonBuilders/models/aaiSubDetails.model';
7import {AAISubViewEditModel} from '../../support/jsonBuilders/models/aaiSubViewEdit.model';
8
9describe('View Edit Page', function () {
10 describe('test view service with network', () => {
11 var jsonBuilderAAIService : JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
Ittay Stern607ea3d2019-10-23 17:10:52 +030012 const presetsPrefix : string = 'cypress/support/jsonBuilders/mocks/jsons/';
Ittay Stern6f900cc2018-08-29 17:01:32 +030013
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(() => {
20 cy.readFile(presetsPrefix + 'serviceWithNetwork/serviceWithNetwork.json').then((res) => {
21 jsonBuilderAAIService.basicJson(
22 res,
23 Cypress.config('baseUrl') + "/rest/models/services/5a3ad576-c01d-4bed-8194-0e72b4a3d020",
24 200, 0,
25 "service-complexService")
26 });
27 cy.readFile(presetsPrefix + 'serviceWithNetwork/aaiSubViewEditForServiceWithNetwork.json').then((res) => {
28 jsonBuilderAAISubViewEditModel.basicJson(
29 res,
30 Cypress.config('baseUrl') + "/aai_sub_viewedit/**",
31 200,
32 0,
33 "aai-sub-view-edit")
34 });
35 cy.readFile(presetsPrefix + 'serviceWithNetwork/aaiSubDetailsForServiceWithNetwork.json').then((res) => {
36 jsonBuilderAAISubDetailsModel.basicJson(
37 res,
38 Cypress.config('baseUrl') + "/aai_sub_details/**",
39 200,
40 0,
41 "aai-sub-details")
42 });
43 cy.readFile(presetsPrefix + 'aaiServiceInstancePnfs.json').then((res) => {
44 jsonBuilderPNF.basicJson(
45 res,
46 Cypress.config('baseUrl') + "/aai_get_service_instance_pnfs/**",
47 200,
48 0,
49 "aai-get-service-instance-pnfs")
50 });
51 cy.readFile(presetsPrefix + 'serviceWithNetwork/aaiServiceInstances.json').then((res) => {
52 jsonBuilderAaiServiceInstances.basicJson(
53 res,
54 Cypress.config('baseUrl') + "/search_service_instances**",
55 200,
56 0,
57 "aai-get-service-instances")
58 });
59 cy.readFile(presetsPrefix + 'emptyObjectResponse.json').then((res) => {
60 jsonBuilderEmpty.basicJson(
61 res,
62 Cypress.config('baseUrl') + "/aai_getPortMirroringConfigsData**",
63 200,
64 0,
65 "aai_getPortMirroringConfigsDate - empty response")
66 });
67 cy.readFile(presetsPrefix + 'emptyObjectResponse.json').then((res) => {
68 jsonBuilderEmpty.basicJson(
69 res,
70 Cypress.config('baseUrl') + "/aai_getPortMirroringSourcePorts**",
71 200,
72 0,
73 "aai_getPortMirroringSourcePorts - empty response")
74 });
75 cy.readFile('../vid-automation/src/test/resources/serviceWithNetwork/aaiGetNetworksToVlansByServiceInstance.json').then((res) => {
76 jsonBuilderAAIService.basicJson(
77 res,
78 Cypress.config('baseUrl') + '/aai/standardQuery/vlansByNetworks?' +
79 'globalCustomerId=a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb' +
80 '&serviceType=vMOG' +
81 '&serviceInstanceId=9cdd1b2a-43a7-47bc-a88e-759ba2399f0b' +
82 '&sdcModelUuid=5a3ad576-c01d-4bed-8194-0e72b4a3d020',
83 200,
84 0,
85 "aai-aaiGetNetworksToVlans-By-Service-Instance")
86 });
87
88 cy.initVidMock(); // just for subsequent "initFlags()"
89 cy.login();
90 });
91
92 afterEach(() => {
93 cy.screenshot();
94 });
95
96 it(`should allow delete network on view edit`, function () {
Ittay Sternf7926712019-07-07 19:23:03 +030097 cy.visit('/serviceModels.htm#/instantiate?subscriberId=a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb&subscriberName=Emanuel&serviceType=vMOG&serviceInstanceId=9cdd1b2a-43a7-47bc-a88e-759ba2399f0b&aaiModelVersionId=5a3ad576-c01d-4bed-8194-0e72b4a3d020&isPermitted=true');
Ittay Stern6f900cc2018-08-29 17:01:32 +030098 cy.wait('@aai_getPortMirroringSourcePorts - empty response');
99 cy.getElementByDataTestsId("deleteNetworkButton").should('not.have.attr', 'disabled');
100 cy.get(".vlansTreeNode").should('have.length', 2);
101 });
102 });
103
104});
105