blob: f0db2c9e18fe3bed6c9de68703e3b810d79bb986 [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
Ittay Stern6f900cc2018-08-29 17:01:32 +03002import {JsonBuilder} from '../../support/jsonBuilders/jsonBuilder';
3import {AsyncInstantiationModel} from '../../support/jsonBuilders/models/asyncInstantiation.model';
4import * as _ from 'lodash';
5import {ServiceModel} from "../../support/jsonBuilders/models/service.model";
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03006
7describe('Audit information modal', function () {
8 describe('basic UI tests', () => {
Ittay Stern6f900cc2018-08-29 17:01:32 +03009 var jsonBuilderInstantiationBuilder: JsonBuilder<AsyncInstantiationModel> = new JsonBuilder<AsyncInstantiationModel>();
10 var jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030011 beforeEach(() => {
12 cy.window().then((win) => {
13 win.sessionStorage.clear();
14 cy.setReduxState();
15 cy.preventErrorsOnLoading();
16 jsonBuilderInstantiationBuilder.basicMock('/cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json',
17 Cypress.config('baseUrl') + "/asyncInstantiation**");
18 cy.initAAIMock();
19 cy.initVidMock();
Ittay Stern6f900cc2018-08-29 17:01:32 +030020 cy.initAsyncInstantiation();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030021 cy.login();
22 })
23 });
24
Ittay Stern6f900cc2018-08-29 17:01:32 +030025 afterEach(() => {
26 cy.screenshot();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030027 });
Ittay Stern6f900cc2018-08-29 17:01:32 +030028
29 it(`should display 2 tables with information's`, function () {
30 cy.initAuditInfoMSOALaCarte();
31 cy.openIframe('app/ui/#/instantiationStatus');
32 cy.get('.instantiation-status-data tbody tr').each(function (row, index) {
33 cy.get('.icon-menu').eq(index).click({force: true}).then(()=>{
34 cy.getElementByDataTestsId('context-menu-audit-info').click({force:true}).then(()=>{
35 cy.get('#service-model-name').should('contain', row.find('#serviceModelName').text().trim())
36 .getElementByDataTestsId('model-item-value-userId').should('contain', row.find('#userId').text().trim())
37 .get('#service-instantiation-audit-info-vid').should('be.visible')
38 .get('#service-instantiation-audit-info-vid').find('#vidJobStatus').should('be.visible')
39 .get('#service-instantiation-audit-info-mso').should('be.visible')
40 .get('#service-instantiation-audit-info-mso').find('#msoJobStatus').should('be.visible')
41 .get('#cancelButton').click({force:true});
42 })
43 });
44 });
45 });
46
47 it("shouldn't show instance name in mso table on macro service", function () {
48 cy.openIframe('app/ui/#/instantiationStatus');
49 cy.get('.icon-menu').eq(0).click({force:true}).then(() => {
50 cy.getElementByDataTestsId('context-menu-audit-info').click({force:true}).then(() => {
51 cy.get('#service-instantiation-audit-info-mso thead tr th#instanceName').should("not.be.visible")
52 .get('#service-instantiation-audit-info-mso tbody tr td.msoInstanceName').should("not.be.visible");
53 })
54 })
55 });
56
57 it('should show instance name in mso table on a la carte service', function () {
58 cy.readFile('../vid-automation/src/test/resources/a-la-carte/auditInfoMSOALaCarte.json').then((res) => {
59 cy.initAuditInfoMSOALaCarte(res);
60 cy.openIframe('app/ui/#/instantiationStatus');
61 cy.get('.icon-menu').eq(7).click({force:true}).then(() => {
62 cy.getElementByDataTestsId('context-menu-audit-info').click({force:true}).then(() => {
63 cy.get('#service-instantiation-audit-info-mso thead tr th#instanceName').should("be.visible")
64 .get('#service-instantiation-audit-info-mso tbody tr').each(function (row, index) {
65 assert.equal(row.find('.request-id').text().trim(), res[index]['requestId']);
66 assert.equal(row.find('.msoInstanceName').text().trim(), 'service: ' + res[index]['instanceName']);
67 assert.equal(row.find('#msoJobStatus').text().trim(), _.capitalize(res[index]['jobStatus']));
68 assert.equal(row.find('#msoAdditionalInfo span').text().trim(), res[index]['additionalInfo']);
69 });
70 });
71 })
72 })
73 });
74
75 it('glossary should be visible', function () {
76 cy.openIframe('app/ui/#/instantiationStatus');
77 cy.get('.icon-menu').eq(7).click().then(() => {
78 cy.getElementByDataTestsId('context-menu-audit-info').click().then(() => {
79 cy.get('#glossary_link').should('be.visible');
80 });
81 })
82 });
83
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030084 });
85});