summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/integration/iFrames/changeManagement.e2e.ts
blob: a48ed4a9f1ae222287e1c967138b98f0d2307c54 (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
///<reference path="../../../node_modules/cypress/types/index.d.ts"/> / <reference types="Cypress" />

import {JsonBuilder} from "../../support/jsonBuilders/jsonBuilder";
import {AAISubDetailsModel} from "../../support/jsonBuilders/models/aaiSubDetails.model";

describe('Change management AKA VNF changes', function () {
  let jsonBuilderAAISubDetailsModel: JsonBuilder<AAISubDetailsModel> = new JsonBuilder<AAISubDetailsModel>();
  let jsonBuilderVnfData: JsonBuilder<any> = new JsonBuilder<any>();

  let aaiGetVNFDataUrl = Cypress.config('baseUrl') + "/get_vnf_data_by_globalid_and_service_type/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA";
  //describe('Contact us', () => {

  beforeEach(() => {
    cy.login();
    cy.initAAIMock();

    cy.readFile('cypress/support/jsonBuilders/mocks/jsons/defect710619/aaiSubDetailsE2E.json').then((res) => {
      jsonBuilderAAISubDetailsModel.basicJson(
        res,
        Cypress.config('baseUrl') + "/aai_sub_details/e433710f-9217-458d-a79d-1c7aff376d89**",
        200,
        0,
        "aai-sub-details")
    });

    cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.json').then(() => {
      cy.server()
        .route({
          method: 'GET',
          delay: 0,
          status: 200,
          url: Cypress.config('baseUrl') + "/flags**",
          response: {
            "FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG": true,
            "FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH": true,
            "FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST": true
          }
        }).as('initFlags');
    });

    cy.readFile('cypress/support/jsonBuilders/mocks/jsons/get_vnf_data.json').then((res) => {
      jsonBuilderVnfData.basicJson(
        res,
        aaiGetVNFDataUrl + '**',
        200,
        0,
        "aai_get_vnf_data")
    });

    openNewVnfChangeModal();

  });

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

  function openNewVnfChangeModal() {
    cy.visit('/serviceModels.htm#/change-management');
    cy.getElementByDataTestsId('create-new-change-management').click();
    cy.getElementByDataTestsId('newChangeManagementForm');
  }

  function fillSubscriberAndServiceType() {
    cy.selectDropdownOptionByText('subscriberName', 'SILVIA ROBBINS');
    cy.selectDropdownOptionByText('serviceType', 'TYLER SILVIA');
  }

  function fillCloudRegion() {
    cy.selectDropdownOptionByText('cloudRegion', 'AAIAIC25 (AIC)');
  }

  function fillNfRole() {
    cy.getElementByDataTestsId('vnfType').type('vMobileDNS');
  }

  it(`nf role input and cloud region input and search vnfs button should be disabled  without subscriber and serviceType`, function () {
    cy.get('#searchVNF').should('be.disabled');
    cy.getElementByDataTestsId('cloudRegion').should('be.disabled');
    cy.getElementByDataTestsId('vnfType').should('be.disabled')
  });

  it(`search vnfs without nf role and cloud region`, function () {

    fillSubscriberAndServiceType();

    cy.get('#searchVNF').click();

    cy.wait('@aai_get_vnf_data')
      .its('url').should('equal', aaiGetVNFDataUrl)
  });


  it(`search vnfs by nf role and cloud region`, function () {

    fillSubscriberAndServiceType();
    fillNfRole();
    fillCloudRegion();

    cy.get('#searchVNF').click();

    cy.wait('@aai_get_vnf_data')
      .its('url').should('equal', aaiGetVNFDataUrl + "?cloudRegion=AAIAIC25&nfRole=vMobileDNS")
  });


  it(`search vnfs by cloud region`, function () {

    fillSubscriberAndServiceType();
    fillCloudRegion();
    cy.get('#searchVNF').click();

    cy.wait('@aai_get_vnf_data')
      .its('url').should('equal', aaiGetVNFDataUrl + "?cloudRegion=AAIAIC25")
  });

  it(`search vnfs by nf role`, function () {

    fillSubscriberAndServiceType();
    fillNfRole();
    cy.get('#searchVNF').click();

    cy.wait('@aai_get_vnf_data')
      .its('url').should('equal', aaiGetVNFDataUrl + "?nfRole=vMobileDNS")
  });
});