Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.qawolf.com/llms.txt

Use this file to discover all available pages before exploring further.

@qawolf/flows/cli is the smallest platform entry point in @qawolf/flows. CLI flows run in Node and have no browser or mobile driver. Use them for work that needs to coordinate with other flows in a run but doesn’t require UI interaction — data setup, teardown, sending notifications, or processing files. Because CLI flows run in Node, you can use the Node standard library directly for file, process, and network work:
import { flow } from "@qawolf/flows/cli";
import { readFile } from "node:fs/promises";

export default flow("Read build metadata", "Basic", async ({ test }) => {
  await test("read metadata", async () => {
    const metadata = await readFile("build-metadata.json", "utf8");
    console.log(JSON.parse(metadata));
  });
});

Primary Exports

  • flow(...)
  • expect
  • testContextDependencies
It also exports CLI-specific target, callback context, and flow definition types. Example:
import { flow } from "@qawolf/flows/cli";

export default flow(
  "Prepare release metadata",
  "Basic",
  async ({ inputs, setOutput, test }) => {
    await test("create release payload", async () => {
      setOutput("RELEASE", {
        generatedAt: new Date().toISOString(),
        inputs,
        status: "ready",
      });
    });
  },
);

Target Model

The current target type is:
type CliFlowTarget = "Basic";
Accepted flow target input:
type CliFlowTargetInput = CliFlowTarget | { target: CliFlowTarget };
Example:
import { flow } from "@qawolf/flows/cli";

export const stringTargetFlow = flow("String target", "Basic", async () => {});

export const objectTargetFlow = flow(
  "Object target",
  { target: "Basic" },
  async () => {},
);

Flow Callback Context

The callback receives the CLI flow context. Public callback parameters:
  • inputs — values published by an upstream flow in the same run
  • setOutput(...) — publishes values for downstream flows to read
  • test(...) — wraps named sub-steps that appear in your results
CLI flows do not receive page, driver, or any other launch object.
test(...) can be omitted for simple flows where grouping steps into named sub-steps doesn’t add value. For most flows, wrapping steps in test(...) is recommended — the label appears in your results and makes failures easier to locate.
Example:
import { flow } from "@qawolf/flows/cli";

export default flow(
  "Prepare release metadata",
  "Basic",
  async ({ inputs, setOutput, test }) => {
    await test("create release payload", async () => {
      setOutput("RELEASE", {
        generatedAt: new Date().toISOString(),
        inputs,
        status: "ready",
      });
    });
  },
);
See Passing data between flows for how to use inputs and setOutput to coordinate with other flows in a run.

testContextDependencies

testContextDependencies is exported for runner and tooling integration. Flow authors should usually use the public callback parameters above instead of depending on the raw runner dependency list.

expect

Like the other platform entry points, the exported expect value is a type-safe stub in package code and is replaced by the runner when the flow executes. Example:
import { expect, flow } from "@qawolf/flows/cli";

export default flow("Use runner expect", "Basic", async ({ test }) => {
  await test("check value", async () => {
    await expect("ready").toBeDefined();
  });
});
Last modified on May 6, 2026