Skip to content

feat(expect): support AbortSignal on web-first assertions#41157

Draft
Skn0tt wants to merge 3 commits into
microsoft:mainfrom
Skn0tt:feat/abort-signal-expect
Draft

feat(expect): support AbortSignal on web-first assertions#41157
Skn0tt wants to merge 3 commits into
microsoft:mainfrom
Skn0tt:feat/abort-signal-expect

Conversation

@Skn0tt

@Skn0tt Skn0tt commented Jun 5, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a client-only signal?: AbortSignal option to web-first assertions (toBeVisible, toHaveText, toHaveCount, toMatchAriaSnapshot, toHaveURL, etc.).
  • Aborting cancels the in-flight server call via the existing __cancel__ mechanism and rejects with signal.reason — a cancellation, not an assertion outcome — matching AbortSignal semantics on actions (feat: support AbortSignal on server-side methods #41141) and waiters (feat: add AbortSignal support to client-side Waiter methods #41136).
  • The retry loop runs server-side; the server returns a (failed) result rather than throwing on abort, so the client races the call against the signal to surface the abort reason instead of an "expect failed" message.

Notes

Refs #40578

Skn0tt added 3 commits June 4, 2026 17:33
Adds a client-only `signal` option that aborts an in-flight server
operation via a new fire-and-forget `__cancel__` message, which aborts
the call's ProgressController in the dispatcher.

Wires it up on Locator.click and Locator.waitFor as a starting point.

Fixes: microsoft#40578
Adds the signal option next to every existing timeout option on
action, getter and navigation methods, threading it through the
client so in-flight calls can be cancelled via the __cancel__ wire
message.

Refs: microsoft#40578
Adds a client-only `signal` option to web-first assertions (toBeVisible,
toHaveText, toHaveCount, toMatchAriaSnapshot, toHaveURL, etc.). Aborting
cancels the in-flight server call via the existing __cancel__ mechanism
and rejects with the signal's reason, matching AbortSignal semantics on
actions and waiters.

Refs: microsoft#40578
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Test results for "MCP"

7263 passed, 1109 skipped


Merge workflow run.

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

1 flaky ⚠️ [chromium-library] › library/popup.spec.ts:261 › should not throw when click closes popup `@chromium-ubuntu-22.04-arm-node20`

39598 passed, 771 skipped


Merge workflow run.

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