1 describe('Drawing Board: Instantiation Templates', function () {
3 describe('Load Page and Deploy', () => {
6 cy.clearSessionStorage();
7 cy.setTestApiParamToVNF();
9 cy.initDrawingBoardUserPermission();
12 mockAsyncBulkResponse();
19 it(`Given a stored template - when click "deploy" - then a coherent request should be sent upon deploy`, function () {
20 const serviceModelId = '6cfeeb18-c2b0-49df-987a-da47493c8e38';
21 const templateUuid = "46390edd-7100-46b2-9f18-419bd24fb60b";
23 const drawingBoardAction = `RECREATE`;
24 const templateTopologyEndpoint = "templateTopology";
28 cy.route(`**/rest/models/services/${serviceModelId}`,
29 'fixture:../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json')
32 cy.route(`**/asyncInstantiation/${templateTopologyEndpoint}/${templateUuid}`,
33 'fixture:../../../vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json')
34 .as('templateTopology');
38 cy.openIframe(`app/ui/#/servicePlanning/${drawingBoardAction}` +
39 `?jobId=${templateUuid}` +
40 `&serviceModelId=${serviceModelId}`);
42 cy.wait('@serviceModel');
43 cy.wait('@templateTopology');
44 cy.getElementByDataTestsId("node-vProbe_NC_VNF 0").should('be.visible');
46 cy.getDrawingBoardDeployBtn().click();
50 cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
51 cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json').then((expectedResult) => {
52 convertRollbackOnFailureValueFromStringToBoolean(expectedResult);
53 cy.deepCompare(xhr.request.body, expectedResult);
61 //We use this function because the deployService() on drawing-board-header.component class
62 // changes rollbackOnFailure value from string type to boolean.
63 function convertRollbackOnFailureValueFromStringToBoolean(expectedResult: any) {
64 expectedResult.rollbackOnFailure = Boolean(expectedResult.rollbackOnFailure);
67 function mockAsyncBulkResponse() {
69 url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
73 }).as("expectedPostAsyncInstantiation");