blob: 7d1a1829db987b2dec3254c877121698b2403b6f [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2describe('Service popup', function () {
3 describe('basic UI tests', () => {
4
5 beforeEach(() => {
Ittay Stern32dbf802019-10-29 12:58:49 +02006 cy.clearSessionStorage();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03007 cy.setReduxState();
8 cy.preventErrorsOnLoading();
9 cy.initAAIMock();
10 cy.initVidMock();
11 cy.login();
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030012 });
13
Ittay Stern6f900cc2018-08-29 17:01:32 +030014 afterEach(() => {
15 cy.screenshot();
16 });
17
18 it('a-la-carte service instantiation popup has all required fields ', function () {
Ittay Stern607ea3d2019-10-23 17:10:52 +030019 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => {
Ittay Sternf7926712019-07-07 19:23:03 +030020 res1.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].service.vidNotions.instantiationType = 'ALaCarte';
Ittay Stern6f900cc2018-08-29 17:01:32 +030021 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 Stern607ea3d2019-10-23 17:10:52 +030034 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => {
Ittay Sternf7926712019-07-07 19:23:03 +030035 res1.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].service.vidNotions.instantiationType = 'ALaCarte';
Ittay Stern6f900cc2018-08-29 17:01:32 +030036 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)ff76b5e2018-07-10 15:57:37 +030045 it('should contains basic selects with required astrix', function () {
46 cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true');
Ittay Stern6f900cc2018-08-29 17:01:32 +030047 cy.isElementContainsAttr('form-set', 'disabled');
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030048 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 Stern6f900cc2018-08-29 17:01:32 +030054 .get('label').contains('AIC zone:').should('not.have.class', 'required')
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030055 .get('label').contains('Project').should('not.have.class', 'required')
Ittay Stern6f900cc2018-08-29 17:01:32 +030056 .get('label').contains('Rollback on failure').should('have.class', 'required');
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030057 });
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 Stern6f900cc2018-08-29 17:01:32 +030062 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)ff76b5e2018-07-10 15:57:37 +030067 cy.selectDropdownOptionByText('aic_zone', 'NFTJSSSS-NFT1');
Ittay Stern6f900cc2018-08-29 17:01:32 +030068 cy.selectDropdownOptionByText('project', 'WATKINS');
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030069 cy.selectDropdownOptionByText('owningEntity', 'aaa1');
70 cy.selectDropdownOptionByText('rollback', 'Rollback');
71
72 });
73
74 it('should display error when api return empty data', function () {
Ittay Stern6f900cc2018-08-29 17:01:32 +030075 cy.initCategoryParameter(<any>{});
Ittay Stern607ea3d2019-10-23 17:10:52 +030076 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => {
Ittay Stern6f900cc2018-08-29 17:01:32 +030077 res1.service.categoryParameters.owningEntityList = [];
78 cy.setReduxState(<any>res1);
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030079 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 Weissef5e3b22019-12-05 13:23:13 +020085
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)ff76b5e2018-07-10 15:57:37 +030093 });
94});
Ittay Stern6f900cc2018-08-29 17:01:32 +030095