blob: 73d3115556e3750087b6530e14785d56bed8376f [file] [log] [blame]
Yoav Schneiderman26034812019-12-03 12:55:39 +02001///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2describe('Template', () => {
Ittay Sterne8dd99b2019-12-31 17:15:34 +02003 const templateJobIdFromE2EFile = 'ef3430f8-6350-454c-a7c2-89ba301522c1';
Yoav Schneiderman26034812019-12-03 12:55:39 +02004
Ittay Sterne8dd99b2019-12-31 17:15:34 +02005 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 Weissd6c85042019-12-12 13:45:32 +020043
Yoav Schneiderman26034812019-12-03 12:55:39 +020044 beforeEach(() => {
45 cy.clearSessionStorage();
46 cy.setReduxState();
47 cy.preventErrorsOnLoading();
48 cy.initAAIMock();
49 cy.initVidMock();
50 cy.login();
Sara Weissd6c85042019-12-12 13:45:32 +020051
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 Sterne8dd99b2019-12-31 17:15:34 +020066 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 Weissd6c85042019-12-12 13:45:32 +020073
Ittay Stern035cbb92019-12-26 09:39:43 +020074 cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true');
Sara Weissd6c85042019-12-12 13:45:32 +020075
Yoav Schneiderman26034812019-12-03 12:55:39 +020076 });
77
78 afterEach(() => {
79 cy.screenshot();
80 });
81
82 it('when open service popup should show template button', function () {
Yoav Schneiderman26034812019-12-03 12:55:39 +020083 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 Sterne8dd99b2019-12-31 17:15:34 +020088 .getElementByDataTestsId('description-part-3').contains('Once you selecting one allows you to change the data before start instantiating.');
Yoav Schneiderman26034812019-12-03 12:55:39 +020089
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 Sterne8dd99b2019-12-31 17:15:34 +0200100 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 Schneiderman26034812019-12-03 12:55:39 +0200108
109
110 //check load button is disabled
Yoav Schneidermaneafbe7e2019-12-17 22:10:31 +0200111 cy.getElementByDataTestsId('LoadTemplateButton').should('be.disabled');
Ittay Sterne8dd99b2019-12-31 17:15:34 +0200112 cy.getElementByDataTestsId(`row-${templateJobIdFromE2EFile}`).click();
Yoav Schneidermaneafbe7e2019-12-17 22:10:31 +0200113 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 Schneiderman26034812019-12-03 12:55:39 +0200119
120 });
Sara Weissd6c85042019-12-12 13:45:32 +0200121
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 Sterne8dd99b2019-12-31 17:15:34 +0200127 const serviceModelId = '5c9e863f-2716-467b-8799-4a67f378dcaa';
Eylon Malinfa4d3e52020-01-02 14:08:31 +0200128 const vidBaseUrl = `${Cypress.config().baseUrl}/serviceModels.htm`;
Sara Weissd6c85042019-12-12 13:45:32 +0200129
Ittay Sterne8dd99b2019-12-31 17:15:34 +0200130 cy.getElementByDataTestsId(`row-${templateJobIdFromE2EFile}`).click();
Ittay Stern035cbb92019-12-26 09:39:43 +0200131 cy.getElementByDataTestsId('LoadTemplateButton').click().setViewportToDefault();
Sara Weissd6c85042019-12-12 13:45:32 +0200132
133 cy.location().should((loc) => {
Ittay Sterne8dd99b2019-12-31 17:15:34 +0200134 expect(loc.toString()).to.eq(`${vidBaseUrl}#/servicePlanning/RECREATE?serviceModelId=${serviceModelId}&jobId=${templateJobIdFromE2EFile}`);
Sara Weissd6c85042019-12-12 13:45:32 +0200135 });
136 });
137
Yoav Schneiderman26034812019-12-03 12:55:39 +0200138});
139