Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 1 | ///<reference path="../../../node_modules/cypress/types/index.d.ts"/> |
| 2 | import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder'; |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 3 | import {ServiceModel} from '../../support/jsonBuilders/models/service.model'; |
| 4 | import {AaiServiceInstancesModel} from '../../support/jsonBuilders/models/serviceInstances.model'; |
| 5 | import {AAISubDetailsModel} from '../../support/jsonBuilders/models/aaiSubDetails.model'; |
| 6 | import {AAISubViewEditModel} from '../../support/jsonBuilders/models/aaiSubViewEdit.model'; |
| 7 | |
| 8 | describe('Soft delete tests', function () { |
| 9 | describe('basic UI tests', () => { |
| 10 | |
| 11 | var jsonBuilderAAIService: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>(); |
| 12 | var jsonBuilderAAISubViewEditModel: JsonBuilder<AAISubViewEditModel> = new JsonBuilder<AAISubViewEditModel>(); |
| 13 | var jsonBuilderAAISubDetailsModel: JsonBuilder<AAISubDetailsModel> = new JsonBuilder<AAISubDetailsModel>(); |
| 14 | var jsonBuilderAaiServiceInstances: JsonBuilder<AaiServiceInstancesModel> = new JsonBuilder<AaiServiceInstancesModel>(); |
| 15 | beforeEach(() => { |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 16 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 17 | jsonBuilderAAIService.basicJson( |
| 18 | res, |
| 19 | Cypress.config('baseUrl') + "/rest/models/services/6e59c5de-f052-46fa-aa7e-2fca9d674c44", |
| 20 | 200, 0, |
| 21 | "service-complexService", |
| 22 | changeServiceModel) |
| 23 | }); |
| 24 | |
| 25 | |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 26 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubViewEditForServiceWithSomeVFModule.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 27 | jsonBuilderAAISubViewEditModel.basicJson( |
| 28 | res, |
| 29 | Cypress.config('baseUrl') + "/aai_sub_viewedit/**/**/**/3f93c7cb-2fd0-4557-9514-e189b7b04f9d", |
| 30 | 200, |
| 31 | 0, |
| 32 | "aai-sub-view-edit") |
| 33 | }); |
| 34 | |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 35 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 36 | jsonBuilderAAISubDetailsModel.basicJson( |
| 37 | res, |
| 38 | Cypress.config('baseUrl') + "/aai_sub_details/**", |
| 39 | 200, |
| 40 | 0, |
| 41 | "aai-sub-details") |
| 42 | }); |
| 43 | |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 44 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiServiceInstances.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 45 | jsonBuilderAaiServiceInstances.basicJson( |
| 46 | res, |
| 47 | Cypress.config('baseUrl') + "/search_service_instances**", |
| 48 | 200, |
| 49 | 0, |
| 50 | "aai-get-service-instances") |
| 51 | }); |
| 52 | |
| 53 | cy.initVidMock(); |
| 54 | |
| 55 | cy.initTenants(); |
| 56 | |
| 57 | cy.login(); |
| 58 | }); |
| 59 | |
| 60 | afterEach(() => { |
| 61 | cy.screenshot(); |
| 62 | }); |
| 63 | |
| 64 | it(`Soft delete button will be display also if base module is true`, function () { |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 65 | cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 66 | cy.wait('@service-complexService'); |
| 67 | checkSoftDeleteAndDeletePopup('aa', 'vfModuleTreeNode-pendingactivation', true, true); |
| 68 | }); |
| 69 | |
| 70 | it(`Soft delete button not display in assigned orch status`, function () { |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 71 | cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 72 | cy.wait('@service-complexService'); |
| 73 | checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true); |
| 74 | }); |
| 75 | |
| 76 | it(`Resume button display in orch status - pendingactivation, assigned - feature FLAG_VF_MODULE_RESUME_STATUS_CREATE - is OFF`, function () { |
| 77 | |
Sara Weiss | eed6943 | 2019-11-20 14:50:33 +0200 | [diff] [blame] | 78 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json').then(() => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 79 | cy.server() |
| 80 | .route({ |
| 81 | method: 'GET', |
| 82 | delay : 0, |
| 83 | status : 200, |
| 84 | url : Cypress.config('baseUrl') + "/flags**", |
| 85 | response : { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 86 | "FLAG_VF_MODULE_RESUME_STATUS_CREATE": false |
| 87 | } |
| 88 | }).as('initFlags'); |
| 89 | }); |
| 90 | |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 91 | cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 92 | cy.wait('@service-complexService'); |
| 93 | |
| 94 | checkResumeAndPopup('aa', 'vfModuleTreeNode-pendingactivation'); |
| 95 | checkResumeAndPopup('gg', 'vfModuleTreeNode-assigned'); |
| 96 | |
| 97 | cy.get('.vfModuleTreeNode-created') |
| 98 | .getElementByDataTestsId('resumeVFModuleButton-ABC').should('not.be.visible'); |
| 99 | cy.get('.vfModuleTreeNode-pending-delete') |
| 100 | .getElementByDataTestsId('resumeVFModuleButton-my_vfModule').should('not.be.visible'); |
| 101 | |
| 102 | }); |
| 103 | |
| 104 | it(`Resume button display in orch status - pendingactivation, assigned, created - feature FLAG_VF_MODULE_RESUME_STATUS_CREATE - is ON`, function () { |
| 105 | |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 106 | cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 107 | cy.wait('@service-complexService'); |
| 108 | |
| 109 | checkResumeAndPopup('aa', 'vfModuleTreeNode-pendingactivation'); |
| 110 | checkResumeAndPopup('gg', 'vfModuleTreeNode-assigned'); |
| 111 | checkResumeAndPopup('ABC', 'vfModuleTreeNode-created'); |
| 112 | |
| 113 | cy.get('.vfModuleTreeNode-pending-delete') |
| 114 | .getElementByDataTestsId('resumeVFModuleButton-my_vfModule').should('not.be.visible'); |
| 115 | |
| 116 | }); |
| 117 | |
| 118 | it(`Delete popup with not homing data from AAI`, function () { |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 119 | cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 120 | cy.wait('@service-complexService'); |
| 121 | checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true); |
Alexey Sandler | 453a7bd | 2019-08-22 15:16:48 +0300 | [diff] [blame] | 122 | cy.selectDropdownOptionByText('lcpRegion', 'AAIAIC25 (AIC)'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 123 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled'); |
| 124 | cy.typeToInput("lcpRegionText", "just another region"); |
| 125 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled'); |
| 126 | cy.selectDropdownOptionByText('tenant', 'USP-SIP-IC-24335-T-01'); |
| 127 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.have.attr', 'disabled'); |
Alexey Sandler | 453a7bd | 2019-08-22 15:16:48 +0300 | [diff] [blame] | 128 | cy.selectDropdownOptionByText('lcpRegion', 'hvf6 (AIC)'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 129 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled'); |
| 130 | cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testalexandria'); |
| 131 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.have.attr', 'disabled'); |
Alexey Sandler | 453a7bd | 2019-08-22 15:16:48 +0300 | [diff] [blame] | 132 | cy.getElementByDataTestsId('cancel').click({force: true}); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 133 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.be.visible'); |
| 134 | }); |
| 135 | |
| 136 | it(`Soft delete button display with partial homing data from AAI`, function () { |
| 137 | |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 138 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiGetHomingData.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 139 | jsonBuilderAaiServiceInstances.basicJson( |
| 140 | res, |
| 141 | Cypress.config('baseUrl') + "/aai_get_homing_by_vfmodule/c015cc0f-0f37-4488-aabf-53795fd93cd3/a231a99c-7e75-4d6d-a0fb-5c7d26f30f77", |
| 142 | 200, |
| 143 | 0, |
| 144 | "aai-get-homing-data") |
| 145 | }); |
| 146 | |
| 147 | |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 148 | cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 149 | cy.wait('@service-complexService'); |
| 150 | checkSoftDeleteAndDeletePopup('my_vfModule', 'vfModuleTreeNode-pending-delete', true, true); |
| 151 | cy.getElementByDataTestsId('lcpRegionText').should('be.visible'); |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 152 | cy.getElementByDataTestsId('lcpRegion').contains('AAIAIC25'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 153 | cy.getElementByDataTestsId('tenant').contains('USP-SIP-IC-24335-T-01'); |
| 154 | }); |
| 155 | |
| 156 | it(`Soft delete button display with with homing data from AAI`, function () { |
| 157 | |
| 158 | cy.readFile('../vid-automation/src/test/resources/viewEdit/aaiHomingDataResponse.json').then((res) => { |
| 159 | jsonBuilderAaiServiceInstances.basicJson( |
| 160 | res, |
| 161 | Cypress.config('baseUrl') + "/aai_get_homing_by_vfmodule/0846287b-65bf-45a6-88f6-6a1af4149fac/a9b70ac0-5917-4203-a308-0e6920e6d09b", |
| 162 | 200, |
| 163 | 0, |
| 164 | "aai-get-homing-data") |
| 165 | }); |
| 166 | |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 167 | cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 168 | cy.wait('@service-complexService'); |
| 169 | checkSoftDeleteAndDeletePopup('vf_module2', 'vfModuleTreeNode-pendingcreate', true, false); |
| 170 | }); |
| 171 | |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 172 | it(`Soft delete and Delete - Mega region is AAIAIC25 - not 'olson3', 'olson5a'`, function () { |
| 173 | cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA%20ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=3f93c7cb-2fd0-4557-9514-e189b7b04f9d&aaiModelVersionId=6e59c5de-f052-46fa-aa7e-2fca9d674c44&isPermitted=true'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 174 | cy.wait('@service-complexService'); |
| 175 | //Delete |
| 176 | checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true); |
| 177 | checkLegacyRegion(); |
| 178 | cy.getElementByDataTestsId('cancel').click(); |
| 179 | //Soft delete |
| 180 | checkSoftDeleteAndDeletePopup('aa', 'vfModuleTreeNode-pendingactivation', true, true); |
| 181 | checkLegacyRegion(); |
| 182 | cy.getElementByDataTestsId('cancel').click(); |
| 183 | //Resume |
| 184 | cy.get('div').find('.vfModuleTreeNode-pendingactivation') |
| 185 | .getElementByDataTestsId('resumeVFModuleButton-aa').click().then(()=> { |
| 186 | checkLegacyRegion(); |
| 187 | }); |
| 188 | }); |
| 189 | |
| 190 | function checkLegacyRegion() { |
Alexey Sandler | 453a7bd | 2019-08-22 15:16:48 +0300 | [diff] [blame] | 191 | checkIsLegacyRegionTextIsDisplay('AAIAIC25 (AIC)', true); |
| 192 | checkIsLegacyRegionTextIsDisplay('olson3 (AIC)', false); |
| 193 | checkIsLegacyRegionTextIsDisplay('olson5a (AIC)', false); |
| 194 | checkIsLegacyRegionTextIsDisplay('hvf6 (AIC)', false); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 195 | } |
| 196 | |
| 197 | function checkIsLegacyRegionTextIsDisplay(lcpRegionName: string, isVisible: boolean) { |
| 198 | const isVisibleText = isVisible ? 'be.visible' : 'not.be.visible'; |
| 199 | cy.selectDropdownOptionByText('lcpRegion', lcpRegionName); |
| 200 | cy.getElementByDataTestsId('lcpRegionText').should(isVisibleText); |
| 201 | |
| 202 | } |
| 203 | |
| 204 | function checkResumeAndPopup(vfModuleName:string, vfModuleClassName:string) { |
| 205 | cy.get('div').find('.' + vfModuleClassName) |
| 206 | .getElementByDataTestsId('resumeVFModuleButton-' + vfModuleName).click().then(()=> { |
| 207 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('be.visible') |
| 208 | .getElementByDataTestsId('softDeleteButton').should('not.be.visible') |
| 209 | .getElementByDataTestsId('lcpRegion').should('be.visible') |
| 210 | .getElementByDataTestsId('tenant').should('be.visible') |
| 211 | .getElementByDataTestsId('modalTitle').contains('Instantiate') |
| 212 | .getElementByDataTestsId('confirmResumeDeleteButton').contains('Instantiate') |
| 213 | .getElementByDataTestsId('cancel').click(); |
| 214 | }); |
| 215 | } |
| 216 | |
| 217 | function checkSoftDeleteAndDeletePopup(vfModuleName:string, vfModuleClassName:string, softDeleteEnable:boolean, isNoHomingData:boolean) { |
| 218 | const visibleString = 'be.visible'; |
| 219 | const NOT = 'not.'; |
| 220 | const softDeleteVisibleString = (softDeleteEnable) ? visibleString : NOT + visibleString; |
| 221 | const isNoHomingDataVisibleString = (isNoHomingData) ? visibleString : NOT + visibleString; |
| 222 | cy.get('div').find('.' + vfModuleClassName) |
| 223 | .getElementByDataTestsId('deleteVFModuleButton-' + vfModuleName).click({force: true}).then(()=> { |
| 224 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('be.visible') |
| 225 | .getElementByDataTestsId('softDeleteButton').should(softDeleteVisibleString) |
| 226 | .getElementByDataTestsId('lcpRegion').should(isNoHomingDataVisibleString) |
| 227 | .getElementByDataTestsId('tenant').should(isNoHomingDataVisibleString); |
| 228 | }); |
| 229 | } |
| 230 | }); |
| 231 | |
| 232 | |
| 233 | |
| 234 | function changeServiceModel(serviceModel: ServiceModel) { |
| 235 | serviceModel.service.uuid = "6e59c5de-f052-46fa-aa7e-2fca9d674c44"; |
| 236 | return serviceModel; |
| 237 | } |
| 238 | }); |
| 239 | |