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 | |
| 4 | beforeEach(() => { |
| 5 | cy.clearSessionStorage(); |
| 6 | cy.setReduxState(); |
| 7 | cy.preventErrorsOnLoading(); |
| 8 | cy.initAAIMock(); |
| 9 | cy.initVidMock(); |
| 10 | cy.login(); |
| 11 | }); |
| 12 | |
| 13 | afterEach(() => { |
| 14 | cy.screenshot(); |
| 15 | }); |
| 16 | |
| 17 | it('when open service popup should show template button', function () { |
| 18 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json').then((flags) => { |
| 19 | cy.server() |
| 20 | .route({ |
| 21 | method: 'GET', |
| 22 | delay: 0, |
| 23 | status: 200, |
| 24 | url: Cypress.config('baseUrl') + "/flags**", |
| 25 | response: { |
| 26 | "FLAG_VF_MODULE_RESUME_STATUS_CREATE": false, |
| 27 | "FLAG_2004_INSTANTIATION_TEMPLATES_POPUP": true |
| 28 | } |
| 29 | }).as('initFlags'); |
| 30 | }); |
| 31 | |
| 32 | const asyncInstantiation = [ |
| 33 | { |
| 34 | "id": 8, |
| 35 | "created": 1525075968000, |
| 36 | "modified": 1525075971000, |
| 37 | "action": "INSTANTIATE", |
| 38 | "createdId": null, |
| 39 | "modifiedId": null, |
| 40 | "rowNum": null, |
| 41 | "auditUserId": null, |
| 42 | "auditTrail": null, |
| 43 | "jobId": "5c2cd8e5-27d0-42e3-85a1-85db5eaba459", |
| 44 | "templateId": "d42ba7c8-9e19-4e34-ae2c-d8af3f24498e", |
| 45 | "userId": "16807000", |
| 46 | "aLaCarte": false, |
| 47 | "msoRequestId": "c0011670-0e1a-4b74-945d-8bf5aede1d9c", |
| 48 | "jobStatus": "FAILED", |
| 49 | "statusModifiedDate": 1525075968000, |
| 50 | "hidden": false, |
| 51 | "pause": false, |
| 52 | "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", |
| 53 | "owningEntityName": "WayneHolland", |
| 54 | "project": "WATKINS", |
| 55 | "aicZoneId": "NFT1", |
| 56 | "aicZoneName": "NFTJSSSS-NFT1", |
| 57 | "tenantId": "bae71557c5bb4d5aac6743a4e5f1d054", |
| 58 | "tenantName": "AIN Web Tool-15-D-testalexandria", |
| 59 | "regionId": "hvf6", |
| 60 | "regionName": null, |
| 61 | "serviceType": "TYLER SILVIA", |
| 62 | "subscriberName": "e433710f-9217-458d-a79d-1c7aff376d89", |
| 63 | "serviceInstanceId": null, |
| 64 | "serviceInstanceName": "nWUfl instance name_002", |
| 65 | "serviceModelId": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", |
| 66 | "serviceModelName": "action-data", |
| 67 | "serviceModelVersion": "1.0", |
| 68 | "createdBulkDate": 1525075968000, |
| 69 | "isRetryEnabled": true |
| 70 | } |
| 71 | ]; |
| 72 | |
| 73 | cy.route(Cypress.config('baseUrl') + "/asyncInstantiation**", asyncInstantiation); |
| 74 | |
| 75 | cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); |
| 76 | cy.getElementByDataTestsId('templateButton').contains('Template') |
| 77 | .getElementByDataTestsId('templateButton').click({force: true}) // Open template Modal |
| 78 | .getElementByDataTestsId('template-modal-title').contains('Templates') // Check Modal header |
| 79 | .getElementByDataTestsId('description-part-1').contains('The following list presents previous instantiations done for this model in this version.') |
| 80 | .getElementByDataTestsId('description-part-2').contains('You may use one of them as a baseline for your instantiation or start from scratch.') |
| 81 | .getElementByDataTestsId('description-part-3').contains('Once you selecting one allows you to change the data before start instantiating.') |
| 82 | |
| 83 | |
| 84 | //check table headers |
| 85 | cy.get(`#header-userId`).contains('User ID'); |
| 86 | cy.get(`#header-createDate`).contains('Date'); |
| 87 | cy.get(`#header-instanceName`).contains('Instance Name'); |
| 88 | cy.get(`#header-instantiationStatus`).contains('Instantiation Status'); |
| 89 | cy.get(`#header-region`).contains('Region'); |
| 90 | cy.get(`#header-tenant`).contains('Tenant'); |
| 91 | cy.get(`#header-aicZone`).contains('AIC Zone'); |
| 92 | |
| 93 | // check table body row |
| 94 | cy.getElementByDataTestsId(`userId-${asyncInstantiation[0].jobId}`).contains('16807000'); |
| 95 | cy.getElementByDataTestsId(`createDate-${asyncInstantiation[0].jobId}`).contains('2018-04-30 11:12:48'); |
| 96 | cy.getElementByDataTestsId(`instanceName-${asyncInstantiation[0].jobId}`).contains('nWUfl instance name_002'); |
| 97 | cy.getElementByDataTestsId(`instantiationStatus-${asyncInstantiation[0].jobId}`).contains('FAILED'); |
| 98 | cy.getElementByDataTestsId(`region-${asyncInstantiation[0].jobId}`).contains('hvf6 (WAYNEHOLLAND)'); |
| 99 | cy.getElementByDataTestsId(`tenant-${asyncInstantiation[0].jobId}`).contains('AIN Web Tool-15-D-testalexandria'); |
| 100 | cy.getElementByDataTestsId(`aicZone-${asyncInstantiation[0].jobId}`).contains('NFTJSSSS-NFT1'); |
| 101 | |
| 102 | |
| 103 | //check load button is disabled |
| 104 | cy.getElementByDataTestsId('LoadTemplateButton').should('be.disabled') |
| 105 | cy.getElementByDataTestsId('row-5c2cd8e5-27d0-42e3-85a1-85db5eaba459').click(); |
| 106 | cy.getElementByDataTestsId('LoadTemplateButton').should('not.be.disabled') |
| 107 | |
| 108 | }); |
| 109 | }); |
| 110 | |