aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/integration/iFrames/retry.e2e.ts
blob: 5047326e0719165c08738b6511013482d37aebc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
/// <reference types="Cypress" />
import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
import {ServiceModel} from '../../support/jsonBuilders/models/service.model';

describe('Retry Page', function () {
  let jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
  beforeEach(() => {
      cy.clearSessionStorage();
      cy.preventErrorsOnLoading();
      cy.initAAIMock();
      jsonBuilderAndMock.basicMock('cypress/support/jsonBuilders/mocks/jsons/serviceModels/ecompNamingFalseModel.json',
        Cypress.config('baseUrl') + "/rest/models/services/6b528779-44a3-4472-bdff-9cd15ec93450");
      cy.initVidMock();
      cy.initZones();
      cy.permissionVidMock();
      cy.login();
  });

  afterEach(() => {
    cy.screenshot();
  });

  it(`RETRY - drawing board mode - should show correct failed icon with children + Retry button / Mock Data`,  ()=> {
    const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
    const SERVICE_TYPE: string = "TYLER SILVIA";
    const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
    const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450';
    const JOB_ID: string = '123456-44a3-4472-bdff-9cd15ec12345';
    cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json').then((res) => {
      // Service with isFailed.
      res.isFailed= true;
      res.action = 'Create';
      res.statusMessage = 'Service instantiation has failed.'
      // Adding VNF with isFailed.
      res.vnfs["2017-388_PASQUALE-vPE 0"].isFailed = true;
      res.vnfs["2017-488_PASQUALE-vPE 0"].isFailed = true;
      res.vnfs["2017-488_PASQUALE-vPE 0"].statusMessage = 'VNF instantiation failed message';
      res.vnfs["2017-388_PASQUALE-vPE 0"].action = 'Create';
      res.vnfs["2017-488_PASQUALE-vPE 0"].action = 'Create';
      res.networks["ExtVL 0"].action = 'Create';
      res.networks["ExtVL 0"].isFailed = true;
      res.networks["ExtVL 0"].statusMessage = 'Network instantiation failed message';

      // Adding VFModule with isFailed.
      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;
      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';
      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';

      jsonBuilderAndMock.basicJson(
        res,
        Cypress.config('baseUrl') + "/asyncInstantiation/bulkForRetry/" + JOB_ID,
        200, 0,
        "initServiceInstanceRetryTopology",
      )
    });

    cy.openIframe(`app/ui/#/servicePlanning/RETRY_EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&jobId=${JOB_ID}`);

    cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').eq(0).click();

    cy.get('.failed-msg').should('have.length', 5);
    cy.get('.newIcon').should('have.length', 5);

    //cy.drawingBoardNumberOfExistingElementsShouldContains(4);
    cy.get('.toggle-children-wrapper.toggle-children-wrapper-expanded').eq(0).click().then(()=>{
      cy.get('.failed-msg').should('have.length', 5);
      cy.get('.newIcon').should('have.length', 5);
    });

    cy.drawingBoardTreeOpenContextMenuByElementDataTestId('node-afacccf6-397d-45d6-b5ae-94c39734b168-2017-388_PASQUALE-vPE 0')
      .drawingBoardTreeClickOnContextMenuOptionByName('Edit')
      .getElementByDataTestsId('cancelButton').click({force: true});
    cy.drawingBoardTreeOpenContextMenuByElementDataTestId('node-afacccf6-397d-45d6-b5ae-94c39734b168-2017-388_PASQUALE-vPE 0')
      .drawingBoardTreeClickOnContextMenuOptionByName('Remove');

    cy.get('.newIcon').should('have.length', 2);
    cy.getElementByDataTestsId('isViewOnly-status-test').contains('IN EDITING');

    cy.getElementByDataTestsId("openMenuBtn").click({force: true})
      .getElementByDataTestsId("context-menu-header-edit-item").click({force: true})
      .getElementByDataTestsId("serviceName").should('have.text','mCaNkinstancename')
      .getElementByDataTestsId("subscriberName")
      .getElementByDataTestsId("serviceType")
      .getElementByDataTestsId("owningEntity")
      .getElementByDataTestsId("project")
      .getElementByDataTestsId("rollback")
      .getElementByDataTestsId('cancelButton').click({force: true});
    cy.getElementByDataTestsId("openMenuBtn").click({force: true})
      .getElementByDataTestsId("context-menu-header-audit-item");
    // button should be RETRY
    cy.getElementByDataTestsId('deployBtn').should('contain', 'REDEPLOY');
    cy.getElementByDataTestsId('deployBtn').should('not.have.attr', 'disabled');

    cy.checkPopoverContentOnMouseEvent('service-failed-msg',  '.popover-content.popover-body','mouseenter', 0)
      .should('contain', 'Service instantiation has failed');
  });

  it(`RETRY - view mode- should show failed icon with no actions enabled`, ()=> {
    const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
    const SERVICE_TYPE: string = "TYLER SILVIA";
    const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
    const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450';
    const JOB_ID: string = '123456-44a3-4472-bdff-9cd15ec12345';
    cy.readFile('../vid-automation/src/test/resources/aaiGetInstanceTopology/getServiceInstanceTopologyResult.json').then((res) => {

      // Adding VNF with isFailed.
      res.vnfs["2017-388_PASQUALE-vPE 0"].isFailed = true;
      res.vnfs["2017-488_PASQUALE-vPE 0"].isFailed = true;
      res.vnfs["2017-388_PASQUALE-vPE 0"].action = 'Create';
      res.vnfs["2017-488_PASQUALE-vPE 0"].action = 'Create';
      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';
      // Adding VFModule with isFailed.
      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;
      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';
      res.networks["ExtVL 0"].isFailed = true;

      cy.readFile('cypress/support/jsonBuilders/mocks/jsons/responceForFailedInstance.json').then((res) => {
        jsonBuilderAndMock.basicJson(
          res,
          Cypress.config('baseUrl') + "/asyncInstantiation/auditStatusForRetry**",
          200,
          0,
          "msoStatusForFailedInstance",
        )
      });

      jsonBuilderAndMock.basicJson(
        res,
        Cypress.config('baseUrl') + "/asyncInstantiation/bulkForRetry/" + JOB_ID,
        200, 0,
        "initServiceInstanceRetryTopology",
      )
    });

    cy.openIframe(`app/ui/#/servicePlanning/RETRY?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&jobId=${JOB_ID}`);

    cy.getElementByDataTestsId('node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0').eq(0).click();

    cy.get('.failed-msg').should('have.length', 4);
    cy.get('.newIcon').should('have.length', 5);

    cy.get('.toggle-children-wrapper.toggle-children-wrapper-expanded').eq(0).click().then(()=>{
      cy.get('.failed-msg').should('have.length', 4);
      cy.get('.newIcon').should('have.length', 5);
    });
    cy.assertMenuItemsForNode(['showAuditInfo'],'node-afacccf6-397d-45d6-b5ae-94c39734b168-2017-388_PASQUALE-vPE 0-menu-btn');
    cy.getElementByDataTestsId('isViewOnly-status-test').contains('VIEW ONLY');

    // deploy button should be 'REDEPLOY' and disabled.
    cy.getElementByDataTestsId('editBtn').should('contain', 'REDEPLOY').should('have.attr', 'disabled');

    cy.checkPopoverContentOnMouseEvent('failed-error-message',  '.popover-content.popover-body','mouseenter', 0)
      .should('not.be.visible');
    cy.checkPopoverContentOnMouseEvent('failed-error-message',  '.popover-content.popover-body','mouseenter', 1)
      .should('contain', 'Very long');

  });

  it(`RETRY - drawing board mode - should show correct failed icon + Retry button`,  ()=> {
    const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
    const SERVICE_TYPE: string = "TYLER SILVIA";
    const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
    const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450';
    const JOB_ID: string = '123456-44a3-4472-bdff-9cd15ec12345';
    let expectedResult: JSON;

    cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/ServiceTreeForRetry_serviceInstance.json').then((res) => {

      jsonBuilderAndMock.basicJson(
        res,
        Cypress.config('baseUrl') + "/asyncInstantiation/bulkForRetry/" + JOB_ID,
        200, 0,
        "initServiceInstanceRetryTopology",
      )
    });

    //TODO - join this to correct API test



    cy.openIframe(`app/ui/#/servicePlanning/RETRY_EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&jobId=${JOB_ID}`);

    cy.get('.failed-msg').should('have.length', 1);
    cy.get('.newIcon').should('have.length', 1);
    //TODO

    cy.getElementByDataTestsId('deployBtn').should('not.have.attr', 'disabled');

    // button should be RETRY
    cy.getElementByDataTestsId('deployBtn').should('contain', 'REDEPLOY').click();


    //TODO - join this to correct API test


  });

  it('RETRY- edit mode- failed service with vnf', ()=>{
    const SUBSCRIBER_ID: string = "e433710f-9217-458d-a79d-1c7aff376d89";
    const SERVICE_TYPE: string = "TYLER SILVIA";
    const SERVICE_INSTANCE_ID: string = "f8791436-8d55-4fde-b4d5-72dd2cf13cfb";
    const SERVICE_MODEL_ID: string = '6b528779-44a3-4472-bdff-9cd15ec93450';
    const JOB_ID: string = '123456-44a3-4472-bdff-9cd15ec12345';
    const TRACK_BY_ID = '14561234';
    let expectedResult: JSON;
    cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/ServiceWithFailedServiceInstance.json').then((res) => {

      cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/auditModalFailedServiceInstance.json').then((res) => {
        jsonBuilderAndMock.basicJson(
          res,
          Cypress.config('baseUrl') + "/asyncInstantiation/auditStatusForRetry/TRACK_BY_ID",
          200,
          0,
          "msoStatusForFailedInstance",
        )
      });

      jsonBuilderAndMock.basicJson(
        res,
        Cypress.config('baseUrl') + "/asyncInstantiation/bulkForRetry/" + JOB_ID,
        200, 0,
        "initFAiledServiceInstanceRetryTopology",
      )
    });

    cy.openIframe(`app/ui/#/servicePlanning/RETRY_EDIT?serviceModelId=${SERVICE_MODEL_ID}&subscriberId=${SUBSCRIBER_ID}&serviceType=${SERVICE_TYPE}&serviceInstanceId=${SERVICE_INSTANCE_ID}&jobId=${JOB_ID}`);
    cy.get('.newIcon').should('have.length', 1);
    cy.getElementByDataTestsId('isViewOnly-status-test').contains('IN EDITING');
    cy.getElementByDataTestsId("openMenuBtn").click({force: true});
    cy.getElementByDataTestsId("context-menu-header-edit-item").click({force: true})
      .getElementByDataTestsId("serviceName").should('have.text','INSTANCE_NAME')
      .getElementByDataTestsId("subscriberName")
      .getElementByDataTestsId("serviceType")
      .getElementByDataTestsId("owningEntity")
      .getElementByDataTestsId("project")
      .getElementByDataTestsId("rollback")
      .getElementByDataTestsId('cancelButton').click({force: true});
    cy.getElementByDataTestsId("openMenuBtn").click({force: true})
      .getElementByDataTestsId("context-menu-header-audit-item").click({force: true});
    cy.getElementByDataTestsId('requestId').should('contain', 'e5f93320-cce6-424d-adc6-259a4ee8b342');
    cy.getElementByDataTestsId('jobStatus').should('contain', 'Failed');
    cy.getElementByDataTestsId('additionalInfo').should('contain', 'The service instantiation is failed');
    cy.getElementByDataTestsId('close-button').click({force: true});
    // // button should be RETRY
    cy.getElementByDataTestsId('deployBtn').should('contain', 'REDEPLOY');
    cy.getElementByDataTestsId('deployBtn').should('not.have.attr', 'disabled');
    cy.get('.failed-msg').should('have.length', 1);
    cy.get('.newIcon').should('have.length', 1);

    cy.checkPopoverContentOnMouseEvent('service-failed-msg',  '.popover-content.popover-body','mouseenter', 0)
      .should('contain', 'The service instantiation is failed');
    });
});