ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame^] | 1 | import { initCommonFixtures } from "../common/init"; |
| 2 | |
| 3 | describe('Test modify service consumption in service consumption tab', () => { |
| 4 | beforeEach(() => { |
| 5 | cy.server(); |
| 6 | initCommonFixtures(cy); |
| 7 | cy.fixture('properties-assignment/onap-user-data').as('onapUserData'); |
| 8 | |
| 9 | cy.fixture('service-proxy-tabs/metadata-service-with-service').as('metadata'); |
| 10 | cy.fixture('service-proxy-tabs/full-data-service-with-service').as('fullData'); |
| 11 | cy.fixture('service-proxy-tabs/service-inputs').as('serviceInputs'); |
| 12 | cy.fixture('service-proxy-tabs/update-operation-input').as('updateOperationInput'); |
| 13 | cy.fixture('service-proxy-tabs/service-input-update-value').as('inputsUpdateValue'); |
| 14 | }); |
| 15 | |
| 16 | it('Update property', function () { |
| 17 | cy.route('GET', '**/authorize', '@onapUserData'); |
| 18 | cy.route('GET', '**/services/*/filteredDataByParams?include=metadata', '@metadata'); |
| 19 | cy.route('GET', '**/services/*/filteredDataByParams?include=componentInstancesRelations&include=componentInstances&include=nonExcludedPolicies&include=nonExcludedGroups&include=forwardingPaths', '@fullData'); |
| 20 | cy.route('GET', '**/services/*', 'fixture:service-proxy-tabs/service-proxy'); |
| 21 | cy.route('GET', '**/services/*/filteredDataByParams?include=componentInstancesProperties&include=inputs&include=componentInstances&include=capabilities', 'fixture:service-proxy-tabs/service-with-capabilities-requirment'); |
| 22 | cy.route('GET', '**/services/*/filteredDataByParams?include=componentInstancesInterfaces&include=componentInstancesProperties&include=componentInstancesInputs&include=inputs&include=componentInstances&include=capabilities','fixture:service-proxy-tabs/full-data-service-proxy') |
| 23 | cy.route('GET', '**/services/*/consumption/*/interfaces/*/operations/*/inputs', '@serviceInputs'); |
| 24 | cy.route('POST', '**/services/*/consumption/*', '@updateOperationInput'); |
| 25 | |
| 26 | const compositionPageUrl = '#!/dashboard/workspace/' + this.metadata.metadata.uniqueId + '/service/composition/details'; |
| 27 | cy.visit(compositionPageUrl); |
| 28 | |
| 29 | // Wait for the canvas to be visible |
| 30 | cy.get('canvas-search').should('be.visible'); |
| 31 | |
| 32 | // Click on the component instance via the testBridge |
| 33 | cy.window().its('testBridge').invoke('selectComponentInstance', ['childservice_proxy']); |
| 34 | |
| 35 | // Click on operation consumption Tab |
| 36 | cy.get('.component-details-panel-tabs sdc-tabs ul').children('li[ng-reflect-text="Service Consumption"]').trigger('click', { force: true }); |
| 37 | //update operation property value |
| 38 | cy.get('.operation-data').trigger('click', { force: true }); |
| 39 | cy.get('.operation-input-name').trigger('click', { force: true }); |
| 40 | cy.wait(1000); |
| 41 | cy.get('.value-input').clear().type('update property'); |
| 42 | cy.get('[data-tests-id="Save"]').trigger('click', { force: true }); |
| 43 | //check the changed property |
| 44 | cy.wait(1000); |
| 45 | cy.route('GET', '**/services/*/consumption/*/interfaces/*/operations/*/inputs', '@inputsUpdateValue'); |
| 46 | cy.get('.operation-data').trigger('click', { force: true }); |
| 47 | cy.wait(1000); |
| 48 | cy.get('.operation-input-name').trigger('click', { force: true }); |
| 49 | cy.get('.value-input').should('have.value','update property'); |
| 50 | }); |
| 51 | |
| 52 | }); |