Skip to content

Commit

Permalink
chore(user-task-forms): change supported version to Camunda 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme committed Nov 7, 2023
1 parent 3c753ff commit 7c758a9
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 36 deletions.
2 changes: 1 addition & 1 deletion rules/camunda-cloud/user-task-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { skipInNonExecutableProcess } = require('../utils/rule');

const { greaterOrEqual } = require('../utils/version');

const formIdAllowedVersion = '8.3';
const formIdAllowedVersion = '8.4';

module.exports = skipInNonExecutableProcess(function({ version }) {
function check(node, reporter) {
Expand Down
25 changes: 25 additions & 0 deletions test/camunda-cloud/integration/user-task-form-form-id-errors.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1k80tzz" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.4.2" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.1.0">
<bpmn:process id="Process_003d7f9" isExecutable="true">
<bpmn:userTask id="Activity_0tbaw9y">
<bpmn:extensionElements>
<zeebe:formDefinition formId="" />
</bpmn:extensionElements>
</bpmn:userTask>
<bpmn:userTask id="Activity_0al8bht">
<bpmn:extensionElements>
<zeebe:formDefinition formKey="foo" />
</bpmn:extensionElements>
</bpmn:userTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_003d7f9">
<bpmndi:BPMNShape id="Activity_1eofini_di" bpmnElement="Activity_0tbaw9y">
<dc:Bounds x="160" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_00hzkfi_di" bpmnElement="Activity_0al8bht">
<dc:Bounds x="280" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
25 changes: 25 additions & 0 deletions test/camunda-cloud/integration/user-task-form-form-id.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1k80tzz" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.4.2" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.1.0">
<bpmn:process id="Process_003d7f9" isExecutable="true">
<bpmn:userTask id="Activity_0tbaw9y">
<bpmn:extensionElements>
<zeebe:formDefinition formId="bar" />
</bpmn:extensionElements>
</bpmn:userTask>
<bpmn:userTask id="Activity_0al8bht">
<bpmn:extensionElements>
<zeebe:formDefinition formKey="foo" />
</bpmn:extensionElements>
</bpmn:userTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_003d7f9">
<bpmndi:BPMNShape id="Activity_1eofini_di" bpmnElement="Activity_0tbaw9y">
<dc:Bounds x="160" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_00hzkfi_di" bpmnElement="Activity_0al8bht">
<dc:Bounds x="280" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
84 changes: 70 additions & 14 deletions test/camunda-cloud/integration/user-task-form.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,75 @@ const NodeResolver = require('bpmnlint/lib/resolver/node-resolver');

const { readModdle } = require('../../helper');

const versions = [
'1.0',
'1.1',
'1.2',
'1.3',
'8.0',
'8.1',
'8.2'
];

describe('integration - user-task-form', function() {

versions.forEach(function(version) {
[
'1.0',
'1.1',
'1.2',
'1.3',
'8.0',
'8.1',
'8.2',
'8.3',
'8.4'
].forEach(function(version) {

let linter;

beforeEach(function() {
linter = new Linter({
config: {
extends: `plugin:camunda-compat/camunda-cloud-${ version.replace('.', '-') }`
},
resolver: new NodeResolver()
});
});


describe(`Camunda Cloud ${ version } (form key)`, function() {

describe('no errors', function() {

it('should not have errors', async function() {

// given
const { root } = await readModdle('test/camunda-cloud/integration/user-task-form-form-key.bpmn');

// when
const reports = await linter.lint(root);

// then
expect(reports[ 'camunda-compat/user-task-form' ]).not.to.exist;
});

});


describe('errors', function() {

it('should have errors', async function() {

// given
const { root } = await readModdle('test/camunda-cloud/integration/user-task-form-form-key-errors.bpmn');

// when
const reports = await linter.lint(root);

// then
expect(reports[ 'camunda-compat/user-task-form' ]).to.exist;
});

});

});

});


[
'8.4'
].forEach(function(version) {

let linter;

Expand All @@ -32,14 +88,14 @@ describe('integration - user-task-form', function() {
});


describe(`Camunda Cloud ${ version }`, function() {
describe(`Camunda Cloud ${ version } (form ID)`, function() {

describe('no errors', function() {

it('should not have errors', async function() {

// given
const { root } = await readModdle('test/camunda-cloud/integration/user-task-form.bpmn');
const { root } = await readModdle('test/camunda-cloud/integration/user-task-form-form-id.bpmn');

// when
const reports = await linter.lint(root);
Expand All @@ -56,7 +112,7 @@ describe('integration - user-task-form', function() {
it('should have errors', async function() {

// given
const { root } = await readModdle('test/camunda-cloud/integration/user-task-form-errors.bpmn');
const { root } = await readModdle('test/camunda-cloud/integration/user-task-form-form-id-errors.bpmn');

// when
const reports = await linter.lint(root);
Expand Down
42 changes: 21 additions & 21 deletions test/camunda-cloud/user-task-form.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { ERROR_TYPES } = require('../../rules/utils/element');
const valid = [
{
name: 'user task (user task form)',
config: { version: '8.2' },
config: { version: '8.3' },
moddleElement: createModdle(createProcess(`
<bpmn:extensionElements>
<zeebe:userTaskForm id="userTaskForm_1">{}</zeebe:userTaskForm>
Expand All @@ -27,14 +27,14 @@ const valid = [
},
{
name: 'user task',
config: { version: '8.2' },
config: { version: '8.3' },
moddleElement: createModdle(createProcess(`
<bpmn:userTask id="UserTask_1" />
`))
},
{
name: 'user task (no form key) (non-executable process)',
config: { version: '8.2' },
config: { version: '8.3' },
moddleElement: createModdle(createDefinitions(`
<bpmn:process id="Process_1">
<bpmn:userTask id="UserTask_1">
Expand All @@ -49,8 +49,8 @@ const valid = [

const invalid = [
{
name: 'user task (no form key) (Camunda 8.2)',
config: { version: '8.2' },
name: 'user task (no form key) (Camunda 8.3)',
config: { version: '8.3' },
moddleElement: createModdle(createProcess(`
<bpmn:userTask id="UserTask_1">
<bpmn:extensionElements>
Expand All @@ -76,8 +76,8 @@ const invalid = [
}
},
{
name: 'user task (empty form key) (Camunda 8.2)',
config: { version: '8.2' },
name: 'user task (empty form key) (Camunda 8.3)',
config: { version: '8.3' },
moddleElement: createModdle(createProcess(`
<bpmn:userTask id="UserTask_1">
<bpmn:extensionElements>
Expand All @@ -103,8 +103,8 @@ const invalid = [
}
},
{
name: 'user task (no form key or form ID) (Camunda 8.3)',
config: { version: '8.3' },
name: 'user task (no form key or form ID) (Camunda 8.4)',
config: { version: '8.4' },
moddleElement: createModdle(createProcess(`
<bpmn:userTask id="UserTask_1">
<bpmn:extensionElements>
Expand Down Expand Up @@ -132,8 +132,8 @@ const invalid = [
}
},
{
name: 'user task (empty form key) (Camunda 8.3)',
config: { version: '8.3' },
name: 'user task (empty form key) (Camunda 8.4)',
config: { version: '8.4' },
moddleElement: createModdle(createProcess(`
<bpmn:userTask id="UserTask_1">
<bpmn:extensionElements>
Expand Down Expand Up @@ -161,8 +161,8 @@ const invalid = [
}
},
{
name: 'user task (empty form ID) (Camunda 8.3)',
config: { version: '8.3' },
name: 'user task (empty form ID) (Camunda 8.4)',
config: { version: '8.4' },
moddleElement: createModdle(createProcess(`
<bpmn:userTask id="UserTask_1">
<bpmn:extensionElements>
Expand Down Expand Up @@ -190,8 +190,8 @@ const invalid = [
}
},
{
name: 'user task (form ID) (Camunda 8.2)',
config: { version: '8.2' },
name: 'user task (form ID) (Camunda 8.3)',
config: { version: '8.3' },
moddleElement: createModdle(createProcess(`
<bpmn:userTask id="UserTask_1">
<bpmn:extensionElements>
Expand All @@ -201,7 +201,7 @@ const invalid = [
`)),
report: {
id: 'UserTask_1',
message: 'Property <formId> only allowed by Camunda 8.3 or newer',
message: 'Property <formId> only allowed by Camunda 8.4 or newer',
path: [
'extensionElements',
'values',
Expand All @@ -213,13 +213,13 @@ const invalid = [
node: 'zeebe:FormDefinition',
parentNode: 'UserTask_1',
property: 'formId',
allowedVersion: '8.3'
allowedVersion: '8.4'
}
}
},
{
name: 'user task (form key and form ID) (Camunda 8.3)',
config: { version: '8.3' },
name: 'user task (form key and form ID) (Camunda 8.4)',
config: { version: '8.4' },
moddleElement: createModdle(createProcess(`
<bpmn:userTask id="UserTask_1">
<bpmn:extensionElements>
Expand Down Expand Up @@ -247,8 +247,8 @@ const invalid = [
}
},
{
name: 'user task (empty user task form) (Camunda 8.2)',
config: { version: '8.2' },
name: 'user task (empty user task form) (Camunda 8.3)',
config: { version: '8.3' },
moddleElement: createModdle(createProcess(`
<bpmn:extensionElements>
<zeebe:userTaskForm id="userTaskForm_1"></zeebe:userTaskForm>
Expand Down

0 comments on commit 7c758a9

Please sign in to comment.