Skip to content

fix(core): surface abort reasons in errors#41752

Open
Skn0tt wants to merge 3 commits into
microsoft:mainfrom
Skn0tt:skn0tt-fix-abort-error-messages
Open

fix(core): surface abort reasons in errors#41752
Skn0tt wants to merge 3 commits into
microsoft:mainfrom
Skn0tt:skn0tt-fix-abort-error-messages

Conversation

@Skn0tt

@Skn0tt Skn0tt commented Jul 13, 2026

Copy link
Copy Markdown
Member

This PR keeps the supplied AbortSignal reason in API error messages and call logs. Aborted locator assertions now retain their latest mismatch detail instead of replacing it with an assertion-aborted message.

I ran the same click/expect repros against the merge base and this branch. Only the abort output changes.

locator.click() when aborted:

-AbortError: locator.click: The operation was aborted
+AbortError: locator.click: foo bar
 Call log:
   - waiting for locator('button')
     - locator resolved to <button>click me</button>
   - attempting click action
     2 × waiting for element to be visible, enabled and stable
       - element is not visible
     - retrying click action
     - waiting 20ms
     - waiting for element to be visible, enabled and stable
     - element is not visible
   - retrying click action
     - waiting 100ms
+  - operation was aborted: foo bar

expect(locator) when aborted:

 Error: expect(locator).toBeVisible() failed

 Locator: locator('span')
 Expected: visible
-Error: The assertion was aborted: stop it
+Error: element(s) not found

 Call log:
   - Expect "to.be.visible" with timeout 5000ms
   - waiting for locator('span')
+  - operation was aborted: stop it

I also verified that operation timeouts, test timeouts, and strict-mode violations are unchanged.

Split out of #41751.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4700825d-f132-4fcc-ba57-109da3fb9e77
@Skn0tt Skn0tt requested a review from dgozman July 13, 2026 10:49
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4700825d-f132-4fcc-ba57-109da3fb9e77
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@dgozman dgozman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR would really benefit from before/after error snippets for click/expect that failed due to timeout/abort/strict violation error.


async abort(error: Error) {
const causeMessage = error.cause instanceof Error ? error.cause.message : error.cause === undefined ? error.message : String(error.cause);
const logMessage = `operation was aborted: ${causeMessage}`;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will also be printed for timeout errors?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, abort is used exclusively for __abort__ (signals) and for the aborts upon connection closed. Test ended errors go via context.close and abort through scope closure, not through this code path.



async abort(error: Error) {
const causeMessage = error.cause instanceof Error ? error.cause.message : error.cause === undefined ? error.message : String(error.cause);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it seems like cause is more important than error.message itself? Seems strange.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops that was a remnant, fixed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4700825d-f132-4fcc-ba57-109da3fb9e77
@Skn0tt Skn0tt requested a review from dgozman July 13, 2026 14:57
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

5 flaky ⚠️ [chromium-library] › library/video.spec.ts:275 › screencast › should capture navigation `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:645 › screencast › should capture full viewport `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:371 › should produce network events, routing, and annotations for Service Worker `@realtime-time-library-chromium-linux`
⚠️ [chromium-library] › library/video.spec.ts:476 › screencast › should capture static page in persistent context @smoke `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-library] › library/beforeunload.spec.ts:130 › should support dismissing the dialog multiple times `@chromium-ubuntu-22.04-node20`

49544 passed, 1168 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

1 failed
❌ [msedge] › mcp/cli-core.spec.ts:37 › preserves URL with & query params @mcp-windows-latest-msedge

7759 passed, 1249 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.

2 participants