blob: 8b9239c5295436ebc4639a50c49136e2acc7603b [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(() => {
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 Stern6f900cc2018-08-29 17:01:32 +030016 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)ff76b5e2018-07-10 15:57:37 +030047 it('should contains basic selects with required astrix', function () {
48 cy.openIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true');
Ittay Stern6f900cc2018-08-29 17:01:32 +030049 cy.isElementContainsAttr('form-set', 'disabled');
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030050 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 Stern6f900cc2018-08-29 17:01:32 +030056 .get('label').contains('AIC zone:').should('not.have.class', 'required')
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030057 .get('label').contains('Project').should('not.have.class', 'required')
Ittay Stern6f900cc2018-08-29 17:01:32 +030058 .get('label').contains('Rollback on failure').should('have.class', 'required');
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030059 });
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 Stern6f900cc2018-08-29 17:01:32 +030064 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)ff76b5e2018-07-10 15:57:37 +030069 cy.selectDropdownOptionByText('aic_zone', 'NFTJSSSS-NFT1');
Ittay Stern6f900cc2018-08-29 17:01:32 +030070 cy.selectDropdownOptionByText('project', 'WATKINS');
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +030071 cy.selectDropdownOptionByText('owningEntity', 'aaa1');
72 cy.selectDropdownOptionByText('rollback', 'Rollback');
73
74 });
75
76 it('should display error when api return empty data', function () {
Ittay Stern6f900cc2018-08-29 17:01:32 +030077 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)ff76b5e2018-07-10 15:57:37 +030081 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 Stern6f900cc2018-08-29 17:01:32 +030089