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 : { |
| 86 | "FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE": true, |
| 87 | "FLAG_VF_MODULE_RESUME_STATUS_CREATE": false |
| 88 | } |
| 89 | }).as('initFlags'); |
| 90 | }); |
| 91 | |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 92 | 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] | 93 | cy.wait('@service-complexService'); |
| 94 | |
| 95 | checkResumeAndPopup('aa', 'vfModuleTreeNode-pendingactivation'); |
| 96 | checkResumeAndPopup('gg', 'vfModuleTreeNode-assigned'); |
| 97 | |
| 98 | cy.get('.vfModuleTreeNode-created') |
| 99 | .getElementByDataTestsId('resumeVFModuleButton-ABC').should('not.be.visible'); |
| 100 | cy.get('.vfModuleTreeNode-pending-delete') |
| 101 | .getElementByDataTestsId('resumeVFModuleButton-my_vfModule').should('not.be.visible'); |
| 102 | |
| 103 | }); |
| 104 | |
| 105 | it(`Resume button display in orch status - pendingactivation, assigned, created - feature FLAG_VF_MODULE_RESUME_STATUS_CREATE - is ON`, function () { |
| 106 | |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 107 | 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] | 108 | cy.wait('@service-complexService'); |
| 109 | |
| 110 | checkResumeAndPopup('aa', 'vfModuleTreeNode-pendingactivation'); |
| 111 | checkResumeAndPopup('gg', 'vfModuleTreeNode-assigned'); |
| 112 | checkResumeAndPopup('ABC', 'vfModuleTreeNode-created'); |
| 113 | |
| 114 | cy.get('.vfModuleTreeNode-pending-delete') |
| 115 | .getElementByDataTestsId('resumeVFModuleButton-my_vfModule').should('not.be.visible'); |
| 116 | |
| 117 | }); |
| 118 | |
| 119 | it(`Delete popup with not homing data from AAI`, function () { |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 120 | 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] | 121 | cy.wait('@service-complexService'); |
| 122 | checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true); |
Alexey Sandler | 453a7bd | 2019-08-22 15:16:48 +0300 | [diff] [blame] | 123 | cy.selectDropdownOptionByText('lcpRegion', 'AAIAIC25 (AIC)'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 124 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled'); |
| 125 | cy.typeToInput("lcpRegionText", "just another region"); |
| 126 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled'); |
| 127 | cy.selectDropdownOptionByText('tenant', 'USP-SIP-IC-24335-T-01'); |
| 128 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.have.attr', 'disabled'); |
Alexey Sandler | 453a7bd | 2019-08-22 15:16:48 +0300 | [diff] [blame] | 129 | cy.selectDropdownOptionByText('lcpRegion', 'hvf6 (AIC)'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 130 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('have.attr', 'disabled'); |
| 131 | cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testalexandria'); |
| 132 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.have.attr', 'disabled'); |
Alexey Sandler | 453a7bd | 2019-08-22 15:16:48 +0300 | [diff] [blame] | 133 | cy.getElementByDataTestsId('cancel').click({force: true}); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 134 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('not.be.visible'); |
| 135 | }); |
| 136 | |
| 137 | it(`Soft delete button display with partial homing data from AAI`, function () { |
| 138 | |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 139 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiGetHomingData.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 140 | jsonBuilderAaiServiceInstances.basicJson( |
| 141 | res, |
| 142 | Cypress.config('baseUrl') + "/aai_get_homing_by_vfmodule/c015cc0f-0f37-4488-aabf-53795fd93cd3/a231a99c-7e75-4d6d-a0fb-5c7d26f30f77", |
| 143 | 200, |
| 144 | 0, |
| 145 | "aai-get-homing-data") |
| 146 | }); |
| 147 | |
| 148 | |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 149 | 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] | 150 | cy.wait('@service-complexService'); |
| 151 | checkSoftDeleteAndDeletePopup('my_vfModule', 'vfModuleTreeNode-pending-delete', true, true); |
| 152 | cy.getElementByDataTestsId('lcpRegionText').should('be.visible'); |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 153 | cy.getElementByDataTestsId('lcpRegion').contains('AAIAIC25'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 154 | cy.getElementByDataTestsId('tenant').contains('USP-SIP-IC-24335-T-01'); |
| 155 | }); |
| 156 | |
| 157 | it(`Soft delete button display with with homing data from AAI`, function () { |
| 158 | |
| 159 | cy.readFile('../vid-automation/src/test/resources/viewEdit/aaiHomingDataResponse.json').then((res) => { |
| 160 | jsonBuilderAaiServiceInstances.basicJson( |
| 161 | res, |
| 162 | Cypress.config('baseUrl') + "/aai_get_homing_by_vfmodule/0846287b-65bf-45a6-88f6-6a1af4149fac/a9b70ac0-5917-4203-a308-0e6920e6d09b", |
| 163 | 200, |
| 164 | 0, |
| 165 | "aai-get-homing-data") |
| 166 | }); |
| 167 | |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 168 | 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] | 169 | cy.wait('@service-complexService'); |
| 170 | checkSoftDeleteAndDeletePopup('vf_module2', 'vfModuleTreeNode-pendingcreate', true, false); |
| 171 | }); |
| 172 | |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 173 | it(`Soft delete and Delete - Mega region is AAIAIC25 - not 'olson3', 'olson5a'`, function () { |
| 174 | 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] | 175 | cy.wait('@service-complexService'); |
| 176 | //Delete |
| 177 | checkSoftDeleteAndDeletePopup('gg', 'vfModuleTreeNode-assigned', false, true); |
| 178 | checkLegacyRegion(); |
| 179 | cy.getElementByDataTestsId('cancel').click(); |
| 180 | //Soft delete |
| 181 | checkSoftDeleteAndDeletePopup('aa', 'vfModuleTreeNode-pendingactivation', true, true); |
| 182 | checkLegacyRegion(); |
| 183 | cy.getElementByDataTestsId('cancel').click(); |
| 184 | //Resume |
| 185 | cy.get('div').find('.vfModuleTreeNode-pendingactivation') |
| 186 | .getElementByDataTestsId('resumeVFModuleButton-aa').click().then(()=> { |
| 187 | checkLegacyRegion(); |
| 188 | }); |
| 189 | }); |
| 190 | |
| 191 | function checkLegacyRegion() { |
Alexey Sandler | 453a7bd | 2019-08-22 15:16:48 +0300 | [diff] [blame] | 192 | checkIsLegacyRegionTextIsDisplay('AAIAIC25 (AIC)', true); |
| 193 | checkIsLegacyRegionTextIsDisplay('olson3 (AIC)', false); |
| 194 | checkIsLegacyRegionTextIsDisplay('olson5a (AIC)', false); |
| 195 | checkIsLegacyRegionTextIsDisplay('hvf6 (AIC)', false); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 196 | } |
| 197 | |
| 198 | function checkIsLegacyRegionTextIsDisplay(lcpRegionName: string, isVisible: boolean) { |
| 199 | const isVisibleText = isVisible ? 'be.visible' : 'not.be.visible'; |
| 200 | cy.selectDropdownOptionByText('lcpRegion', lcpRegionName); |
| 201 | cy.getElementByDataTestsId('lcpRegionText').should(isVisibleText); |
| 202 | |
| 203 | } |
| 204 | |
| 205 | function checkResumeAndPopup(vfModuleName:string, vfModuleClassName:string) { |
| 206 | cy.get('div').find('.' + vfModuleClassName) |
| 207 | .getElementByDataTestsId('resumeVFModuleButton-' + vfModuleName).click().then(()=> { |
| 208 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('be.visible') |
| 209 | .getElementByDataTestsId('softDeleteButton').should('not.be.visible') |
| 210 | .getElementByDataTestsId('lcpRegion').should('be.visible') |
| 211 | .getElementByDataTestsId('tenant').should('be.visible') |
| 212 | .getElementByDataTestsId('modalTitle').contains('Instantiate') |
| 213 | .getElementByDataTestsId('confirmResumeDeleteButton').contains('Instantiate') |
| 214 | .getElementByDataTestsId('cancel').click(); |
| 215 | }); |
| 216 | } |
| 217 | |
| 218 | function checkSoftDeleteAndDeletePopup(vfModuleName:string, vfModuleClassName:string, softDeleteEnable:boolean, isNoHomingData:boolean) { |
| 219 | const visibleString = 'be.visible'; |
| 220 | const NOT = 'not.'; |
| 221 | const softDeleteVisibleString = (softDeleteEnable) ? visibleString : NOT + visibleString; |
| 222 | const isNoHomingDataVisibleString = (isNoHomingData) ? visibleString : NOT + visibleString; |
| 223 | cy.get('div').find('.' + vfModuleClassName) |
| 224 | .getElementByDataTestsId('deleteVFModuleButton-' + vfModuleName).click({force: true}).then(()=> { |
| 225 | cy.getElementByDataTestsId('confirmResumeDeleteButton').should('be.visible') |
| 226 | .getElementByDataTestsId('softDeleteButton').should(softDeleteVisibleString) |
| 227 | .getElementByDataTestsId('lcpRegion').should(isNoHomingDataVisibleString) |
| 228 | .getElementByDataTestsId('tenant').should(isNoHomingDataVisibleString); |
| 229 | }); |
| 230 | } |
| 231 | }); |
| 232 | |
| 233 | |
| 234 | |
| 235 | function changeServiceModel(serviceModel: ServiceModel) { |
| 236 | serviceModel.service.uuid = "6e59c5de-f052-46fa-aa7e-2fca9d674c44"; |
| 237 | return serviceModel; |
| 238 | } |
| 239 | }); |
| 240 | |