Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 1 | ///<reference path="../../../node_modules/cypress/types/index.d.ts"/> |
| 2 | import {ServiceModel} from '../../support/jsonBuilders/models/service.model'; |
| 3 | import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder'; |
| 4 | |
| 5 | describe('Permissions ', ()=> { |
| 6 | var jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>(); |
| 7 | |
| 8 | beforeEach(() => { |
Ittay Stern | 32dbf80 | 2019-10-29 12:58:49 +0200 | [diff] [blame] | 9 | cy.clearSessionStorage(); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 10 | cy.preventErrorsOnLoading(); |
| 11 | cy.initAAIMock(); |
| 12 | cy.initVidMock(); |
| 13 | cy.login(); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 14 | }); |
| 15 | |
| 16 | afterEach(() => { |
| 17 | cy.screenshot(); |
| 18 | }); |
| 19 | |
| 20 | it('user without permission get mode-view : is not permitted', () => { |
| 21 | const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89"; |
| 22 | const SERVICE_TYPE: string = "TYLER SILVIA"; |
| 23 | const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb"; |
| 24 | const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450'; |
| 25 | |
| 26 | cy.initDrawingBoardUserPermission(<any>{isEditPermitted : false}); |
| 27 | |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 28 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 29 | jsonBuilderAndMock.basicJson( |
| 30 | res, |
| 31 | Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450", |
| 32 | 200, |
| 33 | 0, |
| 34 | "ecompNamingFalseModel", |
| 35 | ) |
| 36 | }); |
| 37 | |
| 38 | cy.readFile('../vid-automation/src/test/resources/VnfGroup/serviceWithVnfGroping_serviceInstance.json').then((res) => { |
| 39 | jsonBuilderAndMock.basicJson( |
| 40 | res, |
| 41 | Cypress.config('baseUrl') + `**/aai_get_service_instance_topology/**`, |
| 42 | 200, 0, |
| 43 | "serviceWithVnfGroping_serviceInstance", |
| 44 | ) |
| 45 | }); |
| 46 | |
| 47 | cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`); |
| 48 | |
| 49 | cy.url().should('contains', 'VIEW') |
| 50 | }); |
| 51 | |
| 52 | it('user without permission get mode-view : is permitted', () => { |
| 53 | const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89"; |
| 54 | const SERVICE_TYPE: string = "TYLER SILVIA"; |
| 55 | const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb"; |
| 56 | const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450'; |
| 57 | |
| 58 | cy.initDrawingBoardUserPermission(); |
| 59 | |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 60 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 61 | jsonBuilderAndMock.basicJson( |
| 62 | res, |
| 63 | Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450", |
| 64 | 200, |
| 65 | 0, |
| 66 | "ecompNamingFalseModel", |
| 67 | ) |
| 68 | }); |
| 69 | |
| 70 | cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json').then((res) => { |
| 71 | jsonBuilderAndMock.basicJson( |
| 72 | res, |
| 73 | Cypress.config('baseUrl') + "/aai_get_service_instance_topology/e433710f-9217-458d-a79d-1c7aff376d89/TYLER SILVIA/f8791436-8d55-4fde-b4d5-72dd2cf13cfb", |
| 74 | 200, 0, |
| 75 | "initServiceInstanceTopology", |
| 76 | ) |
| 77 | }); |
| 78 | cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}`); |
| 79 | |
| 80 | cy.url().should('contains', 'EDIT'); |
| 81 | cy.getElementByDataTestsId('deployBtn').contains('UPDATE'); |
| 82 | cy.getElementByDataTestsId('isViewOnly-status-test').contains('IN EDITING'); |
| 83 | }); |
| 84 | |
| 85 | it(`RETRY - drawing board mode - no permission should show retry view only mode`, () =>{ |
| 86 | const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89"; |
| 87 | const SERVICE_TYPE: string = "TYLER SILVIA"; |
| 88 | const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb"; |
| 89 | const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450'; |
| 90 | const JOB_ID: string = '123456-44a3-4472-bdff-9cd15ec12345'; |
| 91 | cy.initDrawingBoardUserPermission(<any>{isEditPermitted : false}); |
| 92 | cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json').then((res) => { |
| 93 | |
| 94 | // Adding VNF with isFailed. |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 95 | res.vnfs["2017-388_PASQUALE-vPE 0"].isFailed = true; |
| 96 | res.vnfs["2017-488_PASQUALE-vPE 0"].isFailed = true; |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 97 | |
| 98 | // Adding VFModule with isFailed. |
Ittay Stern | f792671 | 2019-07-07 19:23:03 +0300 | [diff] [blame] | 99 | res.vnfs["2017-488_PASQUALE-vPE 0"].vfModules["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0"]["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot"].isFailed = true; |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 100 | |
| 101 | jsonBuilderAndMock.basicJson( |
| 102 | res, |
| 103 | Cypress.config('baseUrl') + "/asyncInstantiation/bulkForRetry/" + JOB_ID, |
| 104 | 200, 0, |
| 105 | "initServiceInstanceRetryTopology", |
| 106 | ); |
| 107 | cy.openIframe(`app/ui/#/servicePlanning/RETRY_EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&jobId=${JOB_ID}`); |
| 108 | |
| 109 | cy.url().should('contains', '/RETRY?') |
| 110 | }); |
| 111 | }); |
| 112 | }); |