Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 1 | ///<reference path="../../../node_modules/cypress/types/index.d.ts"/> |
| 2 | describe('Service popup', function () { |
| 3 | describe('basic UI tests', () => { |
| 4 | |
| 5 | beforeEach(() => { |
| 6 | cy.window().then((win) => { |
| 7 | win.sessionStorage.clear(); |
| 8 | cy.setReduxState(); |
| 9 | cy.preventErrorsOnLoading(); |
| 10 | cy.initAAIMock(); |
| 11 | cy.initVidMock(); |
| 12 | cy.login(); |
| 13 | }) |
| 14 | }); |
| 15 | |
| 16 | it('should contains basic selects with required astrix', function () { |
| 17 | cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); |
| 18 | cy.isElementContainsAttr('service-form-set', 'disabled'); |
| 19 | cy.get('label').contains('Subscriber name:').should('have.class', 'required') |
| 20 | .get('label').contains('Service type:').should('have.class', 'required') |
| 21 | .get('label').contains('LCP region:').should('have.class', 'required') |
| 22 | .get('label').contains('Tenant:').should('have.class', 'required') |
| 23 | .get('label').contains('Owning entity:').should('have.class', 'required') |
| 24 | .get('label').contains('Product family:').should('have.class', 'required') |
| 25 | .get('label').contains('AIC Zone:').should('not.have.class', 'required') |
| 26 | .get('label').contains('Project').should('not.have.class', 'required') |
| 27 | .get('label').contains('Rollback On Failure').should('have.class', 'required'); |
| 28 | }); |
| 29 | |
| 30 | it('should be able fill all selects', function () { |
| 31 | cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); |
| 32 | |
| 33 | cy.selectDropdownOptionByText('subscriberName', 'USP VOICE'); |
| 34 | cy.selectDropdownOptionByText('serviceType', 'VIRTUAL USP'); |
| 35 | cy.selectDropdownOptionByText('productFamily', 'VIRTUAL USP'); |
| 36 | cy.selectDropdownOptionByText('lcpRegion', 'mtn6'); |
| 37 | cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testgamma'); |
| 38 | cy.selectDropdownOptionByText('aic_zone', 'NFTJSSSS-NFT1'); |
| 39 | cy.selectDropdownOptionByText('project', 'DFW'); |
| 40 | cy.selectDropdownOptionByText('owningEntity', 'aaa1'); |
| 41 | cy.selectDropdownOptionByText('rollback', 'Rollback'); |
| 42 | |
| 43 | }); |
| 44 | |
| 45 | it('should display error when api return empty data', function () { |
| 46 | cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/categoryParametres.json').then((res)=>{ |
| 47 | res.categoryParameters.owningEntity = []; |
| 48 | cy.initCategoryParameter(<any>res); |
| 49 | |
| 50 | cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); |
| 51 | |
| 52 | cy.get('.message').contains('No results for this request. Please change criteria.'); |
| 53 | cy.get('form-general-error').contains('Page contains errors. Please see details next to the relevant fields.'); |
| 54 | }); |
| 55 | }); |
| 56 | }); |
| 57 | }); |