Skip to content

Add retrying value assertions (expect.poll with matchers)#352

Merged
JE-Chen merged 1 commit into
devfrom
feat/expect-poll-batch
Jun 23, 2026
Merged

Add retrying value assertions (expect.poll with matchers)#352
JE-Chen merged 1 commit into
devfrom
feat/expect-poll-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 23, 2026

Copy link
Copy Markdown
Member

assert_eventually only polls the framework's fixed dict-spec checks (text/image/pixel/window/clipboard/process/file/http). It can't retry an arbitrary value — an OCR'd total equalling a string, a row count stabilising, a custom predicate.

  • expect_poll(getter, matcher, ...)PollResult (ok/value/attempts/waited_s); assert_poll raises on timeout. Injectable clock/sleep → deterministic (the existing helper calls real time.sleep). Mirrors Playwright expect.poll.
  • Matcher factories: to_equal, to_contain, to_be_greater_than, to_match_regex, to_be_truthy, to_be_stable(n) (matches once the value repeats n times).
  • AC_expect_poll re-runs a nested action (e.g. ["AC_get_clipboard"]) until a key of its result matches op (truthy/equals/contains/gt/regex) vs expected — usable from JSON/MCP/builder.
  • Pure-stdlib; fully headless-testable (fake clock advances only on sleep). Wired through all 5 layers + headless test + EN/Zh docs + WHATS_NEW. Qt-free.

@JE-Chen JE-Chen merged commit 4c9a2b5 into dev Jun 23, 2026
15 of 16 checks passed
@JE-Chen JE-Chen deleted the feat/expect-poll-batch branch June 23, 2026 00:22
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant