@camunda/task-testing 2.2.0 → 3.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,13 +12,82 @@ import TaskTesting from '@camunda/task-testing';
12
12
  function App() {
13
13
  ...
14
14
 
15
- <TaskTesting api={ ... }>
16
- <TaskTesting.Tab label={ 'Foo' }>...</TaskTesting.Tab>;
17
- <TaskTesting.Link href="https://camunda.com">Foo</TaskTesting.Link>;
15
+ <TaskTesting
16
+ { ...props }
17
+ >
18
+ <TaskTesting.Tab label="My dynamic tab" render={ ({ output }) => <div>...</div> } />
19
+ <TaskTesting.Tab label="My static tab">My static content</TaskTesting.Tab>
20
+ <TaskTesting.Link href="https://example.com" render={ ({ output }) => <div>...</div> } />
21
+ <TaskTesting.Link href="https://example.com">My static link</TaskTesting.Link>
18
22
  </TaskTesting>
19
23
  }
20
24
  ```
21
25
 
26
+ ### Props
27
+
28
+ | Prop | Type | Required | Description |
29
+ |------|------|----------|-------------|
30
+ | `injector` | `Object` | yes | The [didi](https://github.com/nikku/didi) injector from the bpmn-js modeler |
31
+ | `api` | `TaskExecutionApi` | yes | API object with methods for deploying, starting instances, and polling |
32
+ | `isConnectionConfigured` | `boolean` | yes | Whether a Camunda 8 connection is configured |
33
+ | `config` | `Config` | no | Input/output configuration for elements |
34
+ | `onConfigChanged` | `(config: Config) => void` | no | Called when the configuration changes |
35
+ | `configureConnectionBannerTitle` | `string` | no | Title for the connection banner (default: `'Connection required'`) |
36
+ | `configureConnectionBannerDescription` | `string` | no | Description for the connection banner (default: `'Configure a connection to start testing.'`) |
37
+ | `configureConnectionLabel` | `string` | no | Label for the configure connection button (default: `'Configure'`) |
38
+ | `onConfigureConnection` | `Function` | no | Called when the user clicks the configure connection button |
39
+ | `onTestTask` | `() => boolean \| Promise<boolean>` | no | Called when the user clicks _Test task_. Return `true` to proceed, `false` to abort |
40
+ | `operateBaseUrl` | `string` | no | Base URL for Operate links |
41
+ | `tasklistBaseUrl` | `string` | no | Base URL for Tasklist links |
42
+ | `documentationUrl` | `string` | no | URL for the documentation link |
43
+ | `onTaskExecutionStarted` | `(element) => void` | no | Called when task execution starts |
44
+ | `onTaskExecutionFinished` | `(element, result) => void` | no | Called when task execution ends |
45
+
46
+ #### `TaskExecutionApi`
47
+
48
+ The `api` prop must implement the following methods. Each method should return a `{ success: true, response }` or `{ success: false, error }` object.
49
+
50
+ | Method | Description |
51
+ |--------|-------------|
52
+ | `deploy()` | Deploy the process definition |
53
+ | `startInstance(processDefinitionKey, elementId, variables)` | Start a process instance |
54
+ | `getProcessInstance(processInstanceKey)` | Search for a process instance |
55
+ | `getProcessInstanceElementInstances(processInstanceKey)` | Search element instances |
56
+ | `getProcessInstanceIncident(processInstanceKey)` | Search incidents |
57
+ | `getProcessInstanceJobs(processInstanceKey, elementId)` | Search jobs |
58
+ | `getProcessInstanceMessageSubscriptions(processInstanceKey, elementId)` | Search message subscriptions |
59
+ | `getProcessInstanceUserTasks(processInstanceKey, elementId)` | Search user tasks |
60
+ | `getProcessInstanceVariables(processInstanceKey)` | Search variables |
61
+
62
+ #### `onTaskExecutionFinished` result
63
+
64
+ The `result` parameter is a discriminated union:
65
+
66
+ - **`success: true`** — Task completed successfully. Contains `lastPolledResult` and `processInstanceKey`.
67
+ - **`success: false`** — Task did not complete successfully. Contains `reason`:
68
+ - `'incident'` — An incident occurred (includes `incident` details)
69
+ - `'terminated'` — Process instance was terminated
70
+ - `'user.cancel'` — User clicked cancel
71
+ - `'user.selectionChanged'` — User selected a different element
72
+ - `'error'` — Deployment or start failed (includes `error` with `message`)
73
+
74
+ #### Plugins
75
+
76
+ Custom tabs and links can be added as children:
77
+
78
+ - **`<TaskTesting.Tab>`** — Adds a tab to the output panel
79
+ - `label` (string, required) — Tab label
80
+ - `render` (function) — Render function receiving `{ output }`, for dynamic content
81
+ - `children` (ReactNode) — Static content (alternative to `render`)
82
+ - `priority` (number, default `1000`) — Higher priority tabs appear first
83
+
84
+ - **`<TaskTesting.Link>`** — Adds a link to the output header
85
+ - `href` (string, required) — Link URL
86
+ - `target` (string) — Link target (e.g. `'_blank'`)
87
+ - `render` (function) — Render function receiving `{ output }`, for dynamic content
88
+ - `children` (ReactNode) — Static content (alternative to `render`)
89
+ - `priority` (number, default `1000`) — Higher priority links appear first
90
+
22
91
  [See demo](https://github.com/camunda/task-testing/tree/main/demo)
23
92
 
24
93
  ## Development