Skip to content

formatAction renders wait_for as "unknown action" in failure output #11

Description

@queso

Problem

formatAction in src/reporter.ts:22 handles visit, click, fill, and select, but has no case for wait_for. Any step that falls through returns the literal string "unknown action".

wait_for failures do populate error.actiontest/runner.test.ts:526 asserts exactly that:

expect(result.error?.action).toEqual({ wait_for: "Nonexistent Text" });

So when a wait_for step fails, the user sees:

✗ my-flow (5.1s)
  Step 1: unknown action
  Error: Timeout waiting for "Dashboard"

The error message carries the text, but the step line — the part that tells you which step and what kind — is useless.

Why it slipped

wait_for shipped in 5f84a68 alongside flowspec init. PRD-0004 had listed it as a non-goal ("Explicit wait_for step type (may be a future PRD)"), so it never got its own PRD, and the reporter was never updated to match the new step type.

Fix

Add the missing case:

if ("wait_for" in action) {
  return `wait_for "${action.wait_for}"`;
}

Optional, while in there

fill and select render as bare "fill" / "select" with no indication of which fields they targeted. Naming the fields would make failures more actionable:

Step 2: fill "Email", "Password"
Step 3: select "Category"

test/reporter.test.ts:153 only asserts toContain("fill"), so this would not break existing tests.

Context

Split out of PRD-0006 (pre-flight setup steps, #5) to keep that PRD scoped. wait_for is the natural way to wait out an auth redirect in a setup block, so this becomes more visible once setup ships — but the bug exists today, independently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions