Custom Functions
Call TypeScript functions from YAML using the call field with file#export syntax:
yaml
statements:
- intent: Seed test data
call: "../helpers/seed.ts#create_test_user"
args: [page, testContext, "test@example.com"]Inside your function, use testContext to read and write runtime variables:
ts
// helpers/seed.ts
export async function create_test_user(page, testContext, email: string) {
// Read a variable
const baseUrl = testContext.BASE_URL;
// Write a variable (available to subsequent YAML steps as {{userId}})
testContext.userId = "user-123";
}Each value in args maps directly to a parameter in the function signature. System objects (page, request, testContext) are passed as-is, strings are quoted, and numbers stay numeric.