Workflow test triggers and steps
dispatch_sync
Section titled “dispatch_sync”Runs the case workflow synchronously. Keys: event or entry, event_type (manual), data, bindings (merged over data), request and headers. Use entry to dispatch a cron entry directly in a test. For on_change, put prototype, selector, value and previousValue in data.
{"type":"dispatch_sync","entry":"onChange","data":{"prototype":"fixture:note","selector":"$.name","value":"New","previousValue":"Old"}}webhook
Section titled “webhook”Keys: event or entry (otherwise first event/webhook), data, bindings, request, input, value, selected, prototype, context and headers. Constructs a synthetic POST and dispatches the graph. module, fields and where do not select a record for this trigger. Bind the actual resource through bindings or prototype as required by the graph.
{"type":"webhook","event":"preview","bindings":{"default":"fixture:note"},"prototype":"fixture:note","input":{"format":"pdf"}}create_resource
Section titled “create_resource”Keys: module, fields, alias, client, dispatch_workflow (true). Creates a record and emits resourceCreated. If the case also names a workflow, explicit dispatch can cause a second execution in addition to event registration; use dispatch_workflow false to test only event dispatch.
{"type":"create_resource","module":"notes","alias":"newNote","fields":{"name":"Example"},"dispatch_workflow":false}update_resource
Section titled “update_resource”Keys: entity, or module plus selector/where; fields, alias, dispatch_workflow (false). Updates the entity and emits resourceUpdated with default and original data.
{"type":"update_resource","entity":"fixture:note","fields":{"name":"Changed"},"dispatch_workflow":false}delete_resource
Section titled “delete_resource”Keys: entity, or module plus selector/where; alias, dispatch_workflow (false). Removes the entity and emits resourceDeleted.
{"type":"delete_resource","entity":"fixture:note","dispatch_workflow":false}create_resource and update_resource do not calculate field recipes. See execution limits.
Steps and respond
Section titled “Steps and respond”steps continues a scenario after its initial trigger. Any trigger type above can be a step, with workflow (defaults to case workflow), as (actor) and assertions.
respond resumes an open modal or notification checkpoint. Keys: element (node name), state (confirm), as, input, selected and assertions. A missing open checkpoint fails the step.
{"steps":[{"type":"respond","element":"confirmNote","state":"confirm","as":"fixture:reviewer","input":{"comment":"Reviewed"},"assertions":[{"type":"response_status","value":200}]}]}Source: BusinessWorkflowTestRunner::runStep, dispatch resolution and resource trigger methods. Return to workflow tests.