Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Behavior Integration Tests #671

Merged
merged 11 commits into from
Apr 21, 2022
Merged
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"babel-loader": "^8.2.2",
"bpmn-js": "9.0.3",
"bpmn-moddle": "^7.1.2",
"camunda-bpmn-js-behaviors": "^0.1.0",
"camunda-bpmn-moddle": "^6.1.2",
"chai": "^4.3.4",
"copy-webpack-plugin": "^9.0.0",
Expand Down Expand Up @@ -111,6 +112,7 @@
},
"peerDependencies": {
"bpmn-js": "8.x || 9.x",
"camunda-bpmn-js-behaviors": "0.1.x",
"diagram-js": "7.x || 8.x",
"@bpmn-io/properties-panel": "0.13.x"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0jwfbqx" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0jwfbqx" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.0.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
<bpmn:process id="Process_1" isExecutable="true">
<bpmn:serviceTask id="ServiceTask_1" camunda:asyncAfter="true" camunda:exclusive="false" />
<bpmn:task id="Task_1" camunda:asyncBefore="true" />
<bpmn:startEvent id="StartEvent_1" />
<bpmn:startEvent id="StartEvent_2" camunda:async="true" />
<bpmn:task id="Task_2" name="Async Before" camunda:asyncBefore="true" camunda:exclusive="false" />
<bpmn:task id="Task_3" name="Async After" camunda:asyncAfter="true" camunda:exclusive="false" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="99" width="36" height="36" />
<bpmndi:BPMNShape id="Activity_087j6w5_di" bpmnElement="ServiceTask_1">
<dc:Bounds x="510" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1vzjjl9_di" bpmnElement="Task_1">
<dc:Bounds x="310" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_087j6w5_di" bpmnElement="ServiceTask_1">
<dc:Bounds x="510" y="77" width="100" height="80" />
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0zc9vdy_di" bpmnElement="StartEvent_2">
<dc:Bounds x="179" y="232" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0spk5io_di" bpmnElement="Task_2">
<dc:Bounds x="310" y="210" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1b1lxlh_di" bpmnElement="Task_3">
<dc:Bounds x="510" y="210" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import BpmnPropertiesPanel from 'src/render';
import BpmnPropertiesProvider from 'src/provider/bpmn';
import CamundaPlatformPropertiesProvider from 'src/provider/camunda-platform';

import BehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-platform';

import camundaModdleExtensions from 'camunda-bpmn-moddle/resources/camunda.json';

import processDiagramXML from './AsynchronousContinuationsProps.bpmn';
Expand All @@ -37,7 +39,8 @@ describe('provider/camunda-platform - AsynchronousContinuationsProps', function(
CamundaPlatformPropertiesProvider,
CoreModule,
ModelingModule,
SelectionModule
SelectionModule,
BehaviorsModule
];

const moddleExtensions = {
Expand Down Expand Up @@ -447,6 +450,54 @@ describe('provider/camunda-platform - AsynchronousContinuationsProps', function(
})
);


describe('integration', function() {

it('should set to true if async before set to false', inject(async function(elementRegistry, selection) {

// given
const task = elementRegistry.get('Task_2');

await act(() => {
selection.select(task);
});

// assume
expect(isExclusive(task)).to.be.false;

// when
const asyncBeforeCheckbox = domQuery('input[name=asynchronousContinuationBefore]', container);

clickInput(asyncBeforeCheckbox);

// then
expect(isExclusive(task)).to.be.true;
}));


it('should set to true if async after set to false', inject(async function(elementRegistry, selection) {

// given
const task = elementRegistry.get('Task_3');

await act(() => {
selection.select(task);
});

// assume
expect(isExclusive(task)).to.be.false;

// when
const asyncAfterCheckbox = domQuery('input[name=asynchronousContinuationAfter]', container);

clickInput(asyncAfterCheckbox);

// then
expect(isExclusive(task)).to.be.true;
}));

});

});

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,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';
Expand All @@ -37,7 +39,8 @@ describe('provider/camunda-platform - DmnImplementationProps', function() {
CamundaPlatformPropertiesProvider,
CoreModule,
ModelingModule,
SelectionModule
SelectionModule,
BehaviorsModule
];

let container;
Expand Down Expand Up @@ -745,6 +748,29 @@ describe('provider/camunda-platform - DmnImplementationProps', function() {
})
);


describe('integration', function() {

it('should remove map decision result when result variable is removed', inject(async function(elementRegistry, selection) {

// given
const businessRuleTask = elementRegistry.get('BusinessRuleTask_resultVariable'),
businessObject = getBusinessObject(businessRuleTask);

await act(() => selection.select(businessRuleTask));

// when
const input = domQuery('input[name=decisionRefResultVariable]', container);

changeInput(input, '');

// then
// expect default
expect(businessObject.get('camunda:mapDecisionResult')).to.equal('resultList');
}));

});

});

});
23 changes: 18 additions & 5 deletions test/spec/provider/camunda-platform/FormDataProps.bpmn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_01ii2ms" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.9.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_01ii2ms" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.0.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
<bpmn:process id="myProcess" isExecutable="true">
<bpmn:startEvent id="StartEvent_1" name="StartEvent_1">
<bpmn:extensionElements>
Expand All @@ -11,10 +11,9 @@
<bpmn:subProcess id="Activity_0j3tvw2">
<bpmn:startEvent id="StartEvent_2" name="StartEvent_2" />
</bpmn:subProcess>
<bpmn:userTask id="UserTask_1" name="UserTask_1" >
<bpmn:extensionElements>
<camunda:formData>
</camunda:formData>
<bpmn:userTask id="UserTask_1" name="UserTask_1">
<bpmn:extensionElements>
<camunda:formData />
</bpmn:extensionElements>
</bpmn:userTask>
<bpmn:userTask id="UserTask_2" name="UserTask_2">
Expand All @@ -35,6 +34,14 @@
</camunda:properties>
</bpmn:extensionElements>
</bpmn:userTask>
<bpmn:startEvent id="StartEvent_3" name="StartEvent_3">
<bpmn:extensionElements>
<camunda:formData businessKey="foo">
<camunda:formField id="foo" />
<camunda:formField id="bar" />
</camunda:formData>
</bpmn:extensionElements>
</bpmn:startEvent>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="myProcess">
Expand All @@ -44,6 +51,12 @@
<dc:Bounds x="165" y="122" width="64" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0svgu3u_di" bpmnElement="StartEvent_3">
<dc:Bounds x="622" y="272" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="608" y="315" width="64" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0j3tvw2_di" bpmnElement="Activity_0j3tvw2" isExpanded="true">
<dc:Bounds x="140" y="190" width="350" height="200" />
</bpmndi:BPMNShape>
Expand Down
33 changes: 32 additions & 1 deletion test/spec/provider/camunda-platform/FormDataProps.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -42,7 +44,8 @@ describe('provider/camunda-platform - FormDataProps', function() {
CamundaPlatformPropertiesProvider,
CoreModule,
ModelingModule,
SelectionModule
SelectionModule,
BehaviorsModule
];

const moddleExtensions = {
Expand Down Expand Up @@ -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;
}));

});

});


Expand Down
15 changes: 14 additions & 1 deletion test/spec/provider/camunda-platform/FormField.bpmn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_11oxn67" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.10.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_11oxn67" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.0.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
<bpmn:process id="Process_0a4i933" isExecutable="true">
<bpmn:startEvent id="StartEvent_1" name="StartEvent_1">
<bpmn:extensionElements>
Expand Down Expand Up @@ -62,6 +62,13 @@
</camunda:formData>
</bpmn:extensionElements>
</bpmn:userTask>
<bpmn:startEvent id="StartEvent_2" name="StartEvent_2">
<bpmn:extensionElements>
<camunda:formData businessKey="foo">
<camunda:formField id="foo" />
</camunda:formData>
</bpmn:extensionElements>
</bpmn:startEvent>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_0a4i933">
Expand All @@ -80,6 +87,12 @@
<bpmndi:BPMNShape id="Activity_16ffca6_di" bpmnElement="UserTask_4">
<dc:Bounds x="640" y="57" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0zd65c8_di" bpmnElement="StartEvent_2">
<dc:Bounds x="179" y="172" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="165" y="215" width="64" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Loading