Einat Vinouze | 91d3f65 | 2019-09-03 14:52:13 +0300 | [diff] [blame] | 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 () { |
Sara Weiss | e21e919 | 2019-10-23 11:29:33 +0300 | [diff] [blame] | 7 | let jsonBuilderAAISubDetailsModel: JsonBuilder<AAISubDetailsModel> = new JsonBuilder<AAISubDetailsModel>(); |
| 8 | let jsonBuilderVnfData: JsonBuilder<any> = new JsonBuilder<any>(); |
Einat Vinouze | 91d3f65 | 2019-09-03 14:52:13 +0300 | [diff] [blame] | 9 | |
Sara Weiss | e21e919 | 2019-10-23 11:29:33 +0300 | [diff] [blame] | 10 | let aaiGetVNFDataUrl = Cypress.config('baseUrl') + "/get_vnf_data_by_globalid_and_service_type/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA"; |
Einat Vinouze | 91d3f65 | 2019-09-03 14:52:13 +0300 | [diff] [blame] | 11 | //describe('Contact us', () => { |
| 12 | |
| 13 | beforeEach(() => { |
| 14 | cy.login(); |
| 15 | cy.initAAIMock(); |
| 16 | |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 17 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/defect710619/aaiSubDetailsE2E.json').then((res) => { |
Einat Vinouze | 91d3f65 | 2019-09-03 14:52:13 +0300 | [diff] [blame] | 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 | |
Ittay Stern | b0a5365 | 2019-10-24 14:05:12 +0300 | [diff] [blame] | 26 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.json').then(() => { |
Sara Weiss | e21e919 | 2019-10-23 11:29:33 +0300 | [diff] [blame] | 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 | |
Ittay Stern | b0a5365 | 2019-10-24 14:05:12 +0300 | [diff] [blame] | 41 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/get_vnf_data.json').then((res) => { |
Sara Weiss | e21e919 | 2019-10-23 11:29:33 +0300 | [diff] [blame] | 42 | jsonBuilderVnfData.basicJson( |
| 43 | res, |
| 44 | aaiGetVNFDataUrl + '**', |
| 45 | 200, |
| 46 | 0, |
| 47 | "aai_get_vnf_data") |
| 48 | }); |
| 49 | |
| 50 | openNewVnfChangeModal(); |
| 51 | |
Einat Vinouze | 91d3f65 | 2019-09-03 14:52:13 +0300 | [diff] [blame] | 52 | }); |
| 53 | |
| 54 | afterEach(() => { |
| 55 | cy.screenshot(); |
| 56 | }); |
| 57 | |
Sara Weiss | e21e919 | 2019-10-23 11:29:33 +0300 | [diff] [blame] | 58 | function openNewVnfChangeModal() { |
Einat Vinouze | 91d3f65 | 2019-09-03 14:52:13 +0300 | [diff] [blame] | 59 | cy.visit('/serviceModels.htm#/change-management'); |
| 60 | cy.getElementByDataTestsId('create-new-change-management').click(); |
| 61 | cy.getElementByDataTestsId('newChangeManagementForm'); |
Sara Weiss | e21e919 | 2019-10-23 11:29:33 +0300 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | function fillSubscriberAndServiceType() { |
Einat Vinouze | 91d3f65 | 2019-09-03 14:52:13 +0300 | [diff] [blame] | 65 | cy.selectDropdownOptionByText('subscriberName', 'SILVIA ROBBINS'); |
| 66 | cy.selectDropdownOptionByText('serviceType', 'TYLER SILVIA'); |
Sara Weiss | e21e919 | 2019-10-23 11:29:33 +0300 | [diff] [blame] | 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") |
Einat Vinouze | 91d3f65 | 2019-09-03 14:52:13 +0300 | [diff] [blame] | 125 | }); |
| 126 | }); |