blob: 22460a04f8cc77594936c228e2fd263f25afdeee [file] [log] [blame]
Ittay Stern6f900cc2018-08-29 17:01:32 +03001///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
3import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
4
5describe('Permissions ', ()=> {
6 var jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
7
8 beforeEach(() => {
Ittay Stern32dbf802019-10-29 12:58:49 +02009 cy.clearSessionStorage();
Ittay Stern6f900cc2018-08-29 17:01:32 +030010 cy.preventErrorsOnLoading();
11 cy.initAAIMock();
12 cy.initVidMock();
13 cy.login();
Ittay Stern6f900cc2018-08-29 17:01:32 +030014 });
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 Stern607ea3d2019-10-23 17:10:52 +030028 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030029 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 Stern607ea3d2019-10-23 17:10:52 +030060 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030061 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 Sternf7926712019-07-07 19:23:03 +030095 res.vnfs["2017-388_PASQUALE-vPE 0"].isFailed = true;
96 res.vnfs["2017-488_PASQUALE-vPE 0"].isFailed = true;
Ittay Stern6f900cc2018-08-29 17:01:32 +030097
98 // Adding VFModule with isFailed.
Ittay Sternf7926712019-07-07 19:23:03 +030099 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 Stern6f900cc2018-08-29 17:01:32 +0300100
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});