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