blob: 683e1d96c662fce423dc3bcb3ea3b159cdd4942b [file] [log] [blame]
Ittay Stern6f900cc2018-08-29 17:01:32 +03001///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2/// <reference types="Cypress" />
3import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
4import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
5
6describe('Retry Page', function () {
7 let jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
8 beforeEach(() => {
9 cy.window().then((win) => {
10 win.sessionStorage.clear();
11 cy.preventErrorsOnLoading();
12 cy.initAAIMock();
13 jsonBuilderAndMock.basicMock('/cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json',
14 Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450");
15 cy.initVidMock();
16 cy.initZones();
17 cy.permissionVidMock();
18 cy.login();
19 });
20 });
21
22 afterEach(() => {
23 cy.screenshot();
24 });
25
26 it(`RETRY - drawing board mode - should show correct failed icon with children + Retry button / Mock Data`, ()=> {
27 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
28 const SERVICE_TYPE: string = "TYLER SILVIA";
29 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
30 const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450';
31 const JOB_ID: string = '123456-44a3-4472-bdff-9cd15ec12345';
32 cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json').then((res) => {
33 // Service with isFailed.
34 res.isFailed= true;
35 res.action = 'Create';
36 res.statusMessage = 'Service instantiation has failed.'
37 // Adding VNF with isFailed.
Ittay Sternf7926712019-07-07 19:23:03 +030038 res.vnfs["2017-388_PASQUALE-vPE 0"].isFailed = true;
39 res.vnfs["2017-488_PASQUALE-vPE 0"].isFailed = true;
40 res.vnfs["2017-488_PASQUALE-vPE 0"].statusMessage = 'VNF instantiation failed message';
41 res.vnfs["2017-388_PASQUALE-vPE 0"].action = 'Create';
42 res.vnfs["2017-488_PASQUALE-vPE 0"].action = 'Create';
Ittay Stern6f900cc2018-08-29 17:01:32 +030043 res.networks["ExtVL 0"].action = 'Create';
44 res.networks["ExtVL 0"].statusMessage = 'Network instantiation failed message';
45
46 // Adding VFModule with isFailed.
Ittay Sternf7926712019-07-07 19:23:03 +030047 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;
48 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"].statusMessage = 'Short vfModule Failure Message';
49 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"].action = 'Create';
Ittay Stern6f900cc2018-08-29 17:01:32 +030050
51 jsonBuilderAndMock.basicJson(
52 res,
53 Cypress.config('baseUrl') + "/asyncInstantiation/bulkForRetry/" + JOB_ID,
54 200, 0,
55 "initServiceInstanceRetryTopology",
56 )
57 });
58
59 cy.openIframe(`app/ui/#/servicePlanning/RETRY_EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&jobId=${JOB_ID}`);
60
Ittay Sternf7926712019-07-07 19:23:03 +030061 cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').click();
Ittay Stern6f900cc2018-08-29 17:01:32 +030062
63 cy.get('.failed-msg').should('have.length', 5);
64 cy.get('.newIcon').should('have.length', 4);
65
66 //cy.drawingBoardNumberOfExistingElementsShouldContains(4);
67 cy.get('.toggle-children-wrapper.toggle-children-wrapper-expanded').eq(0).click().then(()=>{
68 cy.get('.failed-msg').should('have.length', 5);
69 cy.get('.newIcon').should('have.length', 4);
70 });
71
Ittay Sternf7926712019-07-07 19:23:03 +030072 cy.drawingBoardTreeOpenContextMenuByElementDataTestId('node-afacccf6-397d-45d6-b5ae-94c39734b168-2017-388_PASQUALE-vPE 0')
Ittay Stern6f900cc2018-08-29 17:01:32 +030073 .drawingBoardTreeClickOnContextMenuOptionByName('Edit')
74 .getElementByDataTestsId('cancelButton').click({force: true});
Ittay Sternf7926712019-07-07 19:23:03 +030075 cy.drawingBoardTreeOpenContextMenuByElementDataTestId('node-afacccf6-397d-45d6-b5ae-94c39734b168-2017-388_PASQUALE-vPE 0')
Ittay Stern6f900cc2018-08-29 17:01:32 +030076 .drawingBoardTreeClickOnContextMenuOptionByName('Remove');
77
78 cy.get('.newIcon').should('have.length', 2);
79 cy.getElementByDataTestsId('isViewOnly-status-test').contains('IN EDITING');
80
81 cy.getElementByDataTestsId("openMenuBtn").click({force: true})
82 .getElementByDataTestsId("context-menu-header-edit-item").click({force: true})
83 .getElementByDataTestsId("serviceName").should('have.text','mCaNkinstancename')
84 .getElementByDataTestsId("subscriberName")
85 .getElementByDataTestsId("serviceType")
86 .getElementByDataTestsId("owningEntity")
87 .getElementByDataTestsId("project")
88 .getElementByDataTestsId("rollback")
89 .getElementByDataTestsId('cancelButton').click({force: true});
90 cy.getElementByDataTestsId("openMenuBtn").click({force: true})
91 .getElementByDataTestsId("context-menu-header-audit-item");
92 // button should be RETRY
93 cy.getElementByDataTestsId('deployBtn').should('contain', 'REDEPLOY');
94 cy.getElementByDataTestsId('deployBtn').should('not.have.attr', 'disabled');
95
96 cy.checkPopoverContentOnMouseEvent('service-failed-msg', '.popover-content.popover-body','mouseenter', 0)
97 .should('contain', 'Service instantiation has failed');
98 });
99
100 it(`RETRY - view mode- should show failed icon with no actions enabled`, ()=> {
101 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
102 const SERVICE_TYPE: string = "TYLER SILVIA";
103 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
104 const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450';
105 const JOB_ID: string = '123456-44a3-4472-bdff-9cd15ec12345';
106 cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json').then((res) => {
107
108 // Adding VNF with isFailed.
Ittay Sternf7926712019-07-07 19:23:03 +0300109 res.vnfs["2017-388_PASQUALE-vPE 0"].isFailed = true;
110 res.vnfs["2017-488_PASQUALE-vPE 0"].isFailed = true;
111 res.vnfs["2017-388_PASQUALE-vPE 0"].action = 'Create';
112 res.vnfs["2017-488_PASQUALE-vPE 0"].action = 'Create';
113 res.vnfs["2017-488_PASQUALE-vPE 0"].statusMessage = 'Very long message that checks the popoverwindow can show very very long messagewithout problem.as-erfderfd-rfghthth-yjyjyj-ukuk. For more details go to audit show window';
Ittay Stern6f900cc2018-08-29 17:01:32 +0300114 // Adding VFModule with isFailed.
Ittay Sternf7926712019-07-07 19:23:03 +0300115 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;
116 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"].action = 'Create';
Ittay Stern6f900cc2018-08-29 17:01:32 +0300117
118 cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/responceForFailedInstance.json').then((res) => {
119 jsonBuilderAndMock.basicJson(
120 res,
121 Cypress.config('baseUrl') + "/asyncInstantiation/auditStatusForRetry**",
122 200,
123 0,
124 "msoStatusForFailedInstance",
125 )
126 });
127
128 jsonBuilderAndMock.basicJson(
129 res,
130 Cypress.config('baseUrl') + "/asyncInstantiation/bulkForRetry/" + JOB_ID,
131 200, 0,
132 "initServiceInstanceRetryTopology",
133 )
134 });
135
136 cy.openIframe(`app/ui/#/servicePlanning/RETRY?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&jobId=${JOB_ID}`);
137
Ittay Sternf7926712019-07-07 19:23:03 +0300138 cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').click();
Ittay Stern6f900cc2018-08-29 17:01:32 +0300139
140 cy.get('.failed-msg').should('have.length', 4);
141 cy.get('.newIcon').should('have.length', 4);
142
143 cy.get('.toggle-children-wrapper.toggle-children-wrapper-expanded').eq(0).click().then(()=>{
144 cy.get('.failed-msg').should('have.length', 4);
145 cy.get('.newIcon').should('have.length', 4);
146 });
Ittay Sternf7926712019-07-07 19:23:03 +0300147 cy.assertMenuItemsForNode(['showAuditInfo'],'node-afacccf6-397d-45d6-b5ae-94c39734b168-2017-388_PASQUALE-vPE 0-menu-btn');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300148 cy.getElementByDataTestsId('isViewOnly-status-test').contains('VIEW ONLY');
149
150 // deploy button should be 'REDEPLOY' and disabled.
151 cy.getElementByDataTestsId('editBtn').should('contain', 'REDEPLOY').should('have.attr', 'disabled');
152
153 cy.checkPopoverContentOnMouseEvent('failed-error-message', '.popover-content.popover-body','mouseenter', 0)
154 .should('not.be.visible');
155 cy.checkPopoverContentOnMouseEvent('failed-error-message', '.popover-content.popover-body','mouseenter', 1)
156 .should('contain', 'Very long');
157
158 });
159
Ittay Sternf7926712019-07-07 19:23:03 +0300160 it(`RETRY - drawing board mode - should show correct failed icon + Retry button`, ()=> {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300161 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
162 const SERVICE_TYPE: string = "TYLER SILVIA";
163 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
164 const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450';
165 const JOB_ID: string = '123456-44a3-4472-bdff-9cd15ec12345';
166 let expectedResult: JSON;
167
168 cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/ServiceTreeForRetry_serviceInstance.json').then((res) => {
169
170 jsonBuilderAndMock.basicJson(
171 res,
172 Cypress.config('baseUrl') + "/asyncInstantiation/bulkForRetry/" + JOB_ID,
173 200, 0,
174 "initServiceInstanceRetryTopology",
175 )
176 });
177
178 //TODO - join this to correct API test
179
180
181
182 cy.openIframe(`app/ui/#/servicePlanning/RETRY_EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&jobId=${JOB_ID}`);
183
184 cy.get('.failed-msg').should('have.length', 1);
185 cy.get('.newIcon').should('have.length', 1);
186 //TODO
187
188 cy.getElementByDataTestsId('deployBtn').should('not.have.attr', 'disabled');
189
190 // button should be RETRY
191 cy.getElementByDataTestsId('deployBtn').should('contain', 'REDEPLOY').click();
192
193
194 //TODO - join this to correct API test
195
196
197 });
198
Ittay Sternf7926712019-07-07 19:23:03 +0300199 it('RETRY- edit mode- failed service with vnf', ()=>{
200 const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
201 const SERVICE_TYPE: string = "TYLER SILVIA";
202 const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
203 const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450';
204 const JOB_ID: string = '123456-44a3-4472-bdff-9cd15ec12345';
205 const TRACK_BY_ID = '14561234';
206 let expectedResult: JSON;
207 cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/ServiceWithFailedServiceInstance.json').then((res) => {
208
209 cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/auditModalFailedServiceInstance.json').then((res) => {
210 jsonBuilderAndMock.basicJson(
211 res,
212 Cypress.config('baseUrl') + "/asyncInstantiation/auditStatusForRetry/TRACK_BY_ID",
213 200,
214 0,
215 "msoStatusForFailedInstance",
216 )
217 });
218
219 jsonBuilderAndMock.basicJson(
220 res,
221 Cypress.config('baseUrl') + "/asyncInstantiation/bulkForRetry/" + JOB_ID,
222 200, 0,
223 "initFAiledServiceInstanceRetryTopology",
224 )
225 });
226
227 cy.openIframe(`app/ui/#/servicePlanning/RETRY_EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&jobId=${JOB_ID}`);
228 cy.get('.newIcon').should('have.length', 1);
229 cy.getElementByDataTestsId('isViewOnly-status-test').contains('IN EDITING');
230 cy.getElementByDataTestsId("openMenuBtn").click({force: true});
231 cy.getElementByDataTestsId("context-menu-header-edit-item").click({force: true})
232 .getElementByDataTestsId("serviceName").should('have.text','INSTANCE_NAME')
233 .getElementByDataTestsId("subscriberName")
234 .getElementByDataTestsId("serviceType")
235 .getElementByDataTestsId("owningEntity")
236 .getElementByDataTestsId("project")
237 .getElementByDataTestsId("rollback")
238 .getElementByDataTestsId('cancelButton').click({force: true});
239 cy.getElementByDataTestsId("openMenuBtn").click({force: true})
240 .getElementByDataTestsId("context-menu-header-audit-item").click({force: true});
241 cy.getElementByDataTestsId('requestId').should('contain', 'e5f93320-cce6-424d-adc6-259a4ee8b342');
242 cy.getElementByDataTestsId('jobStatus').should('contain', 'Failed');
243 cy.getElementByDataTestsId('additionalInfo').should('contain', 'The service instantiation is failed');
244 cy.getElementByDataTestsId('close-button').click({force: true});
245 // // button should be RETRY
246 cy.getElementByDataTestsId('deployBtn').should('contain', 'REDEPLOY');
247 cy.getElementByDataTestsId('deployBtn').should('not.have.attr', 'disabled');
248 cy.get('.failed-msg').should('have.length', 1);
249 cy.get('.newIcon').should('have.length', 1);
250
251 cy.checkPopoverContentOnMouseEvent('service-failed-msg', '.popover-content.popover-body','mouseenter', 0)
252 .should('contain', 'The service instantiation is failed');
253 });
Ittay Stern6f900cc2018-08-29 17:01:32 +0300254});