blob: e6eef0eaedcc1fc4a5e53031c704c48ab826dfea [file] [log] [blame]
ys969316a9fce2020-01-19 13:50:02 +02001import { initCommonFixtures } from "../common/init";
2
3
4describe('Test dependencies rule in service dependencies tab', () => {
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('service-proxy-tabs/service-inputs').as('serviceInputs')
13 cy.fixture('service-proxy-tabs/service-proxy-properties').as('serviceProxyProperties');
14 cy.fixture('service-proxy-tabs/service-proxy-node-filter').as('serviceProxyNodeFilter');
15 cy.fixture('service-proxy-tabs/properties-rules-result').as('getRules');
16 cy.fixture('service-proxy-tabs/add-rule-result').as('addRuleResult');
17 cy.fixture('service-proxy-tabs/update-rule-result').as('updateRuleResult');
18 cy.fixture('service-proxy-tabs/delete-rule-result').as('deleteRuleResult');
19 cy.fixture('service-proxy-tabs/delete-all-rule').as('deleteAllRules');
20 cy.fixture('service-proxy-tabs/service-proxy-after-delete-rules').as('serviceProxydeleteAllRules');
21
22 });
23
24 it('Create update and delete Rule', 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/*', 'fixture:service-proxy-tabs/service-proxy');
29 cy.route('GET', '**/services/*/filteredDataByParams?include=componentInstancesProperties', '@serviceProxyProperties')
30 cy.route('GET', '**/services/*/filteredDataByParams?include=nodeFilter', '@serviceProxyNodeFilter');
31 cy.route('GET', '**/services/*/filteredDataByParams?include=inputs&include=componentInstances&include=componentInstancesProperties&include=properties','fixture:service-proxy-tabs/full-properties');
32
33 cy.route('POST', '**/services/*/resourceInstances/*/nodeFilter', '@getRules');
34 cy.route('POST', '**/services/*/resourceInstances/*/nodeFilter', '@addRuleResult');
35 cy.route('PUT', '**/services/*/resourceInstances/*/nodeFilter', '@updateRuleResult');
36 cy.route('DELETE', '**/services/*/resourceInstances/*/nodeFilter/*', '@deleteRuleResult');
37 cy.route('DELETE', '**/services/*/resourceInstances/*/nodeFilter/*', '@deleteAllRules');
38 cy.route('POST','**/services/*/resourceInstance/*', '@serviceProxydeleteAllRules');
39
40 const compositionPageUrl = '#!/dashboard/workspace/' + this.metadata.metadata.uniqueId + '/service/composition/details';
41 cy.visit(compositionPageUrl);
42
43 // Wait for the canvas to be visible
44 cy.get('canvas-search').should('be.visible');
45
46 // Click on the component instance via the testBridge
47 cy.window().its('testBridge').invoke('selectComponentInstance', ['childservice_proxy']);
48
49 // Click on Service Proxy
50 cy.get('.component-details-panel-tabs sdc-tabs ul').children('li[ng-reflect-text="Service Dependencies"]').trigger('click', { force: true });
51 cy.wait(100);
52 //Add new rule
53 cy.get('[data-tests-id="add-rule-button"]').trigger('click', { force: true });
54 cy.get(':nth-child(1) > .i-sdc-form-select > .ng-valid').select('internalvl0_dhcp_enabled').should('have.value', '0: internalvl0_dhcp_enabled');
55 cy.get('.rule-assigned-value > ui-element-dropdown > .ng-pristine').select('TRUE').should('have.value', '0: true');
56 cy.get('.ng2-modal-footer > .blue').trigger('click', { force: true });
57 //Update rule
58 cy.get(':nth-child(1) > .rule-details > .rule-desc').trigger('click', {force: true});
59 cy.get('.rule-assigned-value > ui-element-dropdown > .ng-pristine').should('have.value', '0: true');
60 cy.get('.rule-assigned-value > ui-element-dropdown > .ng-pristine').select('FALSE').should('have.value', '1: false');
61 cy.get('.ng2-modal-footer > .blue').trigger('click', { force: true });
62 //delete rule
63 cy.get(':nth-child(1) > .rule-details > .delete-icon').trigger('click', {force: true});
64 cy.get('[data-tests-id="Delete"]').trigger('click', {force: true});
65 //delete all role
66 cy.get('[type="checkbox"]').uncheck({ force: true });
67 cy.get('[data-tests-id="Yes"]').trigger('click', {force: true});
68 });
69
70});