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