blob: 16ed21935f0cb9ea0cec3e737fe9622fc887140b [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(() => {
Ittay Stern32dbf802019-10-29 12:58:49 +020012 cy.clearSessionStorage();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030013 cy.setReduxState();
14 cy.preventErrorsOnLoading();
Ittay Stern607ea3d2019-10-23 17:10:52 +030015 jsonBuilderInstantiationBuilder.basicMock('cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json',
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030016 Cypress.config('baseUrl') + "/asyncInstantiation**");
17 cy.initAAIMock();
18 cy.initVidMock();
Ittay Stern6f900cc2018-08-29 17:01:32 +030019 cy.initAsyncInstantiation();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030020 cy.login();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030021 });
22
Ittay Stern6f900cc2018-08-29 17:01:32 +030023 afterEach(() => {
24 cy.screenshot();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030025 });
Ittay Stern6f900cc2018-08-29 17:01:32 +030026
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(()=>{
Ittay Stern035cbb92019-12-26 09:39:43 +020033 cy.setViewportToSmallPopup();
Ittay Stern6f900cc2018-08-29 17:01:32 +030034 cy.get('#service-model-name').should('contain', row.find('#serviceModelName').text().trim())
35 .getElementByDataTestsId('model-item-value-userId').should('contain', row.find('#userId').text().trim())
36 .get('#service-instantiation-audit-info-vid').should('be.visible')
37 .get('#service-instantiation-audit-info-vid').find('#vidJobStatus').should('be.visible')
38 .get('#service-instantiation-audit-info-mso').should('be.visible')
39 .get('#service-instantiation-audit-info-mso').find('#msoJobStatus').should('be.visible')
Ittay Stern035cbb92019-12-26 09:39:43 +020040 .get('#cancelButton').click({force: true})
41 .setViewportToDefault();
Ittay Stern6f900cc2018-08-29 17:01:32 +030042 })
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(() => {
Ittay Stern035cbb92019-12-26 09:39:43 +020051 cy.setViewportToSmallPopup();
Ittay Stern6f900cc2018-08-29 17:01:32 +030052 cy.get('#service-instantiation-audit-info-mso thead tr th#instanceName').should("not.be.visible")
53 .get('#service-instantiation-audit-info-mso tbody tr td.msoInstanceName').should("not.be.visible");
54 })
55 })
56 });
57
58 it('should show instance name in mso table on a la carte service', function () {
59 cy.readFile('../vid-automation/src/test/resources/a-la-carte/auditInfoMSOALaCarte.json').then((res) => {
60 cy.initAuditInfoMSOALaCarte(res);
61 cy.openIframe('app/ui/#/instantiationStatus');
62 cy.get('.icon-menu').eq(7).click({force:true}).then(() => {
63 cy.getElementByDataTestsId('context-menu-audit-info').click({force:true}).then(() => {
Ittay Stern035cbb92019-12-26 09:39:43 +020064 cy.setViewportToSmallPopup();
Ittay Stern6f900cc2018-08-29 17:01:32 +030065 cy.get('#service-instantiation-audit-info-mso thead tr th#instanceName').should("be.visible")
66 .get('#service-instantiation-audit-info-mso tbody tr').each(function (row, index) {
67 assert.equal(row.find('.request-id').text().trim(), res[index]['requestId']);
68 assert.equal(row.find('.msoInstanceName').text().trim(), 'service: ' + res[index]['instanceName']);
69 assert.equal(row.find('#msoJobStatus').text().trim(), _.capitalize(res[index]['jobStatus']));
70 assert.equal(row.find('#msoAdditionalInfo span').text().trim(), res[index]['additionalInfo']);
71 });
72 });
73 })
74 })
75 });
76
77 it('glossary should be visible', function () {
78 cy.openIframe('app/ui/#/instantiationStatus');
79 cy.get('.icon-menu').eq(7).click().then(() => {
80 cy.getElementByDataTestsId('context-menu-audit-info').click().then(() => {
Ittay Stern035cbb92019-12-26 09:39:43 +020081 cy.setViewportToSmallPopup();
Ittay Stern6f900cc2018-08-29 17:01:32 +030082 cy.get('#glossary_link').should('be.visible');
83 });
84 })
85 });
86
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030087 });
88});