summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardRecreate.steps.ts
blob: 16f418bc9b82eb23eef60f53103b84e572300dcb (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
declare namespace Cypress {
  interface Chainable {
    loadDrawingBoardWithRecreateMode: typeof loadDrawingBoardWithRecreateMode ,
    loadDrawingBoardWithRecreateModeNetwork: typeof loadDrawingBoardWithRecreateModeNetwork,
    loadDrawingBoardWithRecreateModeInternal: typeof loadDrawingBoardWithRecreateModeInternal
  }
}

function loadDrawingBoardWithRecreateMode(templateWithVnfSetup : any) {
  cy.loadDrawingBoardWithRecreateModeInternal(
    '../../' + templateWithVnfSetup.instanceTemplateFile,
    templateWithVnfSetup.serviceModelId,
    templateWithVnfSetup.serviceModelFile);
}

function loadDrawingBoardWithRecreateModeNetwork(templateWithNetworkSetup : any) {
  cy.loadDrawingBoardWithRecreateModeInternal(
    '../../' + templateWithNetworkSetup.instanceTemplateFile,
    templateWithNetworkSetup.serviceModelId,
    templateWithNetworkSetup.serviceModelFile);
}

function loadDrawingBoardWithRecreateModeInternal(instanceTemplate: string, serviceModelIdToLoad: any, serviceModel: string) {
  const templateUuid = "46390edd-7100-46b2-9f18-419bd24fb60b";

  const drawingBoardAction = `RECREATE`;
  const templateTopologyEndpoint = "templateTopology";
  cy.route(`**/rest/models/services/${serviceModelIdToLoad}`,
    'fixture:' + serviceModel)
    .as('serviceModel');

  cy.route(`**/instantiationTemplates/${templateTopologyEndpoint}/${templateUuid}`,
    'fixture:' + instanceTemplate)
    .as('templateTopology');

  // When...

  cy.openIframe(`app/ui/#/servicePlanning/${drawingBoardAction}` +
    `?jobId=${templateUuid}` +
    `&serviceModelId=${serviceModelIdToLoad}`);

  cy.wait('@serviceModel');
  cy.wait('@templateTopology');
}





Cypress.Commands.add('loadDrawingBoardWithRecreateMode', loadDrawingBoardWithRecreateMode);
Cypress.Commands.add('loadDrawingBoardWithRecreateModeNetwork', loadDrawingBoardWithRecreateModeNetwork);
Cypress.Commands.add('loadDrawingBoardWithRecreateModeInternal', loadDrawingBoardWithRecreateModeInternal);