Merge "change management cypress test"
[vid.git] / vid-webpack-master / cypress / integration / iFrames / service.popup.e2e.ts
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     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.vidNotions.instantiationType = 'ALaCarte';
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.vidNotions.instantiationType = 'ALaCarte';
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
47     it('should contains basic selects with required astrix', function () {
48       cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true');
49       cy.isElementContainsAttr('form-set', 'disabled');
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')
56         .get('label').contains('AIC zone:').should('not.have.class', 'required')
57         .get('label').contains('Project').should('not.have.class', 'required')
58         .get('label').contains('Rollback on failure').should('have.class', 'required');
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
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');
69       cy.selectDropdownOptionByText('aic_zone', 'NFTJSSSS-NFT1');
70       cy.selectDropdownOptionByText('project', 'WATKINS');
71       cy.selectDropdownOptionByText('owningEntity', 'aaa1');
72       cy.selectDropdownOptionByText('rollback', 'Rollback');
73
74     });
75
76     it('should display error when api return empty data', function () {
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);
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 });
89