summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/support
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master/cypress/support')
-rw-r--r--vid-webpack-master/cypress/support/application/application.session.actions.ts35
-rw-r--r--vid-webpack-master/cypress/support/index.js5
-rw-r--r--vid-webpack-master/cypress/support/jsonBuilders/mocks/aai.mock.ts15
-rw-r--r--vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/aaiGetModelsByServiceType.json58
-rw-r--r--vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json2
-rw-r--r--vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json5
-rw-r--r--vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json2
-rw-r--r--vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardRecreate.steps.ts52
-rw-r--r--vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts37
-rw-r--r--vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts12
-rw-r--r--vid-webpack-master/cypress/support/uploadFiles/sdncPreLoadFileExample.json3
11 files changed, 179 insertions, 47 deletions
diff --git a/vid-webpack-master/cypress/support/application/application.session.actions.ts b/vid-webpack-master/cypress/support/application/application.session.actions.ts
index c054b2640..9126ae1a4 100644
--- a/vid-webpack-master/cypress/support/application/application.session.actions.ts
+++ b/vid-webpack-master/cypress/support/application/application.session.actions.ts
@@ -5,7 +5,6 @@ declare namespace Cypress {
clearSessionStorage: typeof clearSessionStorage;
setTestApiParamToGR: typeof setTestApiParamToGR;
setTestApiParamToVNF: typeof setTestApiParamToVNF;
- buildReduxStateWithServiceRespone: typeof buildReduxStateWithServiceRespone;
}
}
@@ -44,42 +43,8 @@ function setTestApiParamToVNF() : void {
});
}
-function updateObject(obj: any, key: string, val: any, value:any) {
- return JSON.parse(JSON.stringify(obj)
- .replace(new RegExp(`"${key}":"${val}"`), `"${key}":"${value}"`))
-}
-
-function buildReduxStateWithServiceRespone(res: any, serviceId:string, isEcompGeneratedNaming:boolean) :void {
- res = updateObject(res, "ecomp_generated_naming", !isEcompGeneratedNaming, isEcompGeneratedNaming);
- cy.window().then((win) => {
- win.sessionStorage.setItem('reduxState', JSON.stringify({
- "global": {
- "name": null
- },
- "service": {
- "serviceHierarchy": {
- [serviceId] : res
- },
- "serviceInstance": {
- [serviceId]: {
- "existingVNFCounterMap": {},
- "existingVnfGroupCounterMap": {},
- "existingNetworksCounterMap": {},
- "vnfs": {},
- "vnfGroups": {},
- "isEcompGeneratedNaming": isEcompGeneratedNaming,
- "existingNames": {},
- "vidNotions": res.service.vidNotions
- }
- }
- }
- }));
- });
-}
-
Cypress.Commands.add('setReduxState', setReduxState);
Cypress.Commands.add('getReduxState', getReduxState);
Cypress.Commands.add('clearSessionStorage', clearSessionStorage);
Cypress.Commands.add('setTestApiParamToGR', setTestApiParamToGR);
Cypress.Commands.add('setTestApiParamToVNF',setTestApiParamToVNF);
-Cypress.Commands.add('buildReduxStateWithServiceRespone', buildReduxStateWithServiceRespone);
diff --git a/vid-webpack-master/cypress/support/index.js b/vid-webpack-master/cypress/support/index.js
index 5062f5100..d9e64c0f5 100644
--- a/vid-webpack-master/cypress/support/index.js
+++ b/vid-webpack-master/cypress/support/index.js
@@ -15,6 +15,7 @@
// Import commands.js using ES2015 syntax:
import './commands';
+import 'cypress-file-upload';
import './steps/login.step';
import './steps/fill.service.popup.step';
import './steps/fill.vnf.popup.step';
@@ -36,12 +37,14 @@ import './steps/drawingBoard/drawingBoardModel.steps';
import './steps/drawingBoard/drawingBoardTree.steps';
import './steps/genericForm/genericFormAction.steps';
import './steps/genericForm/popupViewport.step';
-import './steps/drawingBoard/drawingBoardHeader.steps';
import './steps/drawingBoard/general.steps';
+import './steps/drawingBoard/drawingBoardRecreate.steps';
+import './steps/drawingBoard/drawingBoardHeader.steps';
import './steps/general/clickOutside.step';
import './steps/drawingBoard/drawingBoardComponentInfo.steps';
import './steps/genericForm/checkPopover.step';
+
// Alternatively you can use CommonJS syntax:
// require('./commands')
diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/aai.mock.ts b/vid-webpack-master/cypress/support/jsonBuilders/mocks/aai.mock.ts
index ae60361c2..807a3bcda 100644
--- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/aai.mock.ts
+++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/aai.mock.ts
@@ -9,6 +9,7 @@ declare namespace Cypress {
initActiveVPNs : typeof initActiveVPNs;
initGetAAISubDetails : typeof initGetAAISubDetails;
initAAIServices: typeof initAAIServices;
+ initGetModelByServiceType: typeof initGetModelByServiceType;
}
}
@@ -48,6 +49,19 @@ function initGetAAISubDetails(response? : JSON) : void {
});
}
+function initGetModelByServiceType(response? : JSON) : void {
+ cy.readFile('cypress/support/jsonBuilders/mocks/jsons/aaiSubDetails.json').then((res) => {
+ cy.server()
+ .route({
+ method: 'GET',
+ status: 200,
+ url: Cypress.config('baseUrl') + "/aai_get_models_by_service_type/**",
+ response: response ? response : res
+ }).as('aai-sub-details')
+ });
+}
+
+
function initAlaCarteService(response? : JSON) : void {
cy.readFile('cypress/support/jsonBuilders/mocks/jsons/a-la-carteService.json').then((res) => {
cy.server()
@@ -156,6 +170,7 @@ Cypress.Commands.add('initSearchVNFMemebers', initSearchVNFMemebers);
Cypress.Commands.add('initActiveNetworks', initActiveNetworks);
Cypress.Commands.add('initActiveVPNs', initActiveVPNs);
Cypress.Commands.add('initAAIServices', initAAIServices);
+Cypress.Commands.add('initGetModelByServiceType', initGetModelByServiceType);
diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/aaiGetModelsByServiceType.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/aaiGetModelsByServiceType.json
new file mode 100644
index 000000000..2540650ce
--- /dev/null
+++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/aaiGetModelsByServiceType.json
@@ -0,0 +1,58 @@
+{
+ "inventory-response-item": [
+ {
+ "service-subscription": {
+ "service-type": "TYLER SILVIA",
+ "resource-version": "1494001841964"
+ },
+ "extra-properties": {},
+ "inventory-response-items": {
+ "inventory-response-item":[
+ {
+ "model-name": "RG_11-18_vccf_srvc",
+ "service-instance": {
+ "service-instance-id": "b9769e8f-70aa-4b05-8988-64044aa63498",
+ "service-instance-name": "TestCharlie",
+ "model-invariant-id": "4af418a9-c2f5-4fae-a577-b69d6341eee8",
+ "model-version-id": "745d1bf1-9ed1-413f-8111-f1e984ad63fb",
+ "resource-version": "1494002070115"
+ },
+ "extra-properties": {
+ "extra-property": [
+ {
+ "property-name": "model-ver.model-description",
+ "property-value": "Service for vccf"
+ },
+ {
+ "property-name": "model-ver.model-version-id",
+ "property-value": "745d1bf1-9ed1-413f-8111-f1e984ad63fb"
+ },
+ {
+ "property-name": "model-ver.model-name",
+ "property-value": "RG_11-18_vccf_srvc"
+ },
+ {
+ "property-name": "model.model-type",
+ "property-value": "service"
+ },
+ {
+ "property-name": "model.model-invariant-id",
+ "property-value": "4af418a9-c2f5-4fae-a577-b69d6341eee8"
+ },
+ {
+ "property-name": "model.model-description"
+ },
+ {
+ "property-name": "model-ver.model-version",
+ "property-value": "1.0"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+}
+
+
diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json
index d10c2bd32..d0c734bc2 100644
--- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json
+++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/defect710619/expectedResumeWithVGResults.json
@@ -17,7 +17,7 @@
},
"requestParameters": {
"userParams": [],
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"usePreload": false
},
"cloudConfiguration": {
diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json
index 531bad3b4..d9602d139 100644
--- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json
+++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json
@@ -19,9 +19,10 @@
"FLAG_1911_INSTANTIATION_ORDER_BUTTON_IN_ASYNC_ALACARTE": false,
"FLAG_2002_VNF_PLATFORM_MULTI_SELECT" : true,
"FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS": true,
- "FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER": true,
"FLAG_2004_INSTANTIATION_STATUS_FILTER": true,
"FLAG_2004_INSTANTIATION_TEMPLATES_POPUP" : false,
"FLAG_2002_UNLIMITED_MAX" : true,
- "FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE": true
+ "FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE": true,
+ "FLAG_2006_VFM_SDNC_PRELOAD_FILES" : true,
+ "FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF": true
}
diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json
index bc37b6bed..847ebf0d5 100644
--- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json
+++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/vnfGroupBasicServiceInstance.json
@@ -32,7 +32,7 @@
"subscriberName":"SILVIA ROBBINS",
"owningEntityName":"WayneHolland",
"rollbackOnFailure":"true",
- "testApi": "VNF_API",
+ "testApi": "GR_API",
"isALaCarte":true,
"action": "Create"
}
diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardRecreate.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardRecreate.steps.ts
new file mode 100644
index 000000000..16f418bc9
--- /dev/null
+++ b/vid-webpack-master/cypress/support/steps/drawingBoard/drawingBoardRecreate.steps.ts
@@ -0,0 +1,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);
diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts
index 8d2bb8a24..797fff095 100644
--- a/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts
+++ b/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts
@@ -1,7 +1,10 @@
declare namespace Cypress {
interface Chainable {
updateServiceShouldNotOverrideChild: typeof updateServiceShouldNotOverrideChild
- openServiceContextMenu: typeof openServiceContextMenu
+ openServiceContextMenu: typeof openServiceContextMenu,
+ drawingBoardTreeClickOnContextMenuOptionByName : typeof drawingBoardTreeClickOnContextMenuOptionByName,
+ nodeAction: typeof nodeAction,
+ editNode : typeof editNode
}
}
@@ -18,7 +21,6 @@ function updateServiceShouldNotOverrideChild() : void {
});
});
});
-
}
@@ -26,5 +28,36 @@ function openServiceContextMenu() : Chainable<any> {
return cy.getElementByDataTestsId('openMenuBtn').click({force: true});
}
+function nodeAction(dataTestId: string, action: string, index ?: number) {
+ return cy.drawingBoardTreeOpenContextMenuByElementDataTestId(dataTestId, index)
+ .drawingBoardTreeClickOnContextMenuOptionByName(action)
+}
+
+function drawingBoardTreeClickOnContextMenuOptionByName(optionName : string) : Chainable<any> {
+ switch (optionName) {
+ case 'Duplicate':
+ return cy.getElementByDataTestsId('context-menu-duplicate').click({force : true});
+ case 'Remove':
+ return cy.getElementByDataTestsId('context-menu-remove').click({force : true});
+ case 'Edit':
+ return cy.getElementByDataTestsId('context-menu-edit').click({force : true});
+ case 'Delete':
+ return cy.getElementByDataTestsId('context-menu-delete').trigger('mouseover').click();
+ case 'Upgrade':
+ return cy.getElementByDataTestsId('context-menu-upgrade').trigger('mouseover').click();
+ case 'Undo Upgrade':
+ return cy.getElementByDataTestsId('context-menu-undoUpgrade').trigger('mouseover').click();
+ default:
+ return cy.getElementByDataTestsId('context-menu-duplicate').click({force : true});
+ }
+}
+
+function editNode(dataTestId: string, index ?: number) {
+ return cy.nodeAction(dataTestId, 'Edit', index);
+}
+
Cypress.Commands.add('updateServiceShouldNotOverrideChild', updateServiceShouldNotOverrideChild);
Cypress.Commands.add('openServiceContextMenu', openServiceContextMenu);
+Cypress.Commands.add('drawingBoardTreeClickOnContextMenuOptionByName', drawingBoardTreeClickOnContextMenuOptionByName);
+Cypress.Commands.add('nodeAction', nodeAction);
+Cypress.Commands.add('editNode', editNode);
diff --git a/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts b/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts
index b87e773f9..cfb8a050a 100644
--- a/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts
+++ b/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts
@@ -34,7 +34,7 @@ function addMacroVfModule(vnfName: string, vfModuleName: string, instanceName: s
}
function addALaCarteVfModule(vnfName: string, vfModuleName: string, instanceName: string, lcpRegion: string, legacyRegion: string,
- tenant: string, rollback: boolean, sdncPreLoad: boolean, deleteVgName: boolean): Chainable<any> {
+ tenant: string, rollback: boolean, sdncPreLoad: boolean, deleteVgName: boolean, flag: boolean): Chainable<any> {
return cy.getElementByDataTestsId('node-' + vnfName).click({force: true}).then(() => {
cy.getElementByDataTestsId('node-' + vfModuleName + '-add-btn').click({force: true}).then(() => {
cy.getElementByDataTestsId('instanceName').clear().type(instanceName, {force: true}).then(() => {
@@ -42,11 +42,13 @@ function addALaCarteVfModule(vnfName: string, vfModuleName: string, instanceName
cy.getElementByDataTestsId('volumeGroupName').clear();
}
}).then(() => {
- cy.selectDropdownOptionByText('lcpRegion', lcpRegion);
- if (legacyRegion) {
- cy.typeToInput("lcpRegionText", legacyRegion);
+ if(!flag) {
+ cy.selectDropdownOptionByText('lcpRegion', lcpRegion);
+ if (legacyRegion) {
+ cy.typeToInput("lcpRegionText", legacyRegion);
+ }
+ cy.selectDropdownOptionByText('tenant', tenant);
}
- cy.selectDropdownOptionByText('tenant', tenant);
cy.selectDropdownOptionByText('rollback', String(rollback));
if (sdncPreLoad) {
cy.getElementByDataTestsId('sdncPreLoad').check();
diff --git a/vid-webpack-master/cypress/support/uploadFiles/sdncPreLoadFileExample.json b/vid-webpack-master/cypress/support/uploadFiles/sdncPreLoadFileExample.json
new file mode 100644
index 000000000..c317c4183
--- /dev/null
+++ b/vid-webpack-master/cypress/support/uploadFiles/sdncPreLoadFileExample.json
@@ -0,0 +1,3 @@
+{
+ "comment" : "invalid file, just for upload mock file"
+}