summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/integration/iFrames/serviceWithNetwork.e2e.ts
blob: 678609c5cfcdbd9f2cb966aa98ac742179d65eed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
///<reference path="../../../node_modules/cypress/types/index.d.ts"/> / <reference types="Cypress" />
import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
import {PnfModel} from '../../support/jsonBuilders/models/pnf.model';
import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
import {AaiServiceInstancesModel} from '../../support/jsonBuilders/models/serviceInstances.model';
import {AAISubDetailsModel} from '../../support/jsonBuilders/models/aaiSubDetails.model';
import {AAISubViewEditModel} from '../../support/jsonBuilders/models/aaiSubViewEdit.model';

describe('View Edit Page', function () {
  describe('test view service with network', () => {
    var jsonBuilderAAIService : JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
    const presetsPrefix : string = '/cypress/support/jsonBuilders/mocks/jsons/';

    var jsonBuilderAAISubViewEditModel: JsonBuilder<AAISubViewEditModel> = new JsonBuilder<AAISubViewEditModel>();
    var jsonBuilderAAISubDetailsModel: JsonBuilder<AAISubDetailsModel> = new JsonBuilder<AAISubDetailsModel>();
    var jsonBuilderPNF: JsonBuilder<PnfModel> = new JsonBuilder<PnfModel>();
    var jsonBuilderAaiServiceInstances: JsonBuilder<AaiServiceInstancesModel> = new JsonBuilder<AaiServiceInstancesModel>();
    var jsonBuilderEmpty: JsonBuilder<Object> = new JsonBuilder<Object>();
    beforeEach(() => {
      cy.readFile(presetsPrefix + 'serviceWithNetwork/serviceWithNetwork.json').then((res) => {
        jsonBuilderAAIService.basicJson(
          res,
          Cypress.config('baseUrl') + "/rest/models/services/5a3ad576-c01d-4bed-8194-0e72b4a3d020",
          200, 0,
          "service-complexService")
      });
      cy.readFile(presetsPrefix + 'serviceWithNetwork/aaiSubViewEditForServiceWithNetwork.json').then((res) => {
        jsonBuilderAAISubViewEditModel.basicJson(
          res,
          Cypress.config('baseUrl') + "/aai_sub_viewedit/**",
          200,
          0,
          "aai-sub-view-edit")
      });
      cy.readFile(presetsPrefix + 'serviceWithNetwork/aaiSubDetailsForServiceWithNetwork.json').then((res) => {
        jsonBuilderAAISubDetailsModel.basicJson(
          res,
          Cypress.config('baseUrl') + "/aai_sub_details/**",
          200,
          0,
          "aai-sub-details")
      });
      cy.readFile(presetsPrefix + 'aaiServiceInstancePnfs.json').then((res) => {
        jsonBuilderPNF.basicJson(
          res,
          Cypress.config('baseUrl') + "/aai_get_service_instance_pnfs/**",
          200,
          0,
          "aai-get-service-instance-pnfs")
      });
      cy.readFile(presetsPrefix + 'serviceWithNetwork/aaiServiceInstances.json').then((res) => {
        jsonBuilderAaiServiceInstances.basicJson(
          res,
          Cypress.config('baseUrl') + "/search_service_instances**",
          200,
          0,
          "aai-get-service-instances")
      });
      cy.readFile(presetsPrefix + 'emptyObjectResponse.json').then((res) => {
        jsonBuilderEmpty.basicJson(
          res,
          Cypress.config('baseUrl') + "/aai_getPortMirroringConfigsData**",
          200,
          0,
          "aai_getPortMirroringConfigsDate - empty response")
      });
      cy.readFile(presetsPrefix + 'emptyObjectResponse.json').then((res) => {
        jsonBuilderEmpty.basicJson(
          res,
          Cypress.config('baseUrl') + "/aai_getPortMirroringSourcePorts**",
          200,
          0,
          "aai_getPortMirroringSourcePorts - empty response")
      });
      cy.readFile('../vid-automation/src/test/resources/serviceWithNetwork/aaiGetNetworksToVlansByServiceInstance.json').then((res) => {
        jsonBuilderAAIService.basicJson(
          res,
          Cypress.config('baseUrl') + '/aai/standardQuery/vlansByNetworks?' +
              'globalCustomerId=a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb' +
              '&serviceType=vMOG' +
              '&serviceInstanceId=9cdd1b2a-43a7-47bc-a88e-759ba2399f0b' +
              '&sdcModelUuid=5a3ad576-c01d-4bed-8194-0e72b4a3d020',
          200,
          0,
          "aai-aaiGetNetworksToVlans-By-Service-Instance")
      });

      cy.initVidMock(); // just for subsequent "initFlags()"
      cy.login();
    });

    afterEach(() => {
      cy.screenshot();
    });

    it(`should allow delete network on view edit`, function () {
      cy.visit('/serviceModels.htm#/instantiate?subscriberId=a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb&subscriberName=Mobility&serviceType=vMOG&serviceInstanceId=9cdd1b2a-43a7-47bc-a88e-759ba2399f0b&aaiModelVersionId=5a3ad576-c01d-4bed-8194-0e72b4a3d020&isPermitted=true');
       cy.wait('@aai_getPortMirroringSourcePorts - empty response');
      cy.getElementByDataTestsId("deleteNetworkButton").should('not.have.attr', 'disabled');
      cy.get(".vlansTreeNode").should('have.length', 2);
    });
  });

});