aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/cypress/integration/deployment-artifacts.composition.spec.js
blob: edd200b80544d8c491729517dfb8073a5cc164f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import { initCommonFixtures } from "../common/init";

describe('Deployment Artifacts', () => {
    beforeEach(() => {
        cy.server();
        initCommonFixtures(cy);

        cy.fixture('deployment-artifacts/metadata-service-with-vsp').as('metadata');
        cy.fixture('deployment-artifacts/metadata-service-checkedin-with-vsp').as('metadataCheckedInService');
        cy.fixture('deployment-artifacts/full-data-service-with-vsp').as('fullData');
        cy.fixture('deployment-artifacts/vsp-deployment-artifacts').as('vsp-deployment-artifacts');
        cy.fixture('deployment-artifacts/updated-vsp-deployment-artifacts').as('updated-vsp-deployment-artifacts');
        cy.fixture('deployment-artifacts/heat-env-post-result').as('heat-env-result');
        cy.fixture('deployment-artifacts/vsp.json').as('vsp');
        cy.fixture('deployment-artifacts/service-deployment-artifacts.json').as('service-deployment-artifacts');

        cy.route('GET', '**/services/*/filteredDataByParams?include=deploymentArtifacts', '@service-deployment-artifacts');
        cy.route('GET', '**/services/*/filteredDataByParams?include=componentInstancesRelations&include=componentInstances&include=nonExcludedPolicies&include=nonExcludedGroups&include=forwardingPaths', '@fullData');
        cy.route('GET', '**/services/*/resourceInstances/*/artifactsByType/DEPLOYMENT', '@vsp-deployment-artifacts');
        cy.route('GET', '**/resources/*', '@vsp');
        cy.route('POST', '**/services/*/resourceInstance/*/artifacts/*', '@heat-env-result');
    });

    it('Test the timeout update in composition deployment artifacts tab', function () {
        cy.route('GET', '**/services/*/filteredDataByParams?include=metadata', '@metadata');

        const compositionPageUrl = '#!/dashboard/workspace/' + this.metadata.metadata.uniqueId + '/service/composition/details';
        cy.visit(compositionPageUrl);

        console.log('Wait for the canvas to be visible');
        cy.get('canvas-search').should('be.visible');

        console.log('Click on the component instance via the testBridge');
        cy.window().its('testBridge').invoke('selectComponentInstance', ['VSP1']);

        console.log('Click on Deployment Artifacts Tab');
        cy.get('.component-details-panel-tabs sdc-tabs ul').children('li[ng-reflect-text="Deployment Artifacts"]').trigger('click', { force: true });

        console.log('Click on edit artifact - base_ldsa (modal should be opened');
        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

        console.log('Make sure timeout field is visible');
        cy.get('[data-tests-id="deploymentTimeout"]').should('be.visible').should('have.value', '2');

        console.log('Update the route to return the new updated artifact');
        cy.route('GET', '**/services/*/resourceInstances/*/artifactsByType/DEPLOYMENT', '@updated-vsp-deployment-artifacts');

        console.log('Click 3 as input changing the input value from 2 to 23. Then click Save. Modal should be closed');
        cy.get('[data-tests-id="deploymentTimeout"]').type('3');
        cy.get('[data-tests-id="envParams-button-save"]').click();
        cy.wait(1000);
        console.log('Click edit again to open modal and then make sure the updated value is in the field.');
        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
        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
        cy.get('[data-tests-id="deploymentTimeout"]').should('be.visible').should('have.value', '23'); // Check value

        console.log('Make sure artifact timeout values (min and max) are set according to configuration that was accepted from server (setup-ui.json fixture)');
        cy.get('[data-tests-id="deploymentTimeout"]').should('have.attr', 'max', '150')
        cy.get('[data-tests-id="deploymentTimeout"]').should('have.attr', 'min', '2')
    });

    it('Test that readonly modal is opened in case service is in Checkin state', function () {
        cy.route('GET', '**/services/*/filteredDataByParams?include=metadata', '@metadataCheckedInService');

        const compositionPageUrl = '#!/dashboard/workspace/' + this.metadata.metadata.uniqueId + '/service/composition/details';
        cy.visit(compositionPageUrl);

        console.log('Wait for the canvas to be visible');
        cy.get('canvas-search').should('be.visible');

        console.log('Click on the component instance via the testBridge');
        cy.window().its('testBridge').invoke('selectComponentInstance', ['VSP1']);

        console.log('Click on Deployment Artifacts Tab');
        cy.get('.component-details-panel-tabs sdc-tabs ul').children('li[ng-reflect-text="Deployment Artifacts"]').trigger('click', { force: true });

        console.log('Click on edit artifact - base_ldsa (modal should be opened');
        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

        cy.get('[data-tests-id="deploymentTimeout"]').should('be.disabled').should('have.value', '2');
        cy.get('[data-tests-id="value-field-of-vnf_name"]').should('be.disabled');

        cy.get('[data-tests-id="envParams-button-save"]').should('not.be.visible');
    });

});