Test context that provides utilities and manages test state. Automatically injected into test classes decorated with @CamundaProcessTest.

Constructors

Properties

client: Camunda8

Methods

  • Cleans up test data after each test method. This is called in the Jest afterEach lifecycle hook, so after each test in a test file.

    Returns Promise<void>

  • Creates and starts a process instance with automatic tracking for cleanup. Process instances are automatically cancelled during test cleanup.

    Type Parameters

    • T extends Record<string, unknown> | typeof LosslessDto

    Parameters

    • request: CreateProcessInstanceRequest<T>

      Process instance creation request

    Returns Promise<CreateProcessInstanceResponse<never>>

    The created process instance response

  • Creates and starts a process instance and awaits its completion with automatic tracking. Process instances are automatically cancelled during test cleanup if still running.

    Type Parameters

    • T extends Record<string, unknown> | typeof LosslessDto = Record<string, unknown>

    Parameters

    • request: CreateProcessInstanceRequest<T>

      Process instance creation request with result configuration

    Returns Promise<CreateProcessInstanceResponse<unknown>>

    The completed process instance response with variables

  • Deploys a DMN decision from a file path.

    Parameters

    • resourcePath: string

    Returns Promise<DeployResourceResponse>

    Use deployResources([resourcePath]) instead.

  • Deploys a BPMN process from a file path.

    Parameters

    • resourcePath: string

    Returns Promise<DeployResourceResponse>

    Use deployResources([resourcePath]) instead. Example: await deployResources(["path/to/process.bpmn"]);

  • Deploys resources (BPMN processes, DMN decisions, forms) from file paths.

    Parameters

    • resourcePaths: string[]

      Array of file paths to deploy

    • Optionaloptions: {
          autoDelete?: boolean;
      }

      Optional configuration for automatic resource cleanup

      • OptionalautoDelete?: boolean

    Returns Promise<DeployResourceResponse>

    The deployment response from Camunda

  • Gets the runtime mode for the current test environment.

    Returns "MANAGED" | "REMOTE"

    'MANAGED' for Docker containers, 'REMOTE' for SaaS/Cloud/self-managed

  • Increases the current time by the specified duration. This affects timers and scheduled tasks in processes.

    ⚠️ Warning: Time manipulation may fail in REMOTE mode (SaaS/C8Run environments). For reliable timer testing, use MANAGED mode with Docker containers.

    Parameters

    • duration: number | {
          days?: number;
          hours?: number;
          minutes?: number;
          seconds?: number;
      }

    Returns Promise<void>

  • Resets test state between test methods. This is called in the beforeEach jest lifecycle, so between each test in a file.

    Returns Promise<void>

  • Waits for a condition to be met with polling.

    Parameters

    • condition: (() => boolean | Promise<boolean>)
        • (): boolean | Promise<boolean>
        • Returns boolean | Promise<boolean>

    • options: {
          interval?: number;
          timeout?: number;
      } = {}
      • Optionalinterval?: number
      • Optionaltimeout?: number

    Returns Promise<void>