From 4da295fdc8b0fe5716c5b7eb8b5f50de4a9249de Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 20 Apr 2022 15:22:48 +0200 Subject: [PATCH] test: add generated forms integration tests --- .../camunda-platform/FormDataProps.bpmn | 23 +++++++-- .../camunda-platform/FormDataProps.spec.js | 33 +++++++++++- .../provider/camunda-platform/FormField.bpmn | 15 +++++- .../camunda-platform/FormField.spec.js | 51 ++++++++++++++++++- 4 files changed, 114 insertions(+), 8 deletions(-) diff --git a/test/spec/provider/camunda-platform/FormDataProps.bpmn b/test/spec/provider/camunda-platform/FormDataProps.bpmn index e2d0e1754..e4e4547c1 100644 --- a/test/spec/provider/camunda-platform/FormDataProps.bpmn +++ b/test/spec/provider/camunda-platform/FormDataProps.bpmn @@ -1,5 +1,5 @@ - + @@ -11,10 +11,9 @@ - - - - + + + @@ -35,6 +34,14 @@ + + + + + + + + @@ -44,6 +51,12 @@ + + + + + + diff --git a/test/spec/provider/camunda-platform/FormDataProps.spec.js b/test/spec/provider/camunda-platform/FormDataProps.spec.js index 4b4fc6c99..edf352ef3 100644 --- a/test/spec/provider/camunda-platform/FormDataProps.spec.js +++ b/test/spec/provider/camunda-platform/FormDataProps.spec.js @@ -24,6 +24,8 @@ import CoreModule from 'bpmn-js/lib/core'; import SelectionModule from 'diagram-js/lib/features/selection'; import ModelingModule from 'bpmn-js/lib/features/modeling'; +import BehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-platform'; + import BpmnPropertiesPanel from 'src/render'; import BpmnPropertiesProvider from 'src/provider/bpmn'; @@ -42,7 +44,8 @@ describe('provider/camunda-platform - FormDataProps', function() { CamundaPlatformPropertiesProvider, CoreModule, ModelingModule, - SelectionModule + SelectionModule, + BehaviorsModule ]; const moddleExtensions = { @@ -247,6 +250,34 @@ describe('provider/camunda-platform - FormDataProps', function() { expect(getFormFieldsList(task)).to.have.length(1); })); + + describe('integration', function() { + + it('should remove business key', inject(async function(elementRegistry, selection) { + + // given + const startEvent = elementRegistry.get('StartEvent_3'); + + await act(() => { + selection.select(startEvent); + }); + + // assume + expect(getFormData(startEvent).get('camunda:businessKey')).to.equal('foo'); + + // when + const formDataGroup = domQuery('div[data-group-id=group-CamundaPlatform__FormData]', container); + + const formFieldRemoveButton = domQueryAll('.bio-properties-panel-remove-entry', formDataGroup)[ 0 ]; + + clickInput(formFieldRemoveButton); + + // then + expect(getFormData(startEvent).get('camunda:businessKey')).not.to.exist; + })); + + }); + }); diff --git a/test/spec/provider/camunda-platform/FormField.bpmn b/test/spec/provider/camunda-platform/FormField.bpmn index 2bf44bd78..210131f65 100644 --- a/test/spec/provider/camunda-platform/FormField.bpmn +++ b/test/spec/provider/camunda-platform/FormField.bpmn @@ -1,5 +1,5 @@ - + @@ -62,6 +62,13 @@ + + + + + + + @@ -80,6 +87,12 @@ + + + + + + diff --git a/test/spec/provider/camunda-platform/FormField.spec.js b/test/spec/provider/camunda-platform/FormField.spec.js index b7198edae..c922efae1 100644 --- a/test/spec/provider/camunda-platform/FormField.spec.js +++ b/test/spec/provider/camunda-platform/FormField.spec.js @@ -25,6 +25,8 @@ import CoreModule from 'bpmn-js/lib/core'; import SelectionModule from 'diagram-js/lib/features/selection'; import ModelingModule from 'bpmn-js/lib/features/modeling'; +import BehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-platform'; + import BpmnPropertiesPanel from 'src/render'; import BpmnPropertiesProvider from 'src/provider/bpmn'; @@ -43,7 +45,8 @@ describe('provider/camunda-platform - FormField', function() { CamundaPlatformPropertiesProvider, CoreModule, ModelingModule, - SelectionModule + SelectionModule, + BehaviorsModule ]; const moddleExtensions = { @@ -126,6 +129,29 @@ describe('provider/camunda-platform - FormField', function() { expect(idInput.value).to.eql(originalValue); })); + + describe('integration', function() { + + it('should update', inject(async function(elementRegistry, selection) { + + // given + const event = elementRegistry.get('StartEvent_2'); + + await act(() => { + selection.select(event); + }); + + const idInput = domQuery('input[name=StartEvent_2-formField-0-formFieldID]', container); + + // when + changeInput(idInput, 'bar'); + + // then + expect(getFormData(event).get('camunda:businessKey')).to.equal('bar'); + })); + + }); + }); @@ -421,6 +447,29 @@ describe('provider/camunda-platform - FormField', function() { }); + + describe('integration', function() { + + it('should remove values when type set to boolean', inject(async function(elementRegistry, selection) { + + // given + const userTask = elementRegistry.get('UserTask_2'); + + await act(() => { + selection.select(userTask); + }); + + const typeSelect = domQuery('select[name=UserTask_2-formField-0-formFieldType]', container); + + // when + changeInput(typeSelect, 'boolean'); + + // then + expect(getFormFieldValues(userTask, 0)).to.be.empty; + })); + + }); + });