ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame^] | 1 | import { initCommonFixtures } from "../common/init"; |
| 2 | |
| 3 | |
| 4 | describe('Test add property to self in service at property assignment page', () => { |
| 5 | beforeEach(() => { |
| 6 | cy.server(); |
| 7 | initCommonFixtures(cy); |
| 8 | cy.fixture('properties-assignment/onap-user-data').as('onapUserData'); |
| 9 | |
| 10 | cy.fixture('service-proxy-tabs/metadata-service-with-service').as('metadata'); |
| 11 | cy.fixture('service-proxy-tabs/full-data-service-with-service').as('fullData'); |
| 12 | cy.fixture('properties-assignment/service-include-policies').as('serviceIncludePolicies'); |
| 13 | cy.fixture('properties-assignment/service-properties').as('serviceProperty'); |
| 14 | cy.fixture('properties-assignment/service-update-properties').as('serviceUpdateProperty'); |
| 15 | cy.fixture('properties-assignment/service-proxy-properties').as('serviceProxyProperties'); |
| 16 | cy.fixture('properties-assignment/create-policies').as('createPolicy'); |
| 17 | cy.fixture('properties-assignment/undeclare-policy').as('undeclarePolicy'); |
| 18 | //vl |
| 19 | cy.fixture('properties-assignment/vl-properties').as('vlProperties'); |
| 20 | cy.fixture('properties-assignment/vl-list-input').as('vlListInput'); |
| 21 | cy.fixture('properties-assignment/vl-properties-update').as('vlPropertiesUpdate'); |
| 22 | }); |
| 23 | |
| 24 | it('add property to self, declare policy, create inputs list', function () { |
| 25 | cy.route('GET', '**/authorize', '@onapUserData'); |
| 26 | cy.route('GET', '**/services/*/filteredDataByParams?include=metadata', '@metadata'); |
| 27 | cy.route('GET', '**/services/*/filteredDataByParams?include=componentInstancesRelations&include=componentInstances&include=nonExcludedPolicies&include=nonExcludedGroups&include=forwardingPaths', '@fullData'); |
| 28 | cy.route('GET', '**/services/*/filteredDataByParams?include=inputs&include=componentInstances&include=componentInstancesProperties&include=properties','fixture:service-proxy-tabs/full-properties'); |
| 29 | cy.route('GET','**/services/*/filteredDataByParams?include=componentInstances&include=policies&include=nonExcludedGroups', '@serviceIncludePolicies'); |
| 30 | cy.route('GET', '**/services/*/properties', '@serviceProperty'); |
| 31 | cy.route('POST', '**/services/*/properties', '@serviceUpdateProperty'); |
| 32 | cy.route('GET','**/services/*/componentInstances/*/properties','@serviceProxyProperties'); |
| 33 | cy.route('POST', '**/services/*/create/policies', '@createPolicy'); |
| 34 | cy.route('PUT', '**/services/*/policies/*/undeclare','@undeclarePolicy'); |
| 35 | |
| 36 | const compositionPageUrl = '#!/dashboard/workspace/' + this.metadata.metadata.uniqueId + '/service/properties_assignment'; |
| 37 | cy.visit(compositionPageUrl); |
| 38 | // Add property to service |
| 39 | cy.get('.table-row').should('have.length', 2); |
| 40 | cy.get('.add-btn').click(); |
| 41 | cy.get('[data-tests-id="property-name"]').type('new_property'); |
| 42 | cy.get('[data-tests-id="value-property-type"]').select('string'); |
| 43 | cy.get('[data-tests-id="property-description"]').type('new service property'); |
| 44 | cy.get('[data-tests-id="Save"]').trigger('click', {force: true}); |
| 45 | cy.get('.table-row').should('have.length', 3); |
| 46 | //declare policy for service proxy |
| 47 | cy.get('[data-tests-id="childservice_proxy 0"]').trigger('click', {force: true}); |
| 48 | cy.get('.table-body > :nth-child(2) > .col1').find('[type="checkbox"]').check({force: true}); |
| 49 | cy.get('[data-tests-id="declare-button declare-policy"]').trigger('click', {force: true}); |
| 50 | cy.get('[data-tests-id="Policies"]').trigger('click', {force: true}); |
| 51 | cy.get('.properties-table').contains('contrailv2virtualnetwork0_segmentation_id'); |
| 52 | cy.get(':nth-child(3) > .valueCol > .delete-button-container > .sprite-new').trigger('click', {force: true}); |
| 53 | cy.get('[data-tests-id="Delete"]').trigger('click', {force: true}); |
| 54 | cy.get('.properties-table').contains('contrailv2virtualnetwork0_segmentation_id'); |
| 55 | cy.wait(100); |
| 56 | //create list inputs for vl 0 |
| 57 | cy.route('GET','**/services/*/componentInstances/*/properties','@vlProperties'); |
| 58 | cy.route('POST', '**/services/*/create/listInput', '@vlListInput'); |
| 59 | cy.get('[data-tests-id="Composition"]').trigger('click', {force: true}); |
| 60 | cy.get('[data-tests-id="Properties"]').trigger('click', {force: true}); |
| 61 | cy.get('[data-tests-id="VL 0"]').trigger('click', {force: true}); |
| 62 | |
| 63 | cy.get('.table-body > :nth-child(5) > .col1').find('[type="checkbox"]').check({force: true}); |
| 64 | cy.get('.table-body > :nth-child(6) > .col1').find('[type="checkbox"]').check({force: true}); |
| 65 | |
| 66 | cy.get('[data-tests-id="declare-button declare-list-input"]').trigger('click', {force: true}); |
| 67 | cy.get('[data-tests-id="property-name"]').type('vl 0 list'); |
| 68 | cy.get('input[name="typeName"]').type('new schema'); |
| 69 | cy.get('[data-tests-id="property-description"]').type('new list for vl 0 properties'); |
| 70 | cy.get('[data-tests-id="Save"]').trigger('click', {force: true}); |
| 71 | cy.get('[data-tests-id="Inputs"]').trigger('click', {force: true}); |
| 72 | cy.get('.properties-table').contains('vl 0 list'); |
| 73 | }); |
| 74 | |
| 75 | }); |