Templates popup: most of the columns are empty (AIC zone is redundant)
[vid.git] / vid-webpack-master / cypress / integration / iFrames / instantiation.templates.modal.e2e.ts
1 ///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2 describe('Template', () => {
3   const templateJobIdFromE2EFile = 'ef3430f8-6350-454c-a7c2-89ba301522c1';
4
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   };
43
44   beforeEach(() => {
45     cy.clearSessionStorage();
46     cy.setReduxState();
47     cy.preventErrorsOnLoading();
48     cy.initAAIMock();
49     cy.initVidMock();
50     cy.login();
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
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');
73
74     cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true&isInstantiationTemplateExists=true');
75
76   });
77
78   afterEach(() => {
79     cy.screenshot();
80   });
81
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.');
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
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');
106
107
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');
112
113     //filter by userId
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);
117
118
119     // navigate to service modal -> should show Template button
120     cy.getElementByDataTestsId('startFromScratchButton').click().then(()=>{
121       cy.getElementByDataTestsId('templateButton').should('be.visible')
122     });
123
124   });
125
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
129
130     const serviceModelId = '5c9e863f-2716-467b-8799-4a67f378dcaa';
131     const vidBaseUrl = `${Cypress.config().baseUrl}/serviceModels.htm`;
132
133     cy.getElementByDataTestsId(`row-${templateJobIdFromE2EFile}`).click();
134     cy.getElementByDataTestsId('LoadTemplateButton').click().setViewportToDefault();
135
136     cy.location().should((loc) => {
137       expect(loc.toString()).to.eq(`${vidBaseUrl}#/servicePlanning/RECREATE?serviceModelId=${serviceModelId}&jobId=${templateJobIdFromE2EFile}`);
138     });
139   });
140
141 });
142