1 ///<reference path="../../../node_modules/cypress/types/index.d.ts"/>
2 describe('Service popup', function () {
3 describe('basic UI tests', () => {
6 cy.clearSessionStorage();
8 cy.preventErrorsOnLoading();
18 it('a-la-carte service instantiation popup has all required fields ', function () {
19 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => {
20 res1.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].service.vidNotions.instantiationType = 'ALaCarte';
21 cy.setReduxState(<any>res1);
22 cy.openPopupIframe('/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');
33 it('a-la-carte service instantiation popup has Instance name as required', function () {
34 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => {
35 res1.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].service.vidNotions.instantiationType = 'ALaCarte';
36 let isEcompNaming = false;
37 res1.service.serviceHierarchy["2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"].service.serviceEcompNaming = isEcompNaming.toString();
38 cy.setReduxState(<any>res1);
39 cy.openPopupIframe('/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');
45 it('should contains basic selects with required astrix', function () {
46 cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true');
47 cy.isElementContainsAttr('form-set', 'disabled');
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')
54 .get('label').contains('AIC zone:').should('not.have.class', 'required')
55 .get('label').contains('Project').should('not.have.class', 'required')
56 .get('label').contains('Rollback on failure').should('have.class', 'required');
59 it('should be able fill all selects', function () {
60 cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true');
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');
67 cy.selectDropdownOptionByText('aic_zone', 'NFTJSSSS-NFT1');
68 cy.selectDropdownOptionByText('project', 'WATKINS');
69 cy.selectDropdownOptionByText('owningEntity', 'aaa1');
70 cy.selectDropdownOptionByText('rollback', 'Rollback');
74 it('should display error when api return empty data', function () {
75 cy.initCategoryParameter(<any>{});
76 cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res1) => {
77 res1.service.categoryParameters.owningEntityList = [];
78 cy.setReduxState(<any>res1);
79 cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true');
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.');
86 it('when open service popup should show showPrevious button', () => {
87 cy.openPopupIframe('/app/ui/#/servicePopup?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd&isCreate=true');
88 cy.getElementByDataTestsId('ShowPreviousInstancesButton').contains('Previous Instantiation').click();