summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/integration
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-12-31 15:01:27 +0200
committerIttay Stern <ittay.stern@att.com>2019-12-31 16:17:43 +0200
commita4b0a6094174e03611f1a3e5b1a6b34871d8cecd (patch)
tree274faae01b4a61c6dbc1ae88cbc493b81e6df5ff /vid-webpack-master/cypress/integration
parent5a6827854508ed8e0cbfb0611cb5261b8564b0be (diff)
Add a reference-template with 2 templated Networks
Issue-ID: VID-724 Change-Id: I412d7fb7a8c2a265d26a68c9d15565d726f2ae8f Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/cypress/integration')
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts62
1 files changed, 54 insertions, 8 deletions
diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts
index a73576d9a..1da12a55d 100644
--- a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts
@@ -155,7 +155,7 @@ describe('Drawing Board: Instantiation Templates', function () {
...vnfPath, "vfModules", module1CustomizationId,
];
- let serviceInstanceElementOnRedux = state.service.serviceInstance[serviceModelId];
+ let serviceInstanceElementOnRedux = state.service.serviceInstance[(templateWithVnfSetup.serviceModelId)];
let latestVfModule_1Path = findPathOfLatestVfModule(serviceInstanceElementOnRedux, vfModules_1Path);
// This is a funny merge, as values are already there, but that way ensures
@@ -236,34 +236,72 @@ describe('Drawing Board: Instantiation Templates', function () {
});
+ it(`Given a stored template of Network - - it is loaded`, () => {
+
+ loadDrawingBoardWithRecreateModeNetwork();
+
+ // Then...
+ cy.getElementByDataTestsId("node-SR-IOV Provider 2-1").should('be.visible');
+ cy.getElementByDataTestsId("node-SR-IOV Provider 2-2").should('be.visible');
+ assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd_network();
+ });
+
+
});
});
});
-const serviceModelId = '6cfeeb18-c2b0-49df-987a-da47493c8e38';
+let apiTestResources = '../vid-automation/src/test/resources/asyncInstantiation/';
+
+const templateWithVnfSetup = {
+ serviceModelId: '6cfeeb18-c2b0-49df-987a-da47493c8e38',
+ instanceTemplateFile: apiTestResources + 'templates__instance_template.json',
+ instanceTemplateSetWithoutModifyFile: apiTestResources + 'templates__instance_from_template__set_without_modify1.json',
+ serviceModelFile: '../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json',
+};
+
+const templateWithNetworkSetup = {
+ serviceModelId: 'a1a14610-ee40-4049-8007-0608a20dd1fa',
+ instanceTemplateFile: apiTestResources + 'templates__instance_template_network.json',
+ serviceModelFile: '../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model_network.json',
+};
const vnfPath = [
"vnfs", "vProbe_NC_VNF 0"
];
function loadDrawingBoardWithRecreateMode() {
+ loadDrawingBoardWithRecreateModeInternal(
+ '../../' + templateWithVnfSetup.instanceTemplateFile,
+ templateWithVnfSetup.serviceModelId,
+ templateWithVnfSetup.serviceModelFile);
+}
+
+function loadDrawingBoardWithRecreateModeNetwork() {
+ 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/${serviceModelId}`,
- 'fixture:../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json')
+ cy.route(`**/rest/models/services/${serviceModelIdToLoad}`,
+ 'fixture:' + serviceModel)
.as('serviceModel');
cy.route(`**/instantiationTemplates/${templateTopologyEndpoint}/${templateUuid}`,
- 'fixture:../../../vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json')
+ 'fixture:' + instanceTemplate)
.as('templateTopology');
// When...
cy.openIframe(`app/ui/#/servicePlanning/${drawingBoardAction}` +
`?jobId=${templateUuid}` +
- `&serviceModelId=${serviceModelId}`);
+ `&serviceModelId=${serviceModelIdToLoad}`);
cy.wait('@serviceModel');
cy.wait('@templateTopology');
@@ -288,9 +326,17 @@ function removeVNFWithVFModules(dataTestId: string) {
}
function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd(deviationFromExpected: { path: PropertyPath, value: any }[] = []) {
+ assertThatBodyFromDeployRequestEqualsToTemplateFromBackEndInternal(templateWithVnfSetup.instanceTemplateFile, deviationFromExpected);
+}
+
+function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd_network(deviationFromExpected: { path: PropertyPath, value: any }[] = []) {
+ assertThatBodyFromDeployRequestEqualsToTemplateFromBackEndInternal(templateWithNetworkSetup.instanceTemplateFile, deviationFromExpected);
+}
+
+function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEndInternal(filePathOfExpected: string, deviationFromExpected: { path: PropertyPath; value: any }[]) {
cy.getDrawingBoardDeployBtn().click();
cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
- cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json').then((expectedResult) => {
+ cy.readFile(filePathOfExpected).then((expectedResult) => {
convertRollbackOnFailureValueFromStringToBoolean(expectedResult);
let xhrBodyWithoutIsDirtyField = removeIsDirtyFieldFromXhrRequestBody(xhr);
@@ -305,7 +351,7 @@ function assertThatBodyFromDeployRequestEqualsToFile(deviationFromExpected: { pa
cy.getDrawingBoardDeployBtn().click();
cy.wait('@expectedPostAsyncInstantiation').then(xhr => {
- cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json').then((expectedResult) => {
+ cy.readFile(templateWithVnfSetup.instanceTemplateSetWithoutModifyFile).then((expectedResult) => {
setDeviationInExpected(expectedResult, deviationFromExpected);
cy.deepCompare(xhr.request.body, expectedResult);
});