From d6c8504a8ec747b9397c84f2d1f81ab656e8e4a2 Mon Sep 17 00:00:00 2001 From: Sara Weiss Date: Thu, 12 Dec 2019 13:45:32 +0200 Subject: Load template button in new template modal Issue-ID: VID-724 Signed-off-by: Sara Weiss Change-Id: I3a3d6a10b364b61f6a7631b47107b7c4de601aaf --- .../iFrames/instantiation.templates.modal.e2e.ts | 138 ++++++++++++--------- 1 file changed, 81 insertions(+), 57 deletions(-) (limited to 'vid-webpack-master/cypress') diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts index b862e568d..3caa4e81d 100644 --- a/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/instantiation.templates.modal.e2e.ts @@ -1,6 +1,47 @@ /// describe('Template', () => { + const asyncInstantiation = [ + { + "id": 8, + "created": 1525075968000, + "modified": 1525075971000, + "action": "INSTANTIATE", + "createdId": null, + "modifiedId": null, + "rowNum": null, + "auditUserId": null, + "auditTrail": null, + "jobId": "5c2cd8e5-27d0-42e3-85a1-85db5eaba459", + "templateId": "d42ba7c8-9e19-4e34-ae2c-d8af3f24498e", + "userId": "16807000", + "aLaCarte": false, + "msoRequestId": "c0011670-0e1a-4b74-945d-8bf5aede1d9c", + "jobStatus": "FAILED", + "statusModifiedDate": 1525075968000, + "hidden": false, + "pause": false, + "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", + "owningEntityName": "WayneHolland", + "project": "WATKINS", + "aicZoneId": "NFT1", + "aicZoneName": "NFTJSSSS-NFT1", + "tenantId": "bae71557c5bb4d5aac6743a4e5f1d054", + "tenantName": "AIN Web Tool-15-D-testalexandria", + "regionId": "hvf6", + "regionName": null, + "serviceType": "TYLER SILVIA", + "subscriberName": "e433710f-9217-458d-a79d-1c7aff376d89", + "serviceInstanceId": null, + "serviceInstanceName": "nWUfl instance name_002", + "serviceModelId": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", + "serviceModelName": "action-data", + "serviceModelVersion": "1.0", + "createdBulkDate": 1525075968000, + "isRetryEnabled": true + } + ]; + beforeEach(() => { cy.clearSessionStorage(); cy.setReduxState(); @@ -8,71 +49,35 @@ describe('Template', () => { cy.initAAIMock(); cy.initVidMock(); cy.login(); - }); - - afterEach(() => { - cy.screenshot(); - }); - it('when open service popup should show template button', function () { cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json').then((flags) => { cy.server() - .route({ - method: 'GET', - delay: 0, - status: 200, - url: Cypress.config('baseUrl') + "/flags**", - response: { - "FLAG_VF_MODULE_RESUME_STATUS_CREATE": false, - "FLAG_2004_INSTANTIATION_TEMPLATES_POPUP": true - } - }).as('initFlags'); + .route({ + method: 'GET', + delay: 0, + status: 200, + url: Cypress.config('baseUrl') + "/flags**", + response: { + "FLAG_VF_MODULE_RESUME_STATUS_CREATE": false, + "FLAG_2004_INSTANTIATION_TEMPLATES_POPUP": true + } + }).as('initFlags'); }); - const asyncInstantiation = [ - { - "id": 8, - "created": 1525075968000, - "modified": 1525075971000, - "action": "INSTANTIATE", - "createdId": null, - "modifiedId": null, - "rowNum": null, - "auditUserId": null, - "auditTrail": null, - "jobId": "5c2cd8e5-27d0-42e3-85a1-85db5eaba459", - "templateId": "d42ba7c8-9e19-4e34-ae2c-d8af3f24498e", - "userId": "16807000", - "aLaCarte": false, - "msoRequestId": "c0011670-0e1a-4b74-945d-8bf5aede1d9c", - "jobStatus": "FAILED", - "statusModifiedDate": 1525075968000, - "hidden": false, - "pause": false, - "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", - "owningEntityName": "WayneHolland", - "project": "WATKINS", - "aicZoneId": "NFT1", - "aicZoneName": "NFTJSSSS-NFT1", - "tenantId": "bae71557c5bb4d5aac6743a4e5f1d054", - "tenantName": "AIN Web Tool-15-D-testalexandria", - "regionId": "hvf6", - "regionName": null, - "serviceType": "TYLER SILVIA", - "subscriberName": "e433710f-9217-458d-a79d-1c7aff376d89", - "serviceInstanceId": null, - "serviceInstanceName": "nWUfl instance name_002", - "serviceModelId": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", - "serviceModelName": "action-data", - "serviceModelVersion": "1.0", - "createdBulkDate": 1525075968000, - "isRetryEnabled": true - } - ]; - cy.route(Cypress.config('baseUrl') + "/asyncInstantiation**", asyncInstantiation); cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); + + + + + }); + + afterEach(() => { + cy.screenshot(); + }); + + it('when open service popup should show template button', function () { cy.getElementByDataTestsId('templateButton').contains('Template') .getElementByDataTestsId('templateButton').click({force: true}) // Open template Modal .getElementByDataTestsId('template-modal-title').contains('Templates') // Check Modal header @@ -106,5 +111,24 @@ describe('Template', () => { cy.getElementByDataTestsId('LoadTemplateButton').should('not.be.disabled') }); + + it('clicking on load template button, go to expected url', function () { + + cy.getElementByDataTestsId('templateButton').contains('Template') + .getElementByDataTestsId('templateButton').click({force: true}) // Open template Modal + + const serviceModelId = 'e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0'; + const jobId = '5c2cd8e5-27d0-42e3-85a1-85db5eaba459'; + const vidBaseUrl = `http://localhost:8080/vid/serviceModels.htm`; + + cy.getElementByDataTestsId('row-5c2cd8e5-27d0-42e3-85a1-85db5eaba459').click(); + cy.getElementByDataTestsId('LoadTemplateButton').click() + + cy.location().should((loc) => { + expect(loc.toString()).to.eq(`${vidBaseUrl}#/servicePlanning/RECREATE?serviceModelId=${serviceModelId}&jobId=${jobId}`); + }); + }); + + }); -- cgit 1.2.3-korg