Replace vfmodule: opens an popup
[vid.git] / vid-webpack-master / cypress / integration / iFrames / changeManagement.e2e.ts
1 ///<reference path="../../../node_modules/cypress/types/index.d.ts"/> / <reference types="Cypress" />
2
3 import {JsonBuilder} from "../../support/jsonBuilders/jsonBuilder";
4 import {AAISubDetailsModel} from "../../support/jsonBuilders/models/aaiSubDetails.model";
5
6 describe('Change management AKA VNF changes', function () {
7   let jsonBuilderAAISubDetailsModel: JsonBuilder<AAISubDetailsModel> = new JsonBuilder<AAISubDetailsModel>();
8   let jsonBuilderVnfData: JsonBuilder<any> = new JsonBuilder<any>();
9
10   let aaiGetVNFDataUrl = Cypress.config('baseUrl') + "/get_vnf_data_by_globalid_and_service_type/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA";
11   //describe('Contact us', () => {
12
13   beforeEach(() => {
14     cy.login();
15     cy.initAAIMock();
16
17     cy.readFile('cypress/support/jsonBuilders/mocks/jsons/defect710619/aaiSubDetailsE2E.json').then((res) => {
18       jsonBuilderAAISubDetailsModel.basicJson(
19         res,
20         Cypress.config('baseUrl') + "/aai_sub_details/e433710f-9217-458d-a79d-1c7aff376d89**",
21         200,
22         0,
23         "aai-sub-details")
24     });
25
26     cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json').then(() => {
27       cy.server()
28         .route({
29           method: 'GET',
30           delay: 0,
31           status: 200,
32           url: Cypress.config('baseUrl') + "/flags**",
33           response: {
34             "FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG": true,
35             "FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH": true,
36             "FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST": true
37           }
38         }).as('initFlags');
39     });
40
41     cy.readFile('cypress/support/jsonBuilders/mocks/jsons/get_vnf_data.json').then((res) => {
42       jsonBuilderVnfData.basicJson(
43         res,
44         aaiGetVNFDataUrl + '**',
45         200,
46         0,
47         "aai_get_vnf_data")
48     });
49
50     openNewVnfChangeModal();
51
52   });
53
54   afterEach(() => {
55     cy.screenshot();
56   });
57
58   function openNewVnfChangeModal() {
59     cy.visit('/serviceModels.htm#/change-management');
60     cy.getElementByDataTestsId('create-new-change-management').click();
61     cy.getElementByDataTestsId('newChangeManagementForm');
62   }
63
64   function fillSubscriberAndServiceType() {
65     cy.selectDropdownOptionByText('subscriberName', 'SILVIA ROBBINS');
66     cy.selectDropdownOptionByText('serviceType', 'TYLER SILVIA');
67   }
68
69   function fillCloudRegion() {
70     cy.selectDropdownOptionByText('cloudRegion', 'AAIAIC25 (AIC)');
71   }
72
73   function fillNfRole() {
74     cy.getElementByDataTestsId('vnfType').type('vMobileDNS');
75   }
76
77   it(`nf role input and cloud region input and search vnfs button should be disabled  without subscriber and serviceType`, function () {
78     cy.get('#searchVNF').should('be.disabled');
79     cy.getElementByDataTestsId('cloudRegion').should('be.disabled');
80     cy.getElementByDataTestsId('vnfType').should('be.disabled')
81   });
82
83   it(`search vnfs without nf role and cloud region`, function () {
84
85     fillSubscriberAndServiceType();
86
87     cy.get('#searchVNF').click();
88
89     cy.wait('@aai_get_vnf_data')
90       .its('url').should('equal', aaiGetVNFDataUrl)
91   });
92
93
94   it(`search vnfs by nf role and cloud region`, function () {
95
96     fillSubscriberAndServiceType();
97     fillNfRole();
98     fillCloudRegion();
99
100     cy.get('#searchVNF').click();
101
102     cy.wait('@aai_get_vnf_data')
103       .its('url').should('equal', aaiGetVNFDataUrl + "?cloudRegion=AAIAIC25&nfRole=vMobileDNS")
104   });
105
106
107   it(`search vnfs by cloud region`, function () {
108
109     fillSubscriberAndServiceType();
110     fillCloudRegion();
111     cy.get('#searchVNF').click();
112
113     cy.wait('@aai_get_vnf_data')
114       .its('url').should('equal', aaiGetVNFDataUrl + "?cloudRegion=AAIAIC25")
115   });
116
117   it(`search vnfs by nf role`, function () {
118
119     fillSubscriberAndServiceType();
120     fillNfRole();
121     cy.get('#searchVNF').click();
122
123     cy.wait('@aai_get_vnf_data')
124       .its('url').should('equal', aaiGetVNFDataUrl + "?nfRole=vMobileDNS")
125   });
126 });