1 ///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2 describe('Template', () => {
3 const templateJobIdFromE2EFile = 'ef3430f8-6350-454c-a7c2-89ba301522c1';
5 const aSecondTemplateInfo = {
7 created: 1525075968000,
8 modified: 1525075971000,
15 jobId: "13063a83-924e-4500-a3a1-e53d1b58450b",
16 templateId: "d42ba7c8-9e19-4e34-ae2c-d8af3f24498e",
19 msoRequestId: "c0011670-0e1a-4b74-945d-8bf5aede1d9d",
20 jobStatus: "IN_PROGRESS",
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_001",
37 serviceModelId: "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0",
38 serviceModelName: "action-data",
39 serviceModelVersion: "1.0",
40 createdBulkDate: 1525075968000,
45 cy.clearSessionStorage();
47 cy.preventErrorsOnLoading();
52 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json').then((flags) => {
58 url: Cypress.config('baseUrl') + "/flags**",
60 "FLAG_VF_MODULE_RESUME_STATUS_CREATE": false,
61 "FLAG_2004_INSTANTIATION_TEMPLATES_POPUP": true
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 ]
72 cy.route(Cypress.config('baseUrl') + "/getuserID", 'us16807000');
74 cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true&isInstantiationTemplateExists=true');
82 it('when open service popup should show template button', function () {
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.')
88 .getElementByDataTestsId('description-part-3').contains('Once you selecting one allows you to change the data before start instantiating.');
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');
98 // check table body row
99 cy.getElementByDataTestsId(`userId-${templateJobIdFromE2EFile}`).contains('16807000');
100 cy.getElementByDataTestsId(`createDate-${templateJobIdFromE2EFile}`).contains('2019-12-26 11:57:05');
101 cy.getElementByDataTestsId(`instanceName-${templateJobIdFromE2EFile}`).contains('SERVICE_NAME');
102 cy.getElementByDataTestsId(`instantiationStatus-${templateJobIdFromE2EFile}`).contains('IN_PROGRESS');
103 cy.getElementByDataTestsId(`summary-${templateJobIdFromE2EFile}`).contains('vnf: 1, vfModule: 2, volumeGroup: 1');
104 cy.getElementByDataTestsId(`region-${templateJobIdFromE2EFile}`).contains('hvf3 (SOMENAME)');
105 cy.getElementByDataTestsId(`tenant-${templateJobIdFromE2EFile}`).contains('greatTenant');
108 //check load button is disabled
109 cy.getElementByDataTestsId('LoadTemplateButton').should('be.disabled');
110 cy.getElementByDataTestsId(`row-${templateJobIdFromE2EFile}`).click();
111 cy.getElementByDataTestsId('LoadTemplateButton').should('not.be.disabled');
114 cy.get('.member-table-row').should('have.length', 2);
115 cy.getElementByDataTestsId('filterByUserIdTestId').click();
116 cy.get('.member-table-row').should('have.length', 1);
119 // navigate to service modal -> should show Template button
120 cy.getElementByDataTestsId('startFromScratchButton').click().then(()=>{
121 cy.getElementByDataTestsId('templateButton').should('be.visible')
126 it('clicking on load template button, go to expected url', function () {
127 cy.getElementByDataTestsId('templateButton').contains('Template')
128 .getElementByDataTestsId('templateButton').click({force: true}) // Open template Modal
130 const serviceModelId = '5c9e863f-2716-467b-8799-4a67f378dcaa';
131 const vidBaseUrl = `${Cypress.config().baseUrl}/serviceModels.htm`;
133 cy.getElementByDataTestsId(`row-${templateJobIdFromE2EFile}`).click();
134 cy.getElementByDataTestsId('LoadTemplateButton').click().setViewportToDefault();
136 cy.location().should((loc) => {
137 expect(loc.toString()).to.eq(`${vidBaseUrl}#/servicePlanning/RECREATE?serviceModelId=${serviceModelId}&jobId=${templateJobIdFromE2EFile}`);