You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+73Lines changed: 73 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,79 @@ We recommend using [Camunda 8 Run](https://docs.camunda.io/docs/self-managed/qui
60
60
61
61
You can configure your Camunda 8 environment in the `demo/.env` file.
62
62
63
+
## Test Scenarios
64
+
65
+
The integration tests in `test/` are driven by **recorded fixture files** (`test/fixtures/scenarios/*.json`) rather than a live Camunda instance. Each fixture captures a full timeline of API responses from a real run, which is then replayed deterministically in CI.
66
+
67
+
### How it works
68
+
69
+
1. A *scenario* is a self-contained folder under `test/scenarios/` with its own BPMN diagram (`process.bpmn`) and a definition file (`scenario.mjs`).
70
+
2. The headless runner (`test/scenarios/run.mjs`) deploys the BPMN to a live Camunda 8 instance, starts a process instance, activates any job workers, polls until the process reaches a terminal state, and writes the recorded timeline to `test/fixtures/scenarios/<name>.json`.
71
+
3. The committed JSON fixtures are what the unit tests actually execute against — no live Camunda required in CI.
72
+
4. Re-running the recorder and doing a `git diff` is an effective regression test against the Camunda engine: if the fixture changes unexpectedly, something in engine behaviour has changed.
|`completeWorker(type, output?, delayMs?)`| Completes every job with optional output variables |
110
+
|`failWorker(type, message, { errorCode?, retries?, delayMs? })`| Fails every job; `retries: 0` creates an incident |
111
+
|`messageWorker(type, messageName, getCorrelationKey, options?)`| Completes job then correlates a message |
112
+
|`customWorker(type, handler)`| Full control — `handler(job, context)` called for each job |
113
+
114
+
### Recording fixtures
115
+
116
+
Requires a live Camunda 8 instance configured in `demo/.env` (same as `npm start`).
117
+
118
+
```sh
119
+
# Record all scenarios
120
+
npm run scenarios:record
121
+
122
+
# Record a single scenario
123
+
npm run scenarios:record:one test/scenarios/service-task-success/scenario.mjs
124
+
125
+
# Review what changed
126
+
npm run scenarios:diff
127
+
```
128
+
129
+
### Adding a new scenario
130
+
131
+
1. Create a new folder under `test/scenarios/` with a minimal `process.bpmn` and a `scenario.mjs` that exports the scenario definition. Use a unique `processId` and a scoped job type (e.g. `task-testing:<scenario-name>`) to avoid collisions on a shared cluster.
132
+
2. Run `npm run scenarios:record:one test/scenarios/<name>/scenario.mjs` to produce the fixture JSON.
133
+
3. Write a spec in `test/` that uses `replayScenario` / `createReplayApi` to exercise the component with the new fixture.
134
+
4. Commit both the `process.bpmn` and the generated JSON fixture.
* BoundaryEvent_Timer appearing → process COMPLETED via boundary path.
10
+
*/
11
+
12
+
exportdefault{
13
+
name: 'boundary-event-triggered',
14
+
description: 'A service task with a boundary timer event that triggers during execution. The boundary event element instance appears in poll results.',
15
+
resources: ['./process.bpmn'],
16
+
elementId: 'Task_1',
17
+
processId: 'Process_BoundaryEventTriggered',
18
+
variables: {},
19
+
workers: [],
20
+
21
+
// Timer fires after PT5S; poll long enough for that to happen
0 commit comments