New audit info screen changes
[vid.git] / vid-webpack-master / cypress / integration / iFrames / auditInfo.modal.e2e.ts
1 ///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2 import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
3 import {AsyncInstantiationModel} from '../../support/jsonBuilders/models/asyncInstantiation.model';
4 import * as _ from 'lodash';
5 import {ServiceModel} from "../../support/jsonBuilders/models/service.model";
6
7 describe('Audit information modal', function () {
8   describe('basic UI tests', () => {
9     var jsonBuilderInstantiationBuilder: JsonBuilder<AsyncInstantiationModel> = new JsonBuilder<AsyncInstantiationModel>();
10     var jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
11     beforeEach(() => {
12         cy.clearSessionStorage();
13         cy.setReduxState();
14         cy.preventErrorsOnLoading();
15         jsonBuilderInstantiationBuilder.basicMock('cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json',
16           Cypress.config('baseUrl') + "/asyncInstantiation**");
17         cy.initAAIMock();
18         cy.initVidMock();
19         cy.initAsyncInstantiation();
20         cy.login();
21     });
22
23     afterEach(() => {
24       cy.screenshot();
25     });
26
27     it(`should display 2 tables with information's`, function () {
28       cy.initAuditInfoMSOALaCarte();
29       cy.openIframe('app/ui/#/instantiationStatus');
30       cy.get('.instantiation-status-data tbody tr').each(function (row, index) {
31         cy.get('.icon-menu').eq(index).click({force: true}).then(()=>{
32           cy.getElementByDataTestsId('context-menu-audit-info').click({force:true}).then(()=>{
33             cy.setViewportToSmallPopup();
34               cy.get('#service-instantiation-audit-info-mso').should('be.visible')
35               .get('#service-instantiation-audit-info-mso').find('#msoJobStatus').should('be.visible')
36               .get('#cancelButton').click({force: true})
37               .setViewportToDefault();
38           })
39         });
40       });
41     });
42
43     it("shouldn't show instance name in mso table on macro service", function () {
44       cy.openIframe('app/ui/#/instantiationStatus');
45       cy.get('.icon-menu').eq(0).click({force:true}).then(() => {
46         cy.getElementByDataTestsId('context-menu-audit-info').click({force:true}).then(() => {
47           cy.setViewportToSmallPopup();
48           cy.get('#service-instantiation-audit-info-mso thead tr th#instanceName').should("not.be.visible")
49             .get('#service-instantiation-audit-info-mso tbody tr td.msoInstanceName').should("not.be.visible");
50         })
51       })
52     });
53
54     it('should show instance name in mso table on a la carte service', function () {
55       cy.readFile('../vid-automation/src/test/resources/a-la-carte/auditInfoMSOALaCarte.json').then((res) => {
56         cy.initAuditInfoMSOALaCarte(res);
57         cy.openIframe('app/ui/#/instantiationStatus');
58         cy.get('.icon-menu').eq(7).click({force:true}).then(() => {
59           cy.getElementByDataTestsId('context-menu-audit-info').click({force:true}).then(() => {
60             cy.setViewportToSmallPopup();
61             cy.get('#service-instantiation-audit-info-mso thead tr th#instanceName').should("be.visible")
62               .get('#service-instantiation-audit-info-mso tbody tr').each(function (row, index) {
63               assert.equal(row.find('#msoRequestId').text().trim(), res[index]['requestId']);
64               assert.equal(row.find('.msoInstanceName').text().trim(), res[index]['instanceName']);
65               assert.equal(row.find('#msoJobStatus').text().trim(), _.capitalize(res[index]['jobStatus']));
66               assert.equal(row.find('#msoAdditionalInfo span').text().trim(), res[index]['additionalInfo']);
67             });
68           });
69         })
70       })
71     });
72
73     it('glossary should be visible', function () {
74       cy.openIframe('app/ui/#/instantiationStatus');
75       cy.get('.icon-menu').eq(7).click().then(() => {
76         cy.getElementByDataTestsId('context-menu-audit-info').click().then(() => {
77           cy.setViewportToSmallPopup();
78           cy.get('#glossary_link').should('be.visible');
79         });
80       })
81     });
82
83     it('Refresh link should be visible and clicking refresh should fetch latest data', function () {
84       cy.initAuditInfoMSOALaCarte();
85       cy.openIframe('app/ui/#/instantiationStatus');
86       cy.get('.instantiation-status-data tbody tr').each(function (row, index) {
87         cy.get('.icon-menu').eq(index).click({force: true}).then(()=>{
88           cy.getElementByDataTestsId('context-menu-audit-info').click({force:true}).then(()=>{
89             cy.setViewportToSmallPopup();
90             cy.get('#refreshButton').should('be.visible');
91           })
92
93           })
94         });
95       });
96
97   });
98 });