blob: dd17e7db5a1931ebcbbd321b85cea09748b1bc15 [file] [log] [blame]
Yoav Schneiderman26034812019-12-03 12:55:39 +02001///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2describe('Template', () => {
3
Yoav Schneiderman89de17b2019-12-18 21:04:38 +02004 const instantiationTemplates = [
Sara Weissd6c85042019-12-12 13:45:32 +02005 {
6 "id": 8,
7 "created": 1525075968000,
8 "modified": 1525075971000,
9 "action": "INSTANTIATE",
10 "createdId": null,
11 "modifiedId": null,
12 "rowNum": null,
13 "auditUserId": null,
14 "auditTrail": null,
15 "jobId": "5c2cd8e5-27d0-42e3-85a1-85db5eaba459",
16 "templateId": "d42ba7c8-9e19-4e34-ae2c-d8af3f24498e",
17 "userId": "16807000",
18 "aLaCarte": false,
19 "msoRequestId": "c0011670-0e1a-4b74-945d-8bf5aede1d9c",
20 "jobStatus": "FAILED",
21 "statusModifiedDate": 1525075968000,
22 "hidden": false,
23 "pause": false,
24 "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
25 "owningEntityName": "WayneHolland",
26 "project": "WATKINS",
27 "aicZoneId": "NFT1",
28 "aicZoneName": "NFTJSSSS-NFT1",
29 "tenantId": "bae71557c5bb4d5aac6743a4e5f1d054",
30 "tenantName": "AIN Web Tool-15-D-testalexandria",
31 "regionId": "hvf6",
32 "regionName": null,
33 "serviceType": "TYLER SILVIA",
34 "subscriberName": "e433710f-9217-458d-a79d-1c7aff376d89",
35 "serviceInstanceId": null,
36 "serviceInstanceName": "nWUfl instance name_002",
37 "serviceModelId": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0",
38 "serviceModelName": "action-data",
39 "serviceModelVersion": "1.0",
40 "createdBulkDate": 1525075968000,
Alexey Sandler31b3d532019-12-24 21:15:40 +020041 "isRetryEnabled": true,
42 "requestSummary": {
Alexey Sandlerf3174642019-12-25 16:01:38 +020043 "vnf": 1,
44 "vfModule": 2,
45 "volumeGroup": 1
Alexey Sandler31b3d532019-12-24 21:15:40 +020046 }
Yoav Schneidermaneafbe7e2019-12-17 22:10:31 +020047 },
48 {
49 "id": 7,
50 "created": 1525075968000,
51 "modified": 1525075971000,
52 "action": "INSTANTIATE",
53 "createdId": null,
54 "modifiedId": null,
55 "rowNum": null,
56 "auditUserId": null,
57 "auditTrail": null,
58 "jobId": "13063a83-924e-4500-a3a1-e53d1b58450b",
59 "templateId": "d42ba7c8-9e19-4e34-ae2c-d8af3f24498e",
60 "userId": "17807000",
61 "aLaCarte": false,
62 "msoRequestId": "c0011670-0e1a-4b74-945d-8bf5aede1d9d",
63 "jobStatus": "IN_PROGRESS",
64 "statusModifiedDate": 1525075968000,
65 "hidden": false,
66 "pause": false,
67 "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
68 "owningEntityName": "WayneHolland",
69 "project": "WATKINS",
70 "aicZoneId": "NFT1",
71 "aicZoneName": "NFTJSSSS-NFT1",
72 "tenantId": "bae71557c5bb4d5aac6743a4e5f1d054",
73 "tenantName": "AIN Web Tool-15-D-testalexandria",
74 "regionId": "hvf6",
75 "regionName": null,
76 "serviceType": "TYLER SILVIA",
77 "subscriberName": "e433710f-9217-458d-a79d-1c7aff376d89",
78 "serviceInstanceId": null,
79 "serviceInstanceName": "nWUfl instance name_001",
80 "serviceModelId": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0",
81 "serviceModelName": "action-data",
82 "serviceModelVersion": "1.0",
83 "createdBulkDate": 1525075968000,
84 "isRetryEnabled": false
Sara Weissd6c85042019-12-12 13:45:32 +020085 }
86 ];
87
Yoav Schneiderman26034812019-12-03 12:55:39 +020088 beforeEach(() => {
89 cy.clearSessionStorage();
90 cy.setReduxState();
91 cy.preventErrorsOnLoading();
92 cy.initAAIMock();
93 cy.initVidMock();
94 cy.login();
Sara Weissd6c85042019-12-12 13:45:32 +020095
96 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json').then((flags) => {
97 cy.server()
98 .route({
99 method: 'GET',
100 delay: 0,
101 status: 200,
102 url: Cypress.config('baseUrl') + "/flags**",
103 response: {
104 "FLAG_VF_MODULE_RESUME_STATUS_CREATE": false,
105 "FLAG_2004_INSTANTIATION_TEMPLATES_POPUP": true
106 }
107 }).as('initFlags');
108 });
109
Yoav Schneiderman89de17b2019-12-18 21:04:38 +0200110 cy.route(Cypress.config('baseUrl') + "/instantiationTemplates**", instantiationTemplates);
Yoav Schneidermaneafbe7e2019-12-17 22:10:31 +0200111 cy.route(Cypress.config('baseUrl') + "/getuserID", '16807000');
Sara Weissd6c85042019-12-12 13:45:32 +0200112
Ittay Stern035cbb92019-12-26 09:39:43 +0200113 cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true');
Sara Weissd6c85042019-12-12 13:45:32 +0200114
Yoav Schneiderman26034812019-12-03 12:55:39 +0200115 });
116
117 afterEach(() => {
118 cy.screenshot();
119 });
120
121 it('when open service popup should show template button', function () {
Yoav Schneiderman26034812019-12-03 12:55:39 +0200122 cy.getElementByDataTestsId('templateButton').contains('Template')
123 .getElementByDataTestsId('templateButton').click({force: true}) // Open template Modal
124 .getElementByDataTestsId('template-modal-title').contains('Templates') // Check Modal header
125 .getElementByDataTestsId('description-part-1').contains('The following list presents previous instantiations done for this model in this version.')
126 .getElementByDataTestsId('description-part-2').contains('You may use one of them as a baseline for your instantiation or start from scratch.')
127 .getElementByDataTestsId('description-part-3').contains('Once you selecting one allows you to change the data before start instantiating.')
128
129
130 //check table headers
131 cy.get(`#header-userId`).contains('User ID');
132 cy.get(`#header-createDate`).contains('Date');
133 cy.get(`#header-instanceName`).contains('Instance Name');
134 cy.get(`#header-instantiationStatus`).contains('Instantiation Status');
135 cy.get(`#header-region`).contains('Region');
136 cy.get(`#header-tenant`).contains('Tenant');
137 cy.get(`#header-aicZone`).contains('AIC Zone');
138
139 // check table body row
Yoav Schneiderman89de17b2019-12-18 21:04:38 +0200140 cy.getElementByDataTestsId(`userId-${instantiationTemplates[0].jobId}`).contains('16807000');
141 cy.getElementByDataTestsId(`createDate-${instantiationTemplates[0].jobId}`).contains('2018-04-30 11:12:48');
142 cy.getElementByDataTestsId(`instanceName-${instantiationTemplates[0].jobId}`).contains('nWUfl instance name_002');
143 cy.getElementByDataTestsId(`instantiationStatus-${instantiationTemplates[0].jobId}`).contains('FAILED');
Alexey Sandlerf3174642019-12-25 16:01:38 +0200144 cy.getElementByDataTestsId(`summary-${instantiationTemplates[0].jobId}`).contains('vnf: 1, vfModule: 2, volumeGroup: 1');
Yoav Schneiderman89de17b2019-12-18 21:04:38 +0200145 cy.getElementByDataTestsId(`region-${instantiationTemplates[0].jobId}`).contains('hvf6 (WAYNEHOLLAND)');
146 cy.getElementByDataTestsId(`tenant-${instantiationTemplates[0].jobId}`).contains('AIN Web Tool-15-D-testalexandria');
147 cy.getElementByDataTestsId(`aicZone-${instantiationTemplates[0].jobId}`).contains('NFTJSSSS-NFT1');
Yoav Schneiderman26034812019-12-03 12:55:39 +0200148
149
150 //check load button is disabled
Yoav Schneidermaneafbe7e2019-12-17 22:10:31 +0200151 cy.getElementByDataTestsId('LoadTemplateButton').should('be.disabled');
Yoav Schneiderman26034812019-12-03 12:55:39 +0200152 cy.getElementByDataTestsId('row-5c2cd8e5-27d0-42e3-85a1-85db5eaba459').click();
Yoav Schneidermaneafbe7e2019-12-17 22:10:31 +0200153 cy.getElementByDataTestsId('LoadTemplateButton').should('not.be.disabled');
154
155 //filter by userId
156 cy.get('.member-table-row').should('have.length', 2);
157 cy.getElementByDataTestsId('filterByUserIdTestId').click();
158 cy.get('.member-table-row').should('have.length', 1);
Yoav Schneiderman26034812019-12-03 12:55:39 +0200159
160 });
Sara Weissd6c85042019-12-12 13:45:32 +0200161
162 it('clicking on load template button, go to expected url', function () {
163
164 cy.getElementByDataTestsId('templateButton').contains('Template')
165 .getElementByDataTestsId('templateButton').click({force: true}) // Open template Modal
166
167 const serviceModelId = 'e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0';
168 const jobId = '5c2cd8e5-27d0-42e3-85a1-85db5eaba459';
169 const vidBaseUrl = `http://localhost:8080/vid/serviceModels.htm`;
170
171 cy.getElementByDataTestsId('row-5c2cd8e5-27d0-42e3-85a1-85db5eaba459').click();
Ittay Stern035cbb92019-12-26 09:39:43 +0200172 cy.getElementByDataTestsId('LoadTemplateButton').click().setViewportToDefault();
Sara Weissd6c85042019-12-12 13:45:32 +0200173
174 cy.location().should((loc) => {
175 expect(loc.toString()).to.eq(`${vidBaseUrl}#/servicePlanning/RECREATE?serviceModelId=${serviceModelId}&jobId=${jobId}`);
176 });
177 });
178
179
Yoav Schneiderman26034812019-12-03 12:55:39 +0200180});
181