blob: 1c91d02caa9a516717fd86c51f111b438ed29b47 [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2/// <reference types="Cypress" />
Ittay Stern6f900cc2018-08-29 17:01:32 +03003import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
4import {ServiceModel} from '../../support/jsonBuilders/models/service.model';
5import * as _ from 'lodash';
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03006
7describe('A la carte', function () {
8 describe('check service name', () => {
Ittay Stern6f900cc2018-08-29 17:01:32 +03009 let jsonBuilderAAIService: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
Einat Vinouzee1f79742019-08-27 16:01:01 +030010 const SERVICE_ID: string = '4d71990b-d8ad-4510-ac61-496288d9078e';
11 const SERVICE_INVARIANT_ID: string = 'd27e42cf-087e-4d31-88ac-6c4b7585f800';
12 const INSTANCE_NAME_MANDATORY_MESSAGE: string = 'Missing data ("Instance Name" and 3 other fields';
13 const INSTANCE_NAME_NOT_MANDATORY_MESSAGE: string = 'Missing data ("Subscriber Name" and 2 other fields)';
14 const CONFIRM_BUTTON: string = 'confirmButton';
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030015
16 beforeEach(() => {
Yoav Schneiderman091343a2019-11-20 16:50:45 +020017 cy.clearSessionStorage();
18 cy.setReduxState();
19 cy.preventErrorsOnLoading();
20 cy.initAAIMock();
21 cy.initVidMock();
22 cy.mockLatestVersionForService(SERVICE_ID, SERVICE_INVARIANT_ID);
23 cy.initAlaCarteService();
24 cy.initZones();
25 cy.login();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030026 });
27
Ittay Stern6f900cc2018-08-29 17:01:32 +030028 afterEach(() => {
29 cy.screenshot();
30 });
31
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030032
Yoav Schneiderman091343a2019-11-20 16:50:45 +020033 it(`service name should be mandatory : serviceEcompNaming = true`, () => {
Ittay Stern607ea3d2019-10-23 17:10:52 +030034 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicService.json').then((res) => {
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030035 jsonBuilderAAIService.basicJson(res,
Einat Vinouzee1f79742019-08-27 16:01:01 +030036 Cypress.config('baseUrl') + '/rest/models/services/' + SERVICE_ID,
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030037 200,
38 0,
39 SERVICE_ID + ' - service',
40 changeServiceEcompNamingToTrue);
Ittay Stern6f900cc2018-08-29 17:01:32 +030041 checkServiceNameInputIdMandatory();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030042 });
43 });
44
Yoav Schneiderman091343a2019-11-20 16:50:45 +020045 it(`Service a-la-carte`, () => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030046
Yoav Schneiderman091343a2019-11-20 16:50:45 +020047 const subscriptionServiceType: string = "TYLER SILVIA";
48 const owningEntityName: string = "WayneHolland";
49 const rollbackOnFailure: string = "true";
50 const projectName: string = "WATKINS";
51 const instanceName: string = "serviceInstanceName";
Ittay Stern607ea3d2019-10-23 17:10:52 +030052 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030053
54 cy.setTestApiParamToGR();
Ittay Sternf7926712019-07-07 19:23:03 +030055 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte';
Ittay Stern6f900cc2018-08-29 17:01:32 +030056 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null;
57 cy.setReduxState(<any>res);
58 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
59
60 cy.getElementByDataTestsId("openMenuBtn").click({force: true})
61 .getElementByDataTestsId("context-menu-header-edit-item").click({force: true})
62 .getElementByDataTestsId("instanceName")
63 .getElementByDataTestsId("subscriberName")
64 .getElementByDataTestsId("serviceType")
65 .getElementByDataTestsId("owningEntity")
66 .getElementByDataTestsId("project")
67 .getElementByDataTestsId("rollback");
68
69 cy.selectDropdownOptionByText("subscriberName", "SILVIA ROBBINS");
70 cy.selectDropdownOptionByText("serviceType", subscriptionServiceType);
71 cy.selectDropdownOptionByText("owningEntity", owningEntityName);
72 cy.selectDropdownOptionByText("rollback", rollbackOnFailure);
73 cy.selectDropdownOptionByText("project", projectName);
74 cy.typeToInput("instanceName", instanceName);
75
76 cy.get('#quantity-select').should('have.attr', 'disabled');
77 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
78 cy.getReduxState().then((state) => {
79 const service = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'];
80
81 cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => {
82 expect(service.subscriptionServiceType).to.equals(subscriptionServiceType);
83 expect(service.owningEntityName).to.equals(owningEntityName);
84 expect(service.rollbackOnFailure).to.equals(rollbackOnFailure);
85 expect(service.projectName).to.equals(projectName);
86 expect(service.instanceName).to.equals(instanceName);
87 });
88 });
89 });
90 });
91 });
92
Yoav Schneiderman091343a2019-11-20 16:50:45 +020093 it(`VNF a-la-carte`, () => {
94 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json').then((res) => {
95 res['FLAG_2002_VNF_PLATFORM_MULTI_SELECT'] = true;
96 cy.server()
97 .route({
98 method: 'GET',
99 delay: 0,
100 status: 200,
101 url: Cypress.config('baseUrl') + "/flags**",
102 response: res
103 }).as('initFlags with multi select');
104 });
Ittay Stern6f900cc2018-08-29 17:01:32 +0300105
Yoav Schneiderman091343a2019-11-20 16:50:45 +0200106
Ittay Stern607ea3d2019-10-23 17:10:52 +0300107 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300108 cy.setTestApiParamToGR();
Ittay Sternf7926712019-07-07 19:23:03 +0300109 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte';
Ittay Stern6f900cc2018-08-29 17:01:32 +0300110 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null;
111 cy.setReduxState(<any>res);
112 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
113
114 cy.getElementByDataTestsId("openMenuBtn").click({force: true})
115 .getElementByDataTestsId("context-menu-header-edit-item").click({force: true})
116 .getElementByDataTestsId("instanceName")
117 .getElementByDataTestsId("subscriberName")
118 .getElementByDataTestsId("serviceType")
119 .getElementByDataTestsId("owningEntity")
120 .getElementByDataTestsId("project")
121 .getElementByDataTestsId("rollback");
122
123 cy.selectDropdownOptionByText("subscriberName", "SILVIA ROBBINS");
124 cy.selectDropdownOptionByText("serviceType", "TYLER SILVIA");
125 cy.selectDropdownOptionByText("owningEntity", "WayneHolland");
126 cy.selectDropdownOptionByText("rollback", "true");
127 cy.selectDropdownOptionByText("project", "WATKINS");
128 cy.typeToInput("instanceName", "serviceInstanceName");
129
130 cy.get('#quantity-select').should('have.attr', 'disabled');
131 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
Ittay Sternf7926712019-07-07 19:23:03 +0300132 cy.getElementByDataTestsId('node-2017-488_PASQUALE-vPE 0-add-btn').click({force: true}).then(() => {
Yoav Schneiderman091343a2019-11-20 16:50:45 +0200133
Ittay Stern6f900cc2018-08-29 17:01:32 +0300134 cy.selectDropdownOptionByText('productFamily', 'Emanuel');
Ittay Sternf7926712019-07-07 19:23:03 +0300135 cy.selectDropdownOptionByText('lcpRegion', 'AAIAIC25');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300136 cy.typeToInput("lcpRegionText", "just another region");
137 cy.selectDropdownOptionByText('tenant', 'USP-SIP-IC-24335-T-01');
138 cy.selectDropdownOptionByText('lineOfBusiness', 'zzz1');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300139
Alexey Sandler77dd4862019-12-05 17:04:45 +0200140 cy.selectPlatformValue('xxx1');
Yoav Schneiderman091343a2019-11-20 16:50:45 +0200141
142 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
143
144 const vnfMenuBtnDataTestId = 'node-69e09f68-8b63-4cc9-b9ff-860960b5db09-2017-488_PASQUALE-vPE 0-menu-btn';
145
146 cy.getElementByDataTestsId(vnfMenuBtnDataTestId).click({force: true}).then(() => {
147 cy.getElementByDataTestsId('context-menu-edit').click({force: true});
Alexey Sandler77dd4862019-12-05 17:04:45 +0200148 cy.selectPlatformValue('platform');
Yoav Schneiderman091343a2019-11-20 16:50:45 +0200149 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
150 cy.getReduxState().then((state) => {
151
152 const vnf = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs['2017-488_PASQUALE-vPE 0'];
153 cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => {
154 file.vnfs['2017-488_PASQUALE-vPE 0'].trackById = vnf.trackById;
155 file.vnfs['2017-488_PASQUALE-vPE 0'].vfModules = {};
156 file.vnfs['2017-488_PASQUALE-vPE 0'].upgradedVFMSonsCounter = 0;
157 cy.deepCompare(vnf, file.vnfs['2017-488_PASQUALE-vPE 0'])
158 });
159 });
Ittay Stern6f900cc2018-08-29 17:01:32 +0300160 });
161 });
162 });
Ittay Stern6f900cc2018-08-29 17:01:32 +0300163 });
164 });
165 });
166 });
167
Yoav Schneiderman091343a2019-11-20 16:50:45 +0200168 it(`Network a-la-carte`, () => {
Ittay Stern607ea3d2019-10-23 17:10:52 +0300169 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300170 cy.setTestApiParamToGR();
Ittay Sternf7926712019-07-07 19:23:03 +0300171 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte';
Ittay Stern6f900cc2018-08-29 17:01:32 +0300172 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null;
173 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].networks = {
174 "ExtVL 0": {
175 "uuid": "ddc3f20c-08b5-40fd-af72-c6d14636b986",
176 "invariantUuid": "379f816b-a7aa-422f-be30-17114ff50b7c",
177 "description": "ECOMP generic virtual link (network) base type for all other service-level and global networks",
178 "name": "ExtVL",
179 "version": "37.0",
180 "customizationUuid": "94fdd893-4a36-4d70-b16a-ec29c54c184f",
181 "inputs": {},
182 "commands": {},
183 "properties": {
184 "network_assignments": "{is_external_network=false, ipv4_subnet_default_assignment={min_subnets_count=1}, ecomp_generated_network_assignment=false, ipv6_subnet_default_assignment={min_subnets_count=1}}",
185 "ecomp_generated_naming": "false",
186 "exVL_naming": "{ecomp_generated_naming=true}",
187 "network_flows": "{is_network_policy=false, is_bound_to_vpn=false}",
188 "network_homing": "{ecomp_selected_instance_node_target=false}"
189 },
190 "type": "VL",
191 "modelCustomizationName": "ExtVL 0"
192 }
193 };
194 res.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].networks = {};
195 cy.setReduxState(<any>res);
196 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
197 cy.getElementByDataTestsId("node-ExtVL 0-add-btn").click({force: true});
Yoav Schneiderman091343a2019-11-20 16:50:45 +0200198
Alexey Sandler77dd4862019-12-05 17:04:45 +0200199 cy.selectDropdownOptionByText("platform", "xxx1");
Ittay Sternf7926712019-07-07 19:23:03 +0300200 cy.selectDropdownOptionByText("lcpRegion", "AAIAIC25");
Ittay Stern6f900cc2018-08-29 17:01:32 +0300201 cy.selectDropdownOptionByText("tenant", "USP-SIP-IC-24335-T-01");
Ittay Sternf7926712019-07-07 19:23:03 +0300202 cy.selectDropdownOptionByText("productFamily", "ERICA");
Ittay Stern6f900cc2018-08-29 17:01:32 +0300203 cy.selectDropdownOptionByText("lineOfBusiness", "zzz1");
204 cy.typeToInput("lcpRegionText", "lcpRegionText");
205
206 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
207 cy.getReduxState().then((state) => {
208 const network = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].networks['ExtVL 0'];
209
210 cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => {
211 file.networks['ExtVL 0'].trackById = network.trackById;
212 cy.deepCompare(network, file.networks['ExtVL 0']);
213 });
214 });
215 });
216 });
217 });
218
Yoav Schneiderman091343a2019-11-20 16:50:45 +0200219 it(`VFModule a-la-carte`, () => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300220 var timeBomb = new Date('12/09/2018');
221 if (new Date() < timeBomb) {
222 return;
223 }
Ittay Stern607ea3d2019-10-23 17:10:52 +0300224 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300225 cy.setTestApiParamToGR();
Ittay Sternf7926712019-07-07 19:23:03 +0300226 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte';
Ittay Stern6f900cc2018-08-29 17:01:32 +0300227 res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null;
228 cy.setReduxState(<any>res);
229 cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd');
230
Ittay Sternf7926712019-07-07 19:23:03 +0300231 cy.getElementByDataTestsId('node-2017-488_PASQUALE-vPE 0-add-btn').click({force: true}).then(() => {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300232 cy.selectDropdownOptionByText('productFamily', 'Emanuel');
233 cy.selectDropdownOptionByText('lcpRegion', 'hvf6');
234 cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-STTest2');
235 cy.selectDropdownOptionByText('lineOfBusiness', 'zzz1');
Alexey Sandler77dd4862019-12-05 17:04:45 +0200236 cy.selectPlatformValue('xxx1');
Ittay Stern6f900cc2018-08-29 17:01:32 +0300237 cy.getElementByDataTestsId('form-set').click({force: true}).then(() => {
Ittay Sternf7926712019-07-07 19:23:03 +0300238 const vnfName = '2017-488_PASQUALE-vPE 0';
Ittay Stern6f900cc2018-08-29 17:01:32 +0300239 let vfModulesNames: Array<string> = [
Ittay Sternf7926712019-07-07 19:23:03 +0300240 '2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0',
241 '2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1',
242 '2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2',
Ittay Stern6f900cc2018-08-29 17:01:32 +0300243 ];
244
245 addVfModule(vnfName, vfModulesNames[0], 'mimazepubi', 'hvf6', '', 'AINWebTool-15-D-iftach', false, false, false)
246 .then(() => {
Ittay Sternf7926712019-07-07 19:23:03 +0300247 addVfModule(vnfName, vfModulesNames[1], 'puwesovabe', 'AAIAIC25', 'my region', 'USP-SIP-IC-24335-T-01', true, true, false)
Ittay Stern6f900cc2018-08-29 17:01:32 +0300248 .then(() => {
249 addVfModule(vnfName, vfModulesNames[2], 'bnmgtrx', 'hvf6', '', 'AINWebTool-15-D-iftach', false, false, true)
250 .then(() => {
251 cy.getReduxState().then((state) => {
252 const vfModules = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs[vnfName].vfModules;
253 cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => {
254 for (let vfModulesName of vfModulesNames) {
255 const vfModule = vfModules[vfModulesName];
256 let vfModuleObject = vfModule[Object.keys(vfModule)[0]];
Einat Vinouzee1f79742019-08-27 16:01:01 +0300257 file.vnfs[vnfName].vfModules[vfModulesName][vfModulesName].action = "Create";
Ittay Stern6f900cc2018-08-29 17:01:32 +0300258 cy.deepCompare(vfModuleObject, file.vnfs[vnfName].vfModules[vfModulesName][vfModulesName]);
259 }
260 });
261 });
262 });
263 });
264 });
265 });
266 });
267 });
268 });
269
270
271 function changeServiceEcompNamingToTrue(obj: ServiceModel) {
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300272 obj.service.serviceEcompNaming = "true";
273 return obj;
274 }
275
Ittay Stern6f900cc2018-08-29 17:01:32 +0300276 function checkServiceNameInputIdMandatory() {
Ittay Stern7befef82019-07-11 15:54:36 +0300277 cy.get('span').contains('Browse SDC Service Models').click({force: true})
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300278 .getElementByDataTestsId('deploy-' + SERVICE_ID).click({force: true})
279 .wait(1000).getElementByDataTestsId(CONFIRM_BUTTON).click({force: true})
280 .get('.error').contains(INSTANCE_NAME_MANDATORY_MESSAGE)
281 .typeToInput('instanceName', 'testService');
282
283 cy.getElementByDataTestsId(CONFIRM_BUTTON).click({force: true})
284 .get('.error').contains(INSTANCE_NAME_NOT_MANDATORY_MESSAGE);
285 }
Ittay Stern6f900cc2018-08-29 17:01:32 +0300286
Yoav Schneiderman091343a2019-11-20 16:50:45 +0200287 function addVfModule(vnfName: string, vfModuleName: string, instanceName: string, lcpRegion: string, legacyRegion: string, tenant: string, rollback: boolean, sdncPreLoad: boolean, deleteVgName: boolean): Chainable<any> {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300288 return cy.getElementByDataTestsId('node-' + vnfName).click({force: true}).then(() => {
289 cy.getElementByDataTestsId('node-' + vfModuleName + '-add-btn').click({force: true}).then(() => {
290 cy.getElementByDataTestsId('instanceName').clear().type(instanceName, {force: true}).then(() => {
291 if (deleteVgName) {
292 cy.getElementByDataTestsId('volumeGroupName').clear();
293 }
294 }).then(() => {
295 cy.selectDropdownOptionByText('lcpRegion', lcpRegion);
296 if (!_.isEmpty(legacyRegion)) {
297 cy.typeToInput("lcpRegionText", legacyRegion);
298 }
299 cy.selectDropdownOptionByText('tenant', tenant);
300 cy.selectDropdownOptionByText('rollback', String(rollback));
301 if (sdncPreLoad) {
302 cy.getElementByDataTestsId('sdncPreLoad').check();
303 }
304 cy.getElementByDataTestsId('form-set').click({force: true});
305 });
306 });
307 });
308 }
309
Einat Vinouzee1f79742019-08-27 16:01:01 +0300310
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +0300311 });
312});