ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 1 | import { initCommonFixtures } from "../common/init"; |
| 2 | |
| 3 | describe('Deployment Artifacts', () => { |
| 4 | beforeEach(() => { |
| 5 | cy.server(); |
| 6 | initCommonFixtures(cy); |
| 7 | |
| 8 | cy.fixture('deployment-artifacts/metadata-service-with-vsp').as('metadata'); |
| 9 | cy.fixture('deployment-artifacts/metadata-service-checkedin-with-vsp').as('metadataCheckedInService'); |
| 10 | cy.fixture('deployment-artifacts/full-data-service-with-vsp').as('fullData'); |
| 11 | cy.fixture('deployment-artifacts/vsp-deployment-artifacts').as('vsp-deployment-artifacts'); |
| 12 | cy.fixture('deployment-artifacts/updated-vsp-deployment-artifacts').as('updated-vsp-deployment-artifacts'); |
| 13 | cy.fixture('deployment-artifacts/heat-env-post-result').as('heat-env-result'); |
| 14 | cy.fixture('deployment-artifacts/vsp.json').as('vsp'); |
| 15 | cy.fixture('deployment-artifacts/service-deployment-artifacts.json').as('service-deployment-artifacts'); |
| 16 | |
| 17 | cy.route('GET', '**/services/*/filteredDataByParams?include=deploymentArtifacts', '@service-deployment-artifacts'); |
| 18 | cy.route('GET', '**/services/*/filteredDataByParams?include=componentInstancesRelations&include=componentInstances&include=nonExcludedPolicies&include=nonExcludedGroups&include=forwardingPaths', '@fullData'); |
| 19 | cy.route('GET', '**/services/*/resourceInstances/*/artifactsByType/DEPLOYMENT', '@vsp-deployment-artifacts'); |
| 20 | cy.route('GET', '**/resources/*', '@vsp'); |
| 21 | cy.route('POST', '**/services/*/resourceInstance/*/artifacts/*', '@heat-env-result'); |
| 22 | }); |
| 23 | |
| 24 | it('Test the timeout update in composition deployment artifacts tab', function () { |
| 25 | cy.route('GET', '**/services/*/filteredDataByParams?include=metadata', '@metadata'); |
| 26 | |
| 27 | const compositionPageUrl = '#!/dashboard/workspace/' + this.metadata.metadata.uniqueId + '/service/composition/details'; |
| 28 | cy.visit(compositionPageUrl); |
| 29 | |
| 30 | console.log('Wait for the canvas to be visible'); |
| 31 | cy.get('canvas-search').should('be.visible'); |
| 32 | |
| 33 | console.log('Click on the component instance via the testBridge'); |
| 34 | cy.window().its('testBridge').invoke('selectComponentInstance', ['VSP1']); |
| 35 | |
| 36 | console.log('Click on Deployment Artifacts Tab'); |
| 37 | cy.get('.component-details-panel-tabs sdc-tabs ul').children('li[ng-reflect-text="Deployment Artifacts"]').trigger('click', { force: true }); |
| 38 | |
| 39 | console.log('Click on edit artifact - base_ldsa (modal should be opened'); |
| 40 | cy.get('[data-tests-id="edit-parameters-of-base_ldsa"]').click({ force: true }); // edit icon is not visible until we hover on it so we force to click here |
| 41 | |
| 42 | console.log('Make sure timeout field is visible'); |
| 43 | cy.get('[data-tests-id="deploymentTimeout"]').should('be.visible').should('have.value', '2'); |
| 44 | |
| 45 | console.log('Update the route to return the new updated artifact'); |
| 46 | cy.route('GET', '**/services/*/resourceInstances/*/artifactsByType/DEPLOYMENT', '@updated-vsp-deployment-artifacts'); |
| 47 | |
| 48 | console.log('Click 3 as input changing the input value from 2 to 23. Then click Save. Modal should be closed'); |
| 49 | cy.get('[data-tests-id="deploymentTimeout"]').type('3'); |
| 50 | cy.get('[data-tests-id="envParams-button-save"]').click(); |
| 51 | cy.wait(1000); |
| 52 | console.log('Click edit again to open modal and then make sure the updated value is in the field.'); |
| 53 | cy.get('[data-tests-id="artifactName-base_ldsa"]').should('be.visible'); // Wait for modal to be be closed (wait for artifact label to be visible |
| 54 | cy.get('[data-tests-id="edit-parameters-of-base_ldsa"]').click({ force: true }); // edit icon is not visible until we hover on it so we force to click here |
| 55 | cy.get('[data-tests-id="deploymentTimeout"]').should('be.visible').should('have.value', '23'); // Check value |
| 56 | |
| 57 | console.log('Make sure artifact timeout values (min and max) are set according to configuration that was accepted from server (setup-ui.json fixture)'); |
| 58 | cy.get('[data-tests-id="deploymentTimeout"]').should('have.attr', 'max', '150') |
| 59 | cy.get('[data-tests-id="deploymentTimeout"]').should('have.attr', 'min', '2') |
| 60 | }); |
| 61 | |
| 62 | it('Test that readonly modal is opened in case service is in Checkin state', function () { |
| 63 | cy.route('GET', '**/services/*/filteredDataByParams?include=metadata', '@metadataCheckedInService'); |
| 64 | |
| 65 | const compositionPageUrl = '#!/dashboard/workspace/' + this.metadata.metadata.uniqueId + '/service/composition/details'; |
| 66 | cy.visit(compositionPageUrl); |
| 67 | |
| 68 | console.log('Wait for the canvas to be visible'); |
| 69 | cy.get('canvas-search').should('be.visible'); |
| 70 | |
| 71 | console.log('Click on the component instance via the testBridge'); |
| 72 | cy.window().its('testBridge').invoke('selectComponentInstance', ['VSP1']); |
| 73 | |
| 74 | console.log('Click on Deployment Artifacts Tab'); |
| 75 | cy.get('.component-details-panel-tabs sdc-tabs ul').children('li[ng-reflect-text="Deployment Artifacts"]').trigger('click', { force: true }); |
| 76 | |
| 77 | console.log('Click on edit artifact - base_ldsa (modal should be opened'); |
| 78 | cy.get('[data-tests-id="view-parameters-of-base_ldsa"]').click({ force: true }); // edit icon is not visible until we hover on it so we force to click here |
| 79 | |
| 80 | cy.get('[data-tests-id="deploymentTimeout"]').should('be.disabled').should('have.value', '2'); |
| 81 | cy.get('[data-tests-id="value-field-of-vnf_name"]').should('be.disabled'); |
| 82 | |
| 83 | cy.get('[data-tests-id="envParams-button-save"]').should('not.be.visible'); |
| 84 | }); |
| 85 | |
| 86 | }); |