Yoav Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 1 | ///<reference path="../../../node_modules/cypress/types/index.d.ts"/> |
| 2 | describe('Template', () => { |
| 3 | |
Yoav Schneiderman | 89de17b | 2019-12-18 21:04:38 +0200 | [diff] [blame] | 4 | const instantiationTemplates = [ |
Sara Weiss | d6c8504 | 2019-12-12 13:45:32 +0200 | [diff] [blame] | 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, |
Alexey Sandler | 31b3d53 | 2019-12-24 21:15:40 +0200 | [diff] [blame] | 41 | "isRetryEnabled": true, |
| 42 | "requestSummary": { |
| 43 | "vnf": 2, |
| 44 | "vfModule": 3, |
| 45 | "network": 1 |
| 46 | } |
Yoav Schneiderman | eafbe7e | 2019-12-17 22:10:31 +0200 | [diff] [blame] | 47 | }, |
| 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 Weiss | d6c8504 | 2019-12-12 13:45:32 +0200 | [diff] [blame] | 85 | } |
| 86 | ]; |
| 87 | |
Yoav Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 88 | beforeEach(() => { |
| 89 | cy.clearSessionStorage(); |
| 90 | cy.setReduxState(); |
| 91 | cy.preventErrorsOnLoading(); |
| 92 | cy.initAAIMock(); |
| 93 | cy.initVidMock(); |
| 94 | cy.login(); |
Sara Weiss | d6c8504 | 2019-12-12 13:45:32 +0200 | [diff] [blame] | 95 | |
| 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 Schneiderman | 89de17b | 2019-12-18 21:04:38 +0200 | [diff] [blame] | 110 | cy.route(Cypress.config('baseUrl') + "/instantiationTemplates**", instantiationTemplates); |
Yoav Schneiderman | eafbe7e | 2019-12-17 22:10:31 +0200 | [diff] [blame] | 111 | cy.route(Cypress.config('baseUrl') + "/getuserID", '16807000'); |
Sara Weiss | d6c8504 | 2019-12-12 13:45:32 +0200 | [diff] [blame] | 112 | |
Ittay Stern | 035cbb9 | 2019-12-26 09:39:43 +0200 | [diff] [blame^] | 113 | cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); |
Sara Weiss | d6c8504 | 2019-12-12 13:45:32 +0200 | [diff] [blame] | 114 | |
Yoav Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 115 | }); |
| 116 | |
| 117 | afterEach(() => { |
| 118 | cy.screenshot(); |
| 119 | }); |
| 120 | |
| 121 | it('when open service popup should show template button', function () { |
Yoav Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 122 | 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 Schneiderman | 89de17b | 2019-12-18 21:04:38 +0200 | [diff] [blame] | 140 | 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 Sandler | 31b3d53 | 2019-12-24 21:15:40 +0200 | [diff] [blame] | 144 | cy.getElementByDataTestsId(`summary-${instantiationTemplates[0].jobId}`).contains('{"vnf":2,"vfModule":3,"network":1}'); |
Yoav Schneiderman | 89de17b | 2019-12-18 21:04:38 +0200 | [diff] [blame] | 145 | 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 Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 148 | |
| 149 | |
| 150 | //check load button is disabled |
Yoav Schneiderman | eafbe7e | 2019-12-17 22:10:31 +0200 | [diff] [blame] | 151 | cy.getElementByDataTestsId('LoadTemplateButton').should('be.disabled'); |
Yoav Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 152 | cy.getElementByDataTestsId('row-5c2cd8e5-27d0-42e3-85a1-85db5eaba459').click(); |
Yoav Schneiderman | eafbe7e | 2019-12-17 22:10:31 +0200 | [diff] [blame] | 153 | 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 Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 159 | |
| 160 | }); |
Sara Weiss | d6c8504 | 2019-12-12 13:45:32 +0200 | [diff] [blame] | 161 | |
| 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 Stern | 035cbb9 | 2019-12-26 09:39:43 +0200 | [diff] [blame^] | 172 | cy.getElementByDataTestsId('LoadTemplateButton').click().setViewportToDefault(); |
Sara Weiss | d6c8504 | 2019-12-12 13:45:32 +0200 | [diff] [blame] | 173 | |
| 174 | cy.location().should((loc) => { |
| 175 | expect(loc.toString()).to.eq(`${vidBaseUrl}#/servicePlanning/RECREATE?serviceModelId=${serviceModelId}&jobId=${jobId}`); |
| 176 | }); |
| 177 | }); |
| 178 | |
| 179 | |
Yoav Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 180 | }); |
| 181 | |