Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 1 | ///<reference path="../../../node_modules/cypress/types/index.d.ts"/> |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 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"; |
Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 6 | |
| 7 | describe('Audit information modal', function () { |
| 8 | describe('basic UI tests', () => { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 9 | var jsonBuilderInstantiationBuilder: JsonBuilder<AsyncInstantiationModel> = new JsonBuilder<AsyncInstantiationModel>(); |
| 10 | var jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>(); |
Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 11 | beforeEach(() => { |
Ittay Stern | 32dbf80 | 2019-10-29 12:58:49 +0200 | [diff] [blame] | 12 | cy.clearSessionStorage(); |
Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 13 | cy.setReduxState(); |
| 14 | cy.preventErrorsOnLoading(); |
Ittay Stern | 607ea3d | 2019-10-23 17:10:52 +0300 | [diff] [blame] | 15 | jsonBuilderInstantiationBuilder.basicMock('cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json', |
Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 16 | Cypress.config('baseUrl') + "/asyncInstantiation**"); |
| 17 | cy.initAAIMock(); |
| 18 | cy.initVidMock(); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 19 | cy.initAsyncInstantiation(); |
Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 20 | cy.login(); |
Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 21 | }); |
| 22 | |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 23 | afterEach(() => { |
| 24 | cy.screenshot(); |
Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 25 | }); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 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.get('#service-model-name').should('contain', row.find('#serviceModelName').text().trim()) |
| 34 | .getElementByDataTestsId('model-item-value-userId').should('contain', row.find('#userId').text().trim()) |
| 35 | .get('#service-instantiation-audit-info-vid').should('be.visible') |
| 36 | .get('#service-instantiation-audit-info-vid').find('#vidJobStatus').should('be.visible') |
| 37 | .get('#service-instantiation-audit-info-mso').should('be.visible') |
| 38 | .get('#service-instantiation-audit-info-mso').find('#msoJobStatus').should('be.visible') |
| 39 | .get('#cancelButton').click({force:true}); |
| 40 | }) |
| 41 | }); |
| 42 | }); |
| 43 | }); |
| 44 | |
| 45 | it("shouldn't show instance name in mso table on macro service", function () { |
| 46 | cy.openIframe('app/ui/#/instantiationStatus'); |
| 47 | cy.get('.icon-menu').eq(0).click({force:true}).then(() => { |
| 48 | cy.getElementByDataTestsId('context-menu-audit-info').click({force:true}).then(() => { |
| 49 | cy.get('#service-instantiation-audit-info-mso thead tr th#instanceName').should("not.be.visible") |
| 50 | .get('#service-instantiation-audit-info-mso tbody tr td.msoInstanceName').should("not.be.visible"); |
| 51 | }) |
| 52 | }) |
| 53 | }); |
| 54 | |
| 55 | it('should show instance name in mso table on a la carte service', function () { |
| 56 | cy.readFile('../vid-automation/src/test/resources/a-la-carte/auditInfoMSOALaCarte.json').then((res) => { |
| 57 | cy.initAuditInfoMSOALaCarte(res); |
| 58 | cy.openIframe('app/ui/#/instantiationStatus'); |
| 59 | cy.get('.icon-menu').eq(7).click({force:true}).then(() => { |
| 60 | cy.getElementByDataTestsId('context-menu-audit-info').click({force:true}).then(() => { |
| 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('.request-id').text().trim(), res[index]['requestId']); |
| 64 | assert.equal(row.find('.msoInstanceName').text().trim(), 'service: ' + 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.get('#glossary_link').should('be.visible'); |
| 78 | }); |
| 79 | }) |
| 80 | }); |
| 81 | |
Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 82 | }); |
| 83 | }); |