blob: a48ed4a9f1ae222287e1c967138b98f0d2307c54 [file] [log] [blame]
Einat Vinouze91d3f652019-09-03 14:52:13 +03001///<reference path="../../../node_modules/cypress/types/index.d.ts"/> / <reference types="Cypress" />
2
3import {JsonBuilder} from "../../support/jsonBuilders/jsonBuilder";
4import {AAISubDetailsModel} from "../../support/jsonBuilders/models/aaiSubDetails.model";
5
6describe('Change management AKA VNF changes', function () {
Sara Weisse21e9192019-10-23 11:29:33 +03007 let jsonBuilderAAISubDetailsModel: JsonBuilder<AAISubDetailsModel> = new JsonBuilder<AAISubDetailsModel>();
8 let jsonBuilderVnfData: JsonBuilder<any> = new JsonBuilder<any>();
Einat Vinouze91d3f652019-09-03 14:52:13 +03009
Sara Weisse21e9192019-10-23 11:29:33 +030010 let aaiGetVNFDataUrl = Cypress.config('baseUrl') + "/get_vnf_data_by_globalid_and_service_type/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA";
Einat Vinouze91d3f652019-09-03 14:52:13 +030011 //describe('Contact us', () => {
12
13 beforeEach(() => {
14 cy.login();
15 cy.initAAIMock();
16
Ittay Stern607ea3d2019-10-23 17:10:52 +030017 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/defect710619/aaiSubDetailsE2E.json').then((res) => {
Einat Vinouze91d3f652019-09-03 14:52:13 +030018 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
Ittay Sternb0a53652019-10-24 14:05:12 +030026 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.json').then(() => {
Sara Weisse21e9192019-10-23 11:29:33 +030027 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
Ittay Sternb0a53652019-10-24 14:05:12 +030041 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/get_vnf_data.json').then((res) => {
Sara Weisse21e9192019-10-23 11:29:33 +030042 jsonBuilderVnfData.basicJson(
43 res,
44 aaiGetVNFDataUrl + '**',
45 200,
46 0,
47 "aai_get_vnf_data")
48 });
49
50 openNewVnfChangeModal();
51
Einat Vinouze91d3f652019-09-03 14:52:13 +030052 });
53
54 afterEach(() => {
55 cy.screenshot();
56 });
57
Sara Weisse21e9192019-10-23 11:29:33 +030058 function openNewVnfChangeModal() {
Einat Vinouze91d3f652019-09-03 14:52:13 +030059 cy.visit('/serviceModels.htm#/change-management');
60 cy.getElementByDataTestsId('create-new-change-management').click();
61 cy.getElementByDataTestsId('newChangeManagementForm');
Sara Weisse21e9192019-10-23 11:29:33 +030062 }
63
64 function fillSubscriberAndServiceType() {
Einat Vinouze91d3f652019-09-03 14:52:13 +030065 cy.selectDropdownOptionByText('subscriberName', 'SILVIA ROBBINS');
66 cy.selectDropdownOptionByText('serviceType', 'TYLER SILVIA');
Sara Weisse21e9192019-10-23 11:29:33 +030067 }
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")
Einat Vinouze91d3f652019-09-03 14:52:13 +0300125 });
126});