blob: b2d3eb578fd92a2db254add00084ff16269ac1af [file] [log] [blame]
Yoav Schneiderman26034812019-12-03 12:55:39 +02001///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2describe('Template', () => {
3
Sara Weissd6c85042019-12-12 13:45:32 +02004 const asyncInstantiation = [
5 {
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,
41 "isRetryEnabled": true
Yoav Schneidermaneafbe7e2019-12-17 22:10:31 +020042 },
43 {
44 "id": 7,
45 "created": 1525075968000,
46 "modified": 1525075971000,
47 "action": "INSTANTIATE",
48 "createdId": null,
49 "modifiedId": null,
50 "rowNum": null,
51 "auditUserId": null,
52 "auditTrail": null,
53 "jobId": "13063a83-924e-4500-a3a1-e53d1b58450b",
54 "templateId": "d42ba7c8-9e19-4e34-ae2c-d8af3f24498e",
55 "userId": "17807000",
56 "aLaCarte": false,
57 "msoRequestId": "c0011670-0e1a-4b74-945d-8bf5aede1d9d",
58 "jobStatus": "IN_PROGRESS",
59 "statusModifiedDate": 1525075968000,
60 "hidden": false,
61 "pause": false,
62 "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
63 "owningEntityName": "WayneHolland",
64 "project": "WATKINS",
65 "aicZoneId": "NFT1",
66 "aicZoneName": "NFTJSSSS-NFT1",
67 "tenantId": "bae71557c5bb4d5aac6743a4e5f1d054",
68 "tenantName": "AIN Web Tool-15-D-testalexandria",
69 "regionId": "hvf6",
70 "regionName": null,
71 "serviceType": "TYLER SILVIA",
72 "subscriberName": "e433710f-9217-458d-a79d-1c7aff376d89",
73 "serviceInstanceId": null,
74 "serviceInstanceName": "nWUfl instance name_001",
75 "serviceModelId": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0",
76 "serviceModelName": "action-data",
77 "serviceModelVersion": "1.0",
78 "createdBulkDate": 1525075968000,
79 "isRetryEnabled": false
Sara Weissd6c85042019-12-12 13:45:32 +020080 }
81 ];
82
Yoav Schneiderman26034812019-12-03 12:55:39 +020083 beforeEach(() => {
84 cy.clearSessionStorage();
85 cy.setReduxState();
86 cy.preventErrorsOnLoading();
87 cy.initAAIMock();
88 cy.initVidMock();
89 cy.login();
Sara Weissd6c85042019-12-12 13:45:32 +020090
91 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json').then((flags) => {
92 cy.server()
93 .route({
94 method: 'GET',
95 delay: 0,
96 status: 200,
97 url: Cypress.config('baseUrl') + "/flags**",
98 response: {
99 "FLAG_VF_MODULE_RESUME_STATUS_CREATE": false,
100 "FLAG_2004_INSTANTIATION_TEMPLATES_POPUP": true
101 }
102 }).as('initFlags');
103 });
104
105 cy.route(Cypress.config('baseUrl') + "/asyncInstantiation**", asyncInstantiation);
Yoav Schneidermaneafbe7e2019-12-17 22:10:31 +0200106 cy.route(Cypress.config('baseUrl') + "/getuserID", '16807000');
Sara Weissd6c85042019-12-12 13:45:32 +0200107
108 cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true');
109
110
111
112
Yoav Schneiderman26034812019-12-03 12:55:39 +0200113 });
114
115 afterEach(() => {
116 cy.screenshot();
117 });
118
119 it('when open service popup should show template button', function () {
Yoav Schneiderman26034812019-12-03 12:55:39 +0200120 cy.getElementByDataTestsId('templateButton').contains('Template')
121 .getElementByDataTestsId('templateButton').click({force: true}) // Open template Modal
122 .getElementByDataTestsId('template-modal-title').contains('Templates') // Check Modal header
123 .getElementByDataTestsId('description-part-1').contains('The following list presents previous instantiations done for this model in this version.')
124 .getElementByDataTestsId('description-part-2').contains('You may use one of them as a baseline for your instantiation or start from scratch.')
125 .getElementByDataTestsId('description-part-3').contains('Once you selecting one allows you to change the data before start instantiating.')
126
127
128 //check table headers
129 cy.get(`#header-userId`).contains('User ID');
130 cy.get(`#header-createDate`).contains('Date');
131 cy.get(`#header-instanceName`).contains('Instance Name');
132 cy.get(`#header-instantiationStatus`).contains('Instantiation Status');
133 cy.get(`#header-region`).contains('Region');
134 cy.get(`#header-tenant`).contains('Tenant');
135 cy.get(`#header-aicZone`).contains('AIC Zone');
136
137 // check table body row
138 cy.getElementByDataTestsId(`userId-${asyncInstantiation[0].jobId}`).contains('16807000');
139 cy.getElementByDataTestsId(`createDate-${asyncInstantiation[0].jobId}`).contains('2018-04-30 11:12:48');
140 cy.getElementByDataTestsId(`instanceName-${asyncInstantiation[0].jobId}`).contains('nWUfl instance name_002');
141 cy.getElementByDataTestsId(`instantiationStatus-${asyncInstantiation[0].jobId}`).contains('FAILED');
142 cy.getElementByDataTestsId(`region-${asyncInstantiation[0].jobId}`).contains('hvf6 (WAYNEHOLLAND)');
143 cy.getElementByDataTestsId(`tenant-${asyncInstantiation[0].jobId}`).contains('AIN Web Tool-15-D-testalexandria');
144 cy.getElementByDataTestsId(`aicZone-${asyncInstantiation[0].jobId}`).contains('NFTJSSSS-NFT1');
145
146
147 //check load button is disabled
Yoav Schneidermaneafbe7e2019-12-17 22:10:31 +0200148 cy.getElementByDataTestsId('LoadTemplateButton').should('be.disabled');
Yoav Schneiderman26034812019-12-03 12:55:39 +0200149 cy.getElementByDataTestsId('row-5c2cd8e5-27d0-42e3-85a1-85db5eaba459').click();
Yoav Schneidermaneafbe7e2019-12-17 22:10:31 +0200150 cy.getElementByDataTestsId('LoadTemplateButton').should('not.be.disabled');
151
152 //filter by userId
153 cy.get('.member-table-row').should('have.length', 2);
154 cy.getElementByDataTestsId('filterByUserIdTestId').click();
155 cy.get('.member-table-row').should('have.length', 1);
Yoav Schneiderman26034812019-12-03 12:55:39 +0200156
157 });
Sara Weissd6c85042019-12-12 13:45:32 +0200158
159 it('clicking on load template button, go to expected url', function () {
160
161 cy.getElementByDataTestsId('templateButton').contains('Template')
162 .getElementByDataTestsId('templateButton').click({force: true}) // Open template Modal
163
164 const serviceModelId = 'e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0';
165 const jobId = '5c2cd8e5-27d0-42e3-85a1-85db5eaba459';
166 const vidBaseUrl = `http://localhost:8080/vid/serviceModels.htm`;
167
168 cy.getElementByDataTestsId('row-5c2cd8e5-27d0-42e3-85a1-85db5eaba459').click();
169 cy.getElementByDataTestsId('LoadTemplateButton').click()
170
171 cy.location().should((loc) => {
172 expect(loc.toString()).to.eq(`${vidBaseUrl}#/servicePlanning/RECREATE?serviceModelId=${serviceModelId}&jobId=${jobId}`);
173 });
174 });
175
176
Yoav Schneiderman26034812019-12-03 12:55:39 +0200177});
178