await-ui-element announces "UI element appeared" for a wait that timed out: completedMsg ignores success:false

Open Beginner friendly
#1,016 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
tooling

Research direction

Start in packages/tool-server/src/tools/await-ui-element/index.ts around lines 159-164 and 350, then compare the result-aware completedMsg in packages/tool-server/src/tools/keyboard/index.ts. Trigger a selector that never matches and let it time out; the interaction message should no longer claim success when result.success is false, while successful waits should retain their existing messages.

Written by the indexing model from the issue text.

Description

b:minor bug

[Diplomat, Opus 5]: Found while reviewing #592, which fixes the same class in keyboard. Out of scope there, so filing it here.

await-ui-element reports an unmet wait in its RESULT (success: false) rather than by throwing, so the interaction line the user sees comes from completedMsg — which never looks at the result:

packages/tool-server/src/tools/await-ui-element/index.ts:350

      completedMsg: ({ params }) => conditionCompleted[params.condition],

with (:159-164)

const conditionCompleted = {
  exists: "UI element appeared",
  visible: "UI element became visible",
  hidden: "UI element became hidden",
  text: "UI element matched expected text",
} as const;

So a condition: exists wait that ran its full timeout and came back { success: false, elapsed: 10000, note: … } is announced as "UI element appeared". The line states the opposite of what happened, on the one tool whose whole purpose is to report whether the state arrived.

Trigger: call await-ui-element with a selector that never matches (any condition) and let it time out. The result is correct; the message beside it is not.

The twin that does it right is keyboard, whose verdict has the same shape (reported, not thrown) — packages/tool-server/src/tools/keyboard/index.ts:

      completedMsg: ({ params, result }) =>
        params.text === undefined
          ? "Pressed a key"
          : `Entered text${result.verified === false ? " (text did not land)" : ""}`,

completedMsg already receives result, so the fix is local: qualify the string when success is false (and the note says why).

Why it matters beyond cosmetics: the same "reported, not thrown" shape is what the recorder's UNMET_WAIT_WARNING and flow-run's gate exist to catch, because a green-looking wait becomes a flow step that fails at replay. The interaction line is the one place that still reads as success.

Dominant language
TypeScript
Stars
2.9k
Forks
118
Avg merge
1d 19h
Merged PRs (30d)
93

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from software-mansion/argent

All issues in software-mansion/argent

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.