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 | |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 16 | afterEach(() => { |
| 17 | cy.screenshot(); |
| 18 | }); |
| 19 | |
| 20 | it('a-la-carte service instantiation popup has all required fields ', function () { |
| 21 | cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => { |
| 22 | res1.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].service.instantiationType = 'A-LA-Carte'; |
| 23 | cy.setReduxState(<any>res1); |
| 24 | cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); |
| 25 | cy.isElementContainsAttr('form-set', 'disabled'); |
| 26 | cy.get('label').contains('Instance name:').should('not.have.class', 'required') |
| 27 | .get('label').contains('Subscriber name:').should('have.class', 'required') |
| 28 | .get('label').contains('Service type:').should('have.class', 'required') |
| 29 | .get('label').contains('Owning entity:').should('have.class', 'required') |
| 30 | .get('label').contains('Project').should('not.have.class', 'required') |
| 31 | .get('label').contains('Rollback on failure').should('have.class', 'required'); |
| 32 | }); |
| 33 | }); |
| 34 | |
| 35 | it('a-la-carte service instantiation popup has Instance name as required', function () { |
| 36 | cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => { |
| 37 | res1.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].service.instantiationType = 'A-LA-Carte'; |
| 38 | let isEcompNaming = false; |
| 39 | res1.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].service.serviceEcompNaming = isEcompNaming.toString(); |
| 40 | cy.setReduxState(<any>res1); |
| 41 | cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); |
| 42 | cy.isElementContainsAttr('form-set', 'disabled'); |
| 43 | cy.get('label').contains('Instance name:').should('have.class', 'required'); |
| 44 | }); |
| 45 | }); |
| 46 | |
Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 47 | it('should contains basic selects with required astrix', function () { |
| 48 | cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 49 | cy.isElementContainsAttr('form-set', 'disabled'); |
Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 50 | cy.get('label').contains('Subscriber name:').should('have.class', 'required') |
| 51 | .get('label').contains('Service type:').should('have.class', 'required') |
| 52 | .get('label').contains('LCP region:').should('have.class', 'required') |
| 53 | .get('label').contains('Tenant:').should('have.class', 'required') |
| 54 | .get('label').contains('Owning entity:').should('have.class', 'required') |
| 55 | .get('label').contains('Product family:').should('have.class', 'required') |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 56 | .get('label').contains('AIC zone:').should('not.have.class', 'required') |
Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 57 | .get('label').contains('Project').should('not.have.class', 'required') |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 58 | .get('label').contains('Rollback on failure').should('have.class', 'required'); |
Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 59 | }); |
| 60 | |
| 61 | it('should be able fill all selects', function () { |
| 62 | cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); |
| 63 | |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 64 | cy.selectDropdownOptionByText('subscriberName', 'SILVIA ROBBINS'); |
| 65 | cy.selectDropdownOptionByText('serviceType', 'TYLER SILVIA'); |
| 66 | cy.selectDropdownOptionByText('productFamily', 'TYLER SILVIA'); |
| 67 | cy.selectDropdownOptionByText('lcpRegion', 'hvf6'); |
| 68 | cy.selectDropdownOptionByText('tenant', 'AIN Web Tool-15-D-testalexandria'); |
Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 69 | cy.selectDropdownOptionByText('aic_zone', 'NFTJSSSS-NFT1'); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 70 | cy.selectDropdownOptionByText('project', 'WATKINS'); |
Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 71 | cy.selectDropdownOptionByText('owningEntity', 'aaa1'); |
| 72 | cy.selectDropdownOptionByText('rollback', 'Rollback'); |
| 73 | |
| 74 | }); |
| 75 | |
| 76 | it('should display error when api return empty data', function () { |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 77 | cy.initCategoryParameter(<any>{}); |
| 78 | cy.readFile('/cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => { |
| 79 | res1.service.categoryParameters.owningEntityList = []; |
| 80 | cy.setReduxState(<any>res1); |
Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame] | 81 | cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true'); |
| 82 | |
| 83 | cy.get('.message').contains('No results for this request. Please change criteria.'); |
| 84 | cy.get('form-general-error').contains('Page contains errors. Please see details next to the relevant fields.'); |
| 85 | }); |
| 86 | }); |
| 87 | }); |
| 88 | }); |
Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 89 | |