diff options
author | Satoshi Fujii <fujii-satoshi@jp.fujitsu.com> | 2020-02-26 15:39:38 +0900 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-03-31 05:19:29 +0000 |
commit | 407bbefe5b0b932f6c6bed65193815c78b4d41b5 (patch) | |
tree | 3b6661c29df42df59d72790b91cfaace4a0dd019 /catalog-ui/cypress | |
parent | 4f02f33f309c3869d231926582f559aa04816063 (diff) |
Add 'required in runtime' for service inputs
User may want to set required to true for some inputs
so that make sure those input values are given at service
instantiation time.
By this change 'required in runtime' column is introduced into
service inputs table in Properties Assignment screen
and user can select required true/false for each input.
Change-Id: I0d676d2d20e02c975d51c7f4d2bb63c699743d66
Issue-ID: SDC-2659
Signed-off-by: Satoshi Fujii <fujii-satoshi@jp.fujitsu.com>
Diffstat (limited to 'catalog-ui/cypress')
-rw-r--r-- | catalog-ui/cypress/fixtures/properties-assignment/service-update-inputs.json | 221 | ||||
-rw-r--r-- | catalog-ui/cypress/integration/property-assignment.spec.js | 54 |
2 files changed, 275 insertions, 0 deletions
diff --git a/catalog-ui/cypress/fixtures/properties-assignment/service-update-inputs.json b/catalog-ui/cypress/fixtures/properties-assignment/service-update-inputs.json new file mode 100644 index 0000000000..fc0c8df252 --- /dev/null +++ b/catalog-ui/cypress/fixtures/properties-assignment/service-update-inputs.json @@ -0,0 +1,221 @@ +[ + { + "uniqueId": "39be5200-143f-4962-a0ad-52882c2df138.mac_requirements", + "type": "string", + "required": true, + "definition": false, + "defaultValue": "new value", + "description": "ddd", + "schema": { + "derivedFrom": null, + "constraints": null, + "properties": null, + "property": { + "uniqueId": null, + "type": "", + "required": false, + "definition": true, + "defaultValue": null, + "description": null, + "schema": null, + "password": false, + "name": null, + "value": null, + "label": null, + "hidden": false, + "immutable": false, + "inputPath": null, + "status": null, + "inputId": null, + "instanceUniqueId": null, + "propertyId": null, + "parentPropertyType": null, + "subPropertyInputPath": null, + "annotations": null, + "parentUniqueId": null, + "getInputValues": null, + "isDeclaredListInput": false, + "getPolicyValues": null, + "getInputProperty": false, + "schemaType": null, + "schemaProperty": null, + "version": null, + "ownerId": null, + "empty": false + }, + "version": null, + "ownerId": null, + "empty": false, + "type": null + }, + "password": false, + "name": "mac_requirements", + "value": null, + "label": null, + "hidden": false, + "immutable": false, + "inputPath": null, + "status": null, + "inputId": null, + "instanceUniqueId": "39be5200-143f-4962-a0ad-52882c2df138", + "propertyId": "39be5200-143f-4962-a0ad-52882c2df138.mac_requirements", + "parentPropertyType": "string", + "subPropertyInputPath": null, + "annotations": null, + "parentUniqueId": "cs0008", + "getInputValues": null, + "isDeclaredListInput": false, + "getPolicyValues": null, + "constraints": [], + "inputs": null, + "properties": null, + "getInputProperty": false, + "schemaType": "", + "schemaProperty": { + "uniqueId": null, + "type": "", + "required": false, + "definition": true, + "defaultValue": null, + "description": null, + "schema": null, + "password": false, + "name": null, + "value": null, + "label": null, + "hidden": false, + "immutable": false, + "inputPath": null, + "status": null, + "inputId": null, + "instanceUniqueId": null, + "propertyId": null, + "parentPropertyType": null, + "subPropertyInputPath": null, + "annotations": null, + "parentUniqueId": null, + "getInputValues": null, + "isDeclaredListInput": false, + "getPolicyValues": null, + "getInputProperty": false, + "schemaType": null, + "schemaProperty": null, + "version": null, + "ownerId": null, + "empty": false + }, + "version": null, + "ownerId": "cs0008", + "empty": false + }, + { + "uniqueId": "693b08c5-bd20-41f4-8d10-81a8d8351944.vl0_segmentation_id", + "type": "string", + "required": false, + "definition": false, + "defaultValue": null, + "description": null, + "schema": { + "derivedFrom": null, + "constraints": null, + "properties": null, + "property": { + "uniqueId": null, + "type": null, + "required": false, + "definition": true, + "defaultValue": null, + "description": null, + "schema": null, + "password": false, + "name": null, + "value": null, + "label": null, + "hidden": false, + "immutable": false, + "inputPath": null, + "status": null, + "inputId": null, + "instanceUniqueId": null, + "propertyId": null, + "parentPropertyType": null, + "subPropertyInputPath": null, + "annotations": null, + "parentUniqueId": null, + "getInputValues": null, + "isDeclaredListInput": false, + "getPolicyValues": null, + "getInputProperty": false, + "schemaType": null, + "schemaProperty": null, + "version": null, + "ownerId": null, + "empty": false + }, + "version": null, + "ownerId": null, + "empty": false, + "type": null + }, + "password": false, + "name": "vl0_segmentation_id", + "value": null, + "label": null, + "hidden": false, + "immutable": false, + "inputPath": null, + "status": null, + "inputId": null, + "instanceUniqueId": "693b08c5-bd20-41f4-8d10-81a8d8351944.6c42f981-f1d1-4b00-b54c-901a653589d2.vl0", + "propertyId": "6619e73b-35ea-45af-baf4-2a90c4b6baf7.segmentation_id", + "parentPropertyType": "string", + "subPropertyInputPath": null, + "annotations": null, + "parentUniqueId": "cs0008", + "getInputValues": null, + "isDeclaredListInput": false, + "getPolicyValues": null, + "constraints": [], + "inputs": null, + "properties": null, + "getInputProperty": false, + "schemaType": null, + "schemaProperty": { + "uniqueId": null, + "type": null, + "required": false, + "definition": true, + "defaultValue": null, + "description": null, + "schema": null, + "password": false, + "name": null, + "value": null, + "label": null, + "hidden": false, + "immutable": false, + "inputPath": null, + "status": null, + "inputId": null, + "instanceUniqueId": null, + "propertyId": null, + "parentPropertyType": null, + "subPropertyInputPath": null, + "annotations": null, + "parentUniqueId": null, + "getInputValues": null, + "isDeclaredListInput": false, + "getPolicyValues": null, + "getInputProperty": false, + "schemaType": null, + "schemaProperty": null, + "version": null, + "ownerId": null, + "empty": false + }, + "version": null, + "ownerId": "cs0008", + "empty": false + } +] + diff --git a/catalog-ui/cypress/integration/property-assignment.spec.js b/catalog-ui/cypress/integration/property-assignment.spec.js index bad6dee730..a13f4f6e06 100644 --- a/catalog-ui/cypress/integration/property-assignment.spec.js +++ b/catalog-ui/cypress/integration/property-assignment.spec.js @@ -12,6 +12,7 @@ describe('Test add property to self in service at property assignment page', () cy.fixture('properties-assignment/service-include-policies').as('serviceIncludePolicies'); cy.fixture('properties-assignment/service-properties').as('serviceProperty'); cy.fixture('properties-assignment/service-update-properties').as('serviceUpdateProperty'); + cy.fixture('properties-assignment/service-update-inputs').as('serviceUpdateInputs'); cy.fixture('properties-assignment/service-proxy-properties').as('serviceProxyProperties'); cy.fixture('properties-assignment/create-policies').as('createPolicy'); cy.fixture('properties-assignment/undeclare-policy').as('undeclarePolicy'); @@ -72,4 +73,57 @@ describe('Test add property to self in service at property assignment page', () cy.get('.properties-table').contains('vl 0 list'); }); + it('update input default value and required in runtime check', function () { + const new_value = 'new value'; + const another_value = 'another'; + cy.route('GET', '**/authorize', '@onapUserData'); + cy.route('GET', '**/services/*/filteredDataByParams?include=metadata', '@metadata'); + cy.route('GET', '**/services/*/filteredDataByParams?include=componentInstancesRelations&include=componentInstances&include=nonExcludedPolicies&include=nonExcludedGroups&include=forwardingPaths', '@fullData'); + cy.route('GET', '**/services/*/filteredDataByParams?include=inputs&include=componentInstances&include=componentInstancesProperties&include=properties','fixture:service-proxy-tabs/full-properties'); + cy.route('GET','**/services/*/filteredDataByParams?include=componentInstances&include=policies&include=nonExcludedGroups', '@serviceIncludePolicies'); + cy.route('GET', '**/services/*/properties', '@serviceProperty'); + cy.route('POST', '**/services/*/properties', '@serviceUpdateProperty'); + cy.route('GET','**/services/*/componentInstances/*/properties','@serviceProxyProperties'); + cy.route('POST', '**/services/*/create/policies', '@createPolicy'); + cy.route('PUT', '**/services/*/policies/*/undeclare','@undeclarePolicy'); + cy.route('POST', '**/services/*/update/inputs', '@serviceUpdateInputs'); + + const compositionPageUrl = '#!/dashboard/workspace/' + this.metadata.metadata.uniqueId + '/service/properties_assignment'; + cy.visit(compositionPageUrl); + + // Go to Inputs tab + cy.get('[data-tests-id="Inputs"]').trigger('click', {force: true}); + cy.get('.table-row').should('have.length', 2); + cy.get('.properties-table').contains('mac_requirements'); + cy.get('.table-body .col4 .sdc-checkbox').first().should('have.attr', 'ng-reflect-checked', 'false'); + cy.get('[data-tests-id="properties-reverse-button"]').should('have.attr', 'disabled'); + // Change default value + cy.get('.table-body .valueCol').first().find('input').type(new_value); + cy.get('.table-body .valueCol').first().find('input').should('have.value', new_value); + cy.get('[data-tests-id="properties-reverse-button"]').should('not.have.attr', 'disabled'); + // Check a required-in-runtime checkbox + cy.get('.table-body .col4 .sdc-checkbox').first().find('input').click({force: true}) + cy.get('.table-body .col4 .sdc-checkbox').first().should('have.attr', 'ng-reflect-checked', 'true'); + cy.get('[data-tests-id="properties-reverse-button"]').should('not.have.attr', 'disabled'); + // Click Discard button + cy.get('[data-tests-id="properties-reverse-button"]').click({force: true}); + cy.get('.table-body .col4 .sdc-checkbox').first().should('have.attr', 'ng-reflect-checked', 'false'); + cy.get('.table-body .valueCol').first().find('input').should('have.value', ''); + // Make changes again and click Save button + cy.get('.table-body .valueCol').first().find('input').type(new_value); + cy.get('.table-body .col4 .sdc-checkbox').first().find('input').click({force: true}) + cy.get('[data-tests-id="properties-save-button"]').click({force: true}); + cy.get('.table-body .valueCol').first().find('input').should('have.value', new_value); + cy.get('.table-body .col4 .sdc-checkbox').first().should('have.attr', 'ng-reflect-checked', 'true'); + // Make changes and try to leave the tab without saving + cy.get('.table-body .valueCol').first().find('input').type(another_value); + cy.get('.table-body .col4 .sdc-checkbox').first().find('input').click({force: true}) + cy.get('[data-tests-id="Properties"]').trigger('click', {force: true}); + cy.get('.sdc-modal .title').should('be.visible'); + cy.get('.sdc-modal .title').contains('Unsaved inputs'); + cy.get('.sdc-modal [data-tests-id="navigate-modal-button-discard"]').click({force: true}); + cy.get('[data-tests-id="Inputs"]').trigger('click', {force: true}); + cy.get('.table-body .valueCol').first().find('input').should('have.value', new_value); + cy.get('.table-body .col4 .sdc-checkbox').first().should('have.attr', 'ng-reflect-checked', 'true'); + }); }); |