# Midscene Test Node Spec This document describes the Nodes available in YAML test files (`.yaml` or `.yml`) for the Midscene Test framework (`@midscene/test`). It lists the Nodes registered by the current Test Project, their inputs, and how to call them in test steps and lifecycle hooks. Learn about the framework and YAML test authoring: - [Midscene Test overview](https://www.midscenejs.com/midscene-test/overview): framework concepts and the role of Nodes. - [Create and use test projects](https://www.midscenejs.com/midscene-test/use): write YAML cases, run tests, and inspect results. - [Configure test projects](https://www.midscenejs.com/midscene-test/configuration): register Nodes, select case files, and manage runtime resources. ## Available Nodes This table lists all available Nodes. See [Node Details](#node-details) below for each Node's usage and input schema. | Node | Description | | --- | --- | | alpha.node | Runs the alpha action. | | beta.node | Runs the beta action. | ## Where to use these Nodes Use these Nodes in Workflow Documents (`.yaml` or `.yml` files) selected by an Execution Project. Case file patterns and the config file path below are relative to this spec file. Case file patterns use glob syntax. A custom `--config` path does not change where case files are selected. Projects created by `midscene-test create` select `cases/**/*.{yaml,yml}` by default, so you can write test cases in `cases/example.yaml` or subdirectories of `cases/`. If an Execution Project has no `files` configuration, Midscene Test searches `**/*.{yaml,yml}` recursively instead. Check `projects[].files` in your configuration before choosing a file location. **Config file:** `midscene.config.ts` **Case files:** `cases/**/*.{yaml,yml}` (Execution Project: web); excludes: `cases/fixtures/**` Files matching `files.exclude` are not selected. Midscene Test always ignores `.git/`, `.midscene/`, `midscene_run/`, and `node_modules/` directories, including nested ones. Call a Node in `cases[].steps`, or in the Workflow Document lifecycle steps `beforeAll`, `beforeEach`, `afterEach`, and `afterAll`. Root Nodes are shared defaults; `projects[].nodes` adds local Nodes and overrides same-named root Nodes only within that Execution Project. Each Execution Project supplies its own runtime environment. ## Workflow Step Contract Each step uses a node name as its key. The `$` object contains engine metadata and is not part of the node input. ```yaml cases: - name: Example case steps: - node.name: prompt: Describe the task. $: timeout: 30000 continue-on-error: false ``` A Node may map a string step value to one declared input field. Each Node section states whether it supports this shorthand and names the target field. Each Node's returned `data` is saved on that Step's result. Results are not named or automatically passed to later Steps. A failed Case does not stop later Cases by default; `test.bail` controls early stopping across the run. ## Node Details ### `alpha.node` **Title:** Alpha node Runs the alpha action. **String shorthand:** Maps to `{ customerId: value }`. #### Input Schema ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, "properties": { "amount": { "description": "The order amount.", "exclusiveMinimum": 0, "type": "number" }, "customerId": { "description": "The customer ID.", "type": "string" } }, "required": [ "customerId", "amount" ], "type": "object" } ``` ### `beta.node` Runs the beta action. **String shorthand:** Not supported by this Node. #### Input Schema ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "additionalProperties": false, "properties": { "enabled": { "type": "boolean" } }, "type": "object" } ```