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', () => { |
Ittay Stern | e8dd99b | 2019-12-31 17:15:34 +0200 | [diff] [blame] | 3 | const templateJobIdFromE2EFile = 'ef3430f8-6350-454c-a7c2-89ba301522c1'; |
Yoav Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 4 | |
Ittay Stern | e8dd99b | 2019-12-31 17:15:34 +0200 | [diff] [blame] | 5 | const aSecondTemplateInfo = { |
| 6 | id: 7, |
| 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: "13063a83-924e-4500-a3a1-e53d1b58450b", |
| 16 | templateId: "d42ba7c8-9e19-4e34-ae2c-d8af3f24498e", |
| 17 | userId: "17807000", |
| 18 | aLaCarte: false, |
| 19 | msoRequestId: "c0011670-0e1a-4b74-945d-8bf5aede1d9d", |
| 20 | jobStatus: "IN_PROGRESS", |
| 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_001", |
| 37 | serviceModelId: "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", |
| 38 | serviceModelName: "action-data", |
| 39 | serviceModelVersion: "1.0", |
| 40 | createdBulkDate: 1525075968000, |
| 41 | isRetryEnabled: false |
| 42 | }; |
Sara Weiss | d6c8504 | 2019-12-12 13:45:32 +0200 | [diff] [blame] | 43 | |
Yoav Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 44 | beforeEach(() => { |
| 45 | cy.clearSessionStorage(); |
| 46 | cy.setReduxState(); |
| 47 | cy.preventErrorsOnLoading(); |
| 48 | cy.initAAIMock(); |
| 49 | cy.initVidMock(); |
| 50 | cy.login(); |
Sara Weiss | d6c8504 | 2019-12-12 13:45:32 +0200 | [diff] [blame] | 51 | |
| 52 | cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json').then((flags) => { |
| 53 | cy.server() |
| 54 | .route({ |
| 55 | method: 'GET', |
| 56 | delay: 0, |
| 57 | status: 200, |
| 58 | url: Cypress.config('baseUrl') + "/flags**", |
| 59 | response: { |
| 60 | "FLAG_VF_MODULE_RESUME_STATUS_CREATE": false, |
| 61 | "FLAG_2004_INSTANTIATION_TEMPLATES_POPUP": true |
| 62 | } |
| 63 | }).as('initFlags'); |
| 64 | }); |
| 65 | |
Ittay Stern | e8dd99b | 2019-12-31 17:15:34 +0200 | [diff] [blame] | 66 | cy.readFile('fixture:../../../vid-automation/src/test/resources/asyncInstantiation/vidRequestCreateBulkOfMacro__template_info.json').then((templateInfoFromE2EFile)=>{ |
| 67 | cy.route(Cypress.config('baseUrl') + "/instantiationTemplates?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd", |
| 68 | [ templateInfoFromE2EFile, aSecondTemplateInfo ] |
| 69 | ) |
| 70 | }); |
| 71 | |
| 72 | cy.route(Cypress.config('baseUrl') + "/getuserID", 'us16807000'); |
Sara Weiss | d6c8504 | 2019-12-12 13:45:32 +0200 | [diff] [blame] | 73 | |
Ittay Stern | 035cbb9 | 2019-12-26 09:39:43 +0200 | [diff] [blame] | 74 | 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] | 75 | |
Yoav Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 76 | }); |
| 77 | |
| 78 | afterEach(() => { |
| 79 | cy.screenshot(); |
| 80 | }); |
| 81 | |
| 82 | it('when open service popup should show template button', function () { |
Yoav Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 83 | cy.getElementByDataTestsId('templateButton').contains('Template') |
| 84 | .getElementByDataTestsId('templateButton').click({force: true}) // Open template Modal |
| 85 | .getElementByDataTestsId('template-modal-title').contains('Templates') // Check Modal header |
| 86 | .getElementByDataTestsId('description-part-1').contains('The following list presents previous instantiations done for this model in this version.') |
| 87 | .getElementByDataTestsId('description-part-2').contains('You may use one of them as a baseline for your instantiation or start from scratch.') |
Ittay Stern | e8dd99b | 2019-12-31 17:15:34 +0200 | [diff] [blame] | 88 | .getElementByDataTestsId('description-part-3').contains('Once you selecting one allows you to change the data before start instantiating.'); |
Yoav Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 89 | |
| 90 | //check table headers |
| 91 | cy.get(`#header-userId`).contains('User ID'); |
| 92 | cy.get(`#header-createDate`).contains('Date'); |
| 93 | cy.get(`#header-instanceName`).contains('Instance Name'); |
| 94 | cy.get(`#header-instantiationStatus`).contains('Instantiation Status'); |
| 95 | cy.get(`#header-region`).contains('Region'); |
| 96 | cy.get(`#header-tenant`).contains('Tenant'); |
| 97 | cy.get(`#header-aicZone`).contains('AIC Zone'); |
| 98 | |
| 99 | // check table body row |
Ittay Stern | e8dd99b | 2019-12-31 17:15:34 +0200 | [diff] [blame] | 100 | cy.getElementByDataTestsId(`userId-${templateJobIdFromE2EFile}`).contains('16807000'); |
| 101 | cy.getElementByDataTestsId(`createDate-${templateJobIdFromE2EFile}`).contains('2019-12-26 11:57:05'); |
| 102 | cy.getElementByDataTestsId(`instanceName-${templateJobIdFromE2EFile}`).contains('SERVICE_NAME'); |
| 103 | cy.getElementByDataTestsId(`instantiationStatus-${templateJobIdFromE2EFile}`).contains('IN_PROGRESS'); |
| 104 | cy.getElementByDataTestsId(`summary-${templateJobIdFromE2EFile}`).contains('vnf: 1, vfModule: 2, volumeGroup: 1'); |
| 105 | cy.getElementByDataTestsId(`region-${templateJobIdFromE2EFile}`).contains('hvf3 (SOMENAME)'); |
| 106 | cy.getElementByDataTestsId(`tenant-${templateJobIdFromE2EFile}`).contains('greatTenant'); |
| 107 | cy.getElementByDataTestsId(`aicZone-${templateJobIdFromE2EFile}`).contains('NFTJSSSS-NFT1'); |
Yoav Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 108 | |
| 109 | |
| 110 | //check load button is disabled |
Yoav Schneiderman | eafbe7e | 2019-12-17 22:10:31 +0200 | [diff] [blame] | 111 | cy.getElementByDataTestsId('LoadTemplateButton').should('be.disabled'); |
Ittay Stern | e8dd99b | 2019-12-31 17:15:34 +0200 | [diff] [blame] | 112 | cy.getElementByDataTestsId(`row-${templateJobIdFromE2EFile}`).click(); |
Yoav Schneiderman | eafbe7e | 2019-12-17 22:10:31 +0200 | [diff] [blame] | 113 | cy.getElementByDataTestsId('LoadTemplateButton').should('not.be.disabled'); |
| 114 | |
| 115 | //filter by userId |
| 116 | cy.get('.member-table-row').should('have.length', 2); |
| 117 | cy.getElementByDataTestsId('filterByUserIdTestId').click(); |
| 118 | cy.get('.member-table-row').should('have.length', 1); |
Yoav Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 119 | |
| 120 | }); |
Sara Weiss | d6c8504 | 2019-12-12 13:45:32 +0200 | [diff] [blame] | 121 | |
| 122 | it('clicking on load template button, go to expected url', function () { |
| 123 | |
| 124 | cy.getElementByDataTestsId('templateButton').contains('Template') |
| 125 | .getElementByDataTestsId('templateButton').click({force: true}) // Open template Modal |
| 126 | |
Ittay Stern | e8dd99b | 2019-12-31 17:15:34 +0200 | [diff] [blame] | 127 | const serviceModelId = '5c9e863f-2716-467b-8799-4a67f378dcaa'; |
Eylon Malin | fa4d3e5 | 2020-01-02 14:08:31 +0200 | [diff] [blame] | 128 | const vidBaseUrl = `${Cypress.config().baseUrl}/serviceModels.htm`; |
Sara Weiss | d6c8504 | 2019-12-12 13:45:32 +0200 | [diff] [blame] | 129 | |
Ittay Stern | e8dd99b | 2019-12-31 17:15:34 +0200 | [diff] [blame] | 130 | cy.getElementByDataTestsId(`row-${templateJobIdFromE2EFile}`).click(); |
Ittay Stern | 035cbb9 | 2019-12-26 09:39:43 +0200 | [diff] [blame] | 131 | cy.getElementByDataTestsId('LoadTemplateButton').click().setViewportToDefault(); |
Sara Weiss | d6c8504 | 2019-12-12 13:45:32 +0200 | [diff] [blame] | 132 | |
| 133 | cy.location().should((loc) => { |
Ittay Stern | e8dd99b | 2019-12-31 17:15:34 +0200 | [diff] [blame] | 134 | expect(loc.toString()).to.eq(`${vidBaseUrl}#/servicePlanning/RECREATE?serviceModelId=${serviceModelId}&jobId=${templateJobIdFromE2EFile}`); |
Sara Weiss | d6c8504 | 2019-12-12 13:45:32 +0200 | [diff] [blame] | 135 | }); |
| 136 | }); |
| 137 | |
Yoav Schneiderman | 2603481 | 2019-12-03 12:55:39 +0200 | [diff] [blame] | 138 | }); |
| 139 | |