1 ///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2 describe('Template', () => {
4 const asyncInstantiation = [
7 "created": 1525075968000,
8 "modified": 1525075971000,
9 "action": "INSTANTIATE",
15 "jobId": "5c2cd8e5-27d0-42e3-85a1-85db5eaba459",
16 "templateId": "d42ba7c8-9e19-4e34-ae2c-d8af3f24498e",
19 "msoRequestId": "c0011670-0e1a-4b74-945d-8bf5aede1d9c",
20 "jobStatus": "FAILED",
21 "statusModifiedDate": 1525075968000,
24 "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
25 "owningEntityName": "WayneHolland",
28 "aicZoneName": "NFTJSSSS-NFT1",
29 "tenantId": "bae71557c5bb4d5aac6743a4e5f1d054",
30 "tenantName": "AIN Web Tool-15-D-testalexandria",
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
45 "created": 1525075968000,
46 "modified": 1525075971000,
47 "action": "INSTANTIATE",
53 "jobId": "13063a83-924e-4500-a3a1-e53d1b58450b",
54 "templateId": "d42ba7c8-9e19-4e34-ae2c-d8af3f24498e",
57 "msoRequestId": "c0011670-0e1a-4b74-945d-8bf5aede1d9d",
58 "jobStatus": "IN_PROGRESS",
59 "statusModifiedDate": 1525075968000,
62 "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
63 "owningEntityName": "WayneHolland",
66 "aicZoneName": "NFTJSSSS-NFT1",
67 "tenantId": "bae71557c5bb4d5aac6743a4e5f1d054",
68 "tenantName": "AIN Web Tool-15-D-testalexandria",
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
84 cy.clearSessionStorage();
86 cy.preventErrorsOnLoading();
91 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json').then((flags) => {
97 url: Cypress.config('baseUrl') + "/flags**",
99 "FLAG_VF_MODULE_RESUME_STATUS_CREATE": false,
100 "FLAG_2004_INSTANTIATION_TEMPLATES_POPUP": true
105 cy.route(Cypress.config('baseUrl') + "/asyncInstantiation**", asyncInstantiation);
106 cy.route(Cypress.config('baseUrl') + "/getuserID", '16807000');
108 cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true');
119 it('when open service popup should show template button', function () {
120 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.')
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');
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');
147 //check load button is disabled
148 cy.getElementByDataTestsId('LoadTemplateButton').should('be.disabled');
149 cy.getElementByDataTestsId('row-5c2cd8e5-27d0-42e3-85a1-85db5eaba459').click();
150 cy.getElementByDataTestsId('LoadTemplateButton').should('not.be.disabled');
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);
159 it('clicking on load template button, go to expected url', function () {
161 cy.getElementByDataTestsId('templateButton').contains('Template')
162 .getElementByDataTestsId('templateButton').click({force: true}) // Open template Modal
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`;
168 cy.getElementByDataTestsId('row-5c2cd8e5-27d0-42e3-85a1-85db5eaba459').click();
169 cy.getElementByDataTestsId('LoadTemplateButton').click()
171 cy.location().should((loc) => {
172 expect(loc.toString()).to.eq(`${vidBaseUrl}#/servicePlanning/RECREATE?serviceModelId=${serviceModelId}&jobId=${jobId}`);