blob: 5857e1ac0302cc5cf935f8c3d6a8807f15674b98 [file] [log] [blame]
Ittay Sternf7926712019-07-07 19:23:03 +03001///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
3import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
4import {AaiServiceInstancesModel} from '../../support/jsonBuilders/models/serviceInstances.model';
5import {AAISubDetailsModel} from '../../support/jsonBuilders/models/aaiSubDetails.model';
6import {AAISubViewEditModel} from '../../support/jsonBuilders/models/aaiSubViewEdit.model';
7
8describe('Resume tests', function () {
9 describe('Resume Defect 710619 - VID doesn\'t prompt to allow the user to attach the volume group on clicking Resume', () => {
10
11 let jsonBuilderAAIService: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
12 let jsonBuilderAAISubViewEditModel: JsonBuilder<AAISubViewEditModel> = new JsonBuilder<AAISubViewEditModel>();
13 let jsonBuilderAAISubDetailsModel: JsonBuilder<AAISubDetailsModel> = new JsonBuilder<AAISubDetailsModel>();
14 let jsonBuilderAaiServiceInstances: JsonBuilder<AaiServiceInstancesModel> = new JsonBuilder<AaiServiceInstancesModel>();
15 beforeEach(() => {
Ittay Stern607ea3d2019-10-23 17:10:52 +030016 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/defect710619/serviceE2E.json').then((res) => {
Ittay Sternf7926712019-07-07 19:23:03 +030017 jsonBuilderAAIService.basicJson(
18 res,
19 Cypress.config('baseUrl') + "/rest/models/services/**",
20 200, 0,
21 "service-complexService")
22 });
23
24
Ittay Stern607ea3d2019-10-23 17:10:52 +030025 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/defect710619/aaiSubViewEditForServiceWithSomeVFModuleE2E.json').then((res) => {
Ittay Sternf7926712019-07-07 19:23:03 +030026 jsonBuilderAAISubViewEditModel.basicJson(
27 res,
28 Cypress.config('baseUrl') + "/aai_sub_viewedit/**",
29 200,
30 0,
31 "aai-sub-view-edit")
32 });
33
Ittay Stern607ea3d2019-10-23 17:10:52 +030034 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/defect710619/aaiSubDetailsE2E.json').then((res) => {
Ittay Sternf7926712019-07-07 19:23:03 +030035 jsonBuilderAAISubDetailsModel.basicJson(
36 res,
37 Cypress.config('baseUrl') + "/aai_sub_details/**",
38 200,
39 0,
40 "aai-sub-details")
41 });
42
Ittay Stern607ea3d2019-10-23 17:10:52 +030043 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/defect710619/aaiServiceInstancesE2E.json').then((res) => {
Ittay Sternf7926712019-07-07 19:23:03 +030044 jsonBuilderAaiServiceInstances.basicJson(
45 res,
46 Cypress.config('baseUrl') + "/search_service_instances**",
47 200,
48 0,
49 "aai-get-service-instances")
50 });
51
52 cy.server().route({
53 url: Cypress.config('baseUrl') + '/mso/mso_create_vfmodule_instance/dedd680f-f3bd-46d8-97c7-b6fc28db9317/vnfs/1d45e992-e282-4ba5-b17a-9ca6562169e3',
54 method: 'POST',
55 status: 200,
56 response: "[]",
57 }).as("actualResumeCall");
58
59 cy.initVidMock();
60
61 cy.initTenants();
62
63 cy.login();
64 });
65
66 afterEach(() => {
67 cy.screenshot();
68 });
69
70 it(`Resume Defect 710619 - with flag FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE is ON`, function () {
71 cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=dedd680f-f3bd-46d8-97c7-b6fc28db9317&aaiModelVersionId=4b60252a-bf6c-40df-9db5-98b4c363fdf4&isPermitted=true').then(()=>{
72 cy.wait('@service-complexService');
73 checkResumeAndPopup("dpa2bccfx5992v_base_module","vfModuleTreeNode-assigned");
74 });
75 });
76
77 it(`Resume Defect 710619 - with flag FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE is OFF`, function () {
78
Ittay Stern607ea3d2019-10-23 17:10:52 +030079 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.json').then((res) => {
Ittay Sternf7926712019-07-07 19:23:03 +030080 cy.server()
81 .route({
82 method: 'GET',
83 delay : 0,
84 status : 200,
85 url : Cypress.config('baseUrl') + "/flags**",
86 response : {
Rina Roi7ec34a12019-08-07 10:14:08 +030087 "FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST" : true,
Ittay Sternf7926712019-07-07 19:23:03 +030088 "FLAG_ADD_MSO_TESTAPI_FIELD": true,
89 "FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE": false
90 }
91 }).as('initFlags');
92 });
93
94 cy.visit('/serviceModels.htm#/instantiate?subscriberId=e433710f-9217-458d-a79d-1c7aff376d89&subscriberName=SILVIA ROBBINS&serviceType=TYLER%20SILVIA&serviceInstanceId=dedd680f-f3bd-46d8-97c7-b6fc28db9317&aaiModelVersionId=4b60252a-bf6c-40df-9db5-98b4c363fdf4&isPermitted=true');
95 cy.wait('@service-complexService');
96
97 checkResumeAndPopup("dpa2bccfx5992v_base_module","vfModuleTreeNode-assigned");
98
99 });
100
101
102 function checkResumeAndPopup(vfModuleName:string, vfModuleClassName:string) {
103 cy.get('div').find('.' + vfModuleClassName)
104 .getElementByDataTestsId('resumeVFModuleButton-' + vfModuleName).click().then(()=> {
105 cy.getElementByDataTestsId('confirmResumeDeleteButton').should('be.visible')
106 .getElementByDataTestsId('softDeleteButton').should('not.be.visible')
Rina Roi7ec34a12019-08-07 10:14:08 +0300107 .getElementByDataTestsId('lcpRegion').should('be.visible').select("option-irma-aic-hvf6")
Ittay Sternf7926712019-07-07 19:23:03 +0300108 .getElementByDataTestsId('tenant').should('be.visible').select("bae71557c5bb4d5aac6743a4e5f1d054");
109 cy.getElementByDataTestsId('confirmResumeDeleteButton').not('.button--inactive').click().then(()=> {
110 cy.wait('@actualResumeCall').then(xhr => {
Ittay Stern607ea3d2019-10-23 17:10:52 +0300111 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json').then((expectedResult) => {
Ittay Sternf7926712019-07-07 19:23:03 +0300112 cy.deepCompare(xhr.request.body, expectedResult);
113 });
114 });
115 });
116 });
117 }
118 });
119});
120