aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts
blob: 16ed21935f0cb9ea0cec3e737fe9622fc887140b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
import {AsyncInstantiationModel} from '../../support/jsonBuilders/models/asyncInstantiation.model';
import * as _ from 'lodash';
import {ServiceModel} from "../../support/jsonBuilders/models/service.model";

describe('Audit information modal', function () {
  describe('basic UI tests', () => {
    var jsonBuilderInstantiationBuilder: JsonBuilder<AsyncInstantiationModel> = new JsonBuilder<AsyncInstantiationModel>();
    var jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
    beforeEach(() => {
        cy.clearSessionStorage();
        cy.setReduxState();
        cy.preventErrorsOnLoading();
        jsonBuilderInstantiationBuilder.basicMock('cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json',
          Cypress.config('baseUrl') + "/asyncInstantiation**");
        cy.initAAIMock();
        cy.initVidMock();
        cy.initAsyncInstantiation();
        cy.login();
    });

    afterEach(() => {
      cy.screenshot();
    });

    it(`should display 2 tables with information's`, function () {
      cy.initAuditInfoMSOALaCarte();
      cy.openIframe('app/ui/#/instantiationStatus');
      cy.get('.instantiation-status-data tbody tr').each(function (row, index) {
        cy.get('.icon-menu').eq(index).click({force: true}).then(()=>{
          cy.getElementByDataTestsId('context-menu-audit-info').click({force:true}).then(()=>{
            cy.setViewportToSmallPopup();
            cy.get('#service-model-name').should('contain', row.find('#serviceModelName').text().trim())
              .getElementByDataTestsId('model-item-value-userId').should('contain', row.find('#userId').text().trim())
              .get('#service-instantiation-audit-info-vid').should('be.visible')
              .get('#service-instantiation-audit-info-vid').find('#vidJobStatus').should('be.visible')
              .get('#service-instantiation-audit-info-mso').should('be.visible')
              .get('#service-instantiation-audit-info-mso').find('#msoJobStatus').should('be.visible')
              .get('#cancelButton').click({force: true})
              .setViewportToDefault();
          })
        });
      });
    });

    it("shouldn't show instance name in mso table on macro service", function () {
      cy.openIframe('app/ui/#/instantiationStatus');
      cy.get('.icon-menu').eq(0).click({force:true}).then(() => {
        cy.getElementByDataTestsId('context-menu-audit-info').click({force:true}).then(() => {
          cy.setViewportToSmallPopup();
          cy.get('#service-instantiation-audit-info-mso thead tr th#instanceName').should("not.be.visible")
            .get('#service-instantiation-audit-info-mso tbody tr td.msoInstanceName').should("not.be.visible");
        })
      })
    });

    it('should show instance name in mso table on a la carte service', function () {
      cy.readFile('../vid-automation/src/test/resources/a-la-carte/auditInfoMSOALaCarte.json').then((res) => {
        cy.initAuditInfoMSOALaCarte(res);
        cy.openIframe('app/ui/#/instantiationStatus');
        cy.get('.icon-menu').eq(7).click({force:true}).then(() => {
          cy.getElementByDataTestsId('context-menu-audit-info').click({force:true}).then(() => {
            cy.setViewportToSmallPopup();
            cy.get('#service-instantiation-audit-info-mso thead tr th#instanceName').should("be.visible")
              .get('#service-instantiation-audit-info-mso tbody tr').each(function (row, index) {
              assert.equal(row.find('.request-id').text().trim(), res[index]['requestId']);
              assert.equal(row.find('.msoInstanceName').text().trim(), 'service: ' + res[index]['instanceName']);
              assert.equal(row.find('#msoJobStatus').text().trim(), _.capitalize(res[index]['jobStatus']));
              assert.equal(row.find('#msoAdditionalInfo span').text().trim(), res[index]['additionalInfo']);
            });
          });
        })
      })
    });

    it('glossary should be visible', function () {
      cy.openIframe('app/ui/#/instantiationStatus');
      cy.get('.icon-menu').eq(7).click().then(() => {
        cy.getElementByDataTestsId('context-menu-audit-info').click().then(() => {
          cy.setViewportToSmallPopup();
          cy.get('#glossary_link').should('be.visible');
        });
      })
    });

  });
});