bpmn-elements icon indicating copy to clipboard operation
bpmn-elements copied to clipboard

camunda:formKey on StartEvent does not trigger activity.wait

Open captHarlock69 opened this issue 3 years ago • 0 comments

As explained in subject.

Below is a test-case that breaks stating that "task" is not "start" beacuse there is no activity.wait on the startEvent element.

import testHelpers from '../helpers/testHelpers';
import Definition from '../../src/definition/Definition';
import camunda from 'camunda-bpmn-moddle/resources/camunda';

const extensions = {
  camunda: {
    moddleOptions: camunda,
  },
};


Feature('StartEvent Bug', () => {
  Scenario('FormKey on StartEvent', () => {
    let definition;
    Given('a process with form start event that should wait', async () => {
        const source = `
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <process id="theProcess" isExecutable="true">
    <startEvent id="start" camunda:formKey='startFormKey'/>
    <userTask id="task" camunda:formKey='taskFormKey'/>
    <endEvent id="end" />
    <sequenceFlow id="flow1" sourceRef="start" targetRef="task" />
    <sequenceFlow id="flow2" sourceRef="task" targetRef="end" />
  </process>
</definitions>`;
          const context = await testHelpers.context(source);
          definition = new Definition(context);
    });

    let end;
    let waitActivity;
    When('ran', () => {
      end = definition.waitFor('end');
      waitActivity = definition.waitFor('wait', (_, api) => {
        return api.content.id;
      });
      definition.run();
    });
    Then('stops at StartEvent', async () => {
        let api = await waitActivity;
        expect(api.id).to.equal('start');
    });
  });
});

captHarlock69 avatar Oct 12 '22 14:10 captHarlock69