Skip to content

feat(expect): include aria snapshot in expect failure messages#40390

Merged
pavelfeldman merged 1 commit intomicrosoft:mainfrom
pavelfeldman:feat-expect-aria-snapshot
Apr 23, 2026
Merged

feat(expect): include aria snapshot in expect failure messages#40390
pavelfeldman merged 1 commit intomicrosoft:mainfrom
pavelfeldman:feat-expect-aria-snapshot

Conversation

@pavelfeldman
Copy link
Copy Markdown
Member

Summary

  • Append an Aria snapshot: section to expect failure messages.
  • Containment matchers (toHaveText, toContainText) print the full subtree; property matchers (toBeChecked, toHaveAttribute, toHaveRole, toHaveValue, toHaveCSS, ...) print just the element line.
  • When the locator does not resolve, or resolves to a hidden element, fall back to a full-page snapshot. to.have.count, *.array and to.match.aria are excluded.

Append an "Aria snapshot:" section to failure messages from
toBeTruthy / toMatchText / toEqual matchers so it is easier to
diagnose what was actually on the page when the assertion failed:

- containment matchers (toHaveText, toContainText) print the full
  subtree of the matched element;
- property matchers (toBeChecked, toHaveAttribute, toHaveRole,
  toHaveValue, toHaveCSS, ...) print just the element line (depth 1);
- when the locator did not resolve to an element, or resolved to a
  hidden one, fall back to a full-page snapshot from document.body;
- to.have.count, *.array and to.match.aria assertions are excluded.

The protocol shape changes from `received: SerializedValue` to
`received: { value?, ariaSnapshot? }`.
@pavelfeldman pavelfeldman force-pushed the feat-expect-aria-snapshot branch from 4417dc5 to 0622e3e Compare April 23, 2026 23:03
@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "tests 1"

4 flaky ⚠️ [chromium-library] › library/video.spec.ts:719 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1080 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-wait-for-function.spec.ts:104 › should work with strict CSP policy `@firefox-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-test-output.spec.ts:118 › should collapse repeated console messages for test `@ubuntu-latest-node22`

41432 passed, 847 skipped


Merge workflow run.

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "MCP"

77 failed
❌ [chrome] › mcp/dashboard.spec.ts:182 › should start dashboard and annotate when no dashboard is running @mcp-ubuntu-latest
❌ [chrome] › mcp/dashboard.spec.ts:204 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-ubuntu-latest
❌ [chrome] › mcp/test-debug.spec.ts:48 › test_debug (pause/resume) @mcp-ubuntu-latest
❌ [chrome] › mcp/test-debug.spec.ts:167 › test_debug (pause/snapshot/resume) @mcp-ubuntu-latest
❌ [chromium] › mcp/dashboard.spec.ts:204 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-ubuntu-latest
❌ [chromium] › mcp/test-debug.spec.ts:48 › test_debug (pause/resume) @mcp-ubuntu-latest
❌ [chromium] › mcp/test-debug.spec.ts:167 › test_debug (pause/snapshot/resume) @mcp-ubuntu-latest
❌ [chrome] › mcp/test-debug.spec.ts:48 › test_debug (pause/resume) @mcp-windows-latest
❌ [chrome] › mcp/test-debug.spec.ts:167 › test_debug (pause/snapshot/resume) @mcp-windows-latest
❌ [chromium] › mcp/dashboard.spec.ts:204 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-windows-latest
❌ [chromium] › mcp/test-debug.spec.ts:48 › test_debug (pause/resume) @mcp-windows-latest
❌ [chromium] › mcp/test-debug.spec.ts:167 › test_debug (pause/snapshot/resume) @mcp-windows-latest
❌ [chrome] › mcp/dashboard.spec.ts:204 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-macos-latest
❌ [chrome] › mcp/test-debug.spec.ts:48 › test_debug (pause/resume) @mcp-macos-latest
❌ [chrome] › mcp/test-debug.spec.ts:167 › test_debug (pause/snapshot/resume) @mcp-macos-latest
❌ [chromium] › mcp/dashboard.spec.ts:204 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-macos-latest
❌ [chromium] › mcp/test-debug.spec.ts:48 › test_debug (pause/resume) @mcp-macos-latest
❌ [chromium] › mcp/test-debug.spec.ts:167 › test_debug (pause/snapshot/resume) @mcp-macos-latest
❌ [firefox] › mcp/dashboard.spec.ts:182 › should start dashboard and annotate when no dashboard is running @mcp-ubuntu-latest
❌ [firefox] › mcp/dashboard.spec.ts:204 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-ubuntu-latest
❌ [firefox] › mcp/test-debug.spec.ts:48 › test_debug (pause/resume) @mcp-ubuntu-latest
❌ [firefox] › mcp/test-debug.spec.ts:167 › test_debug (pause/snapshot/resume) @mcp-ubuntu-latest
❌ [webkit] › mcp/dashboard.spec.ts:182 › should start dashboard and annotate when no dashboard is running @mcp-ubuntu-latest
❌ [webkit] › mcp/dashboard.spec.ts:204 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-ubuntu-latest
❌ [webkit] › mcp/test-debug.spec.ts:48 › test_debug (pause/resume) @mcp-ubuntu-latest
❌ [webkit] › mcp/test-debug.spec.ts:167 › test_debug (pause/snapshot/resume) @mcp-ubuntu-latest
❌ [firefox] › mcp/dashboard.spec.ts:121 › daemon show: closing page exits the process @mcp-windows-latest
❌ [firefox] › mcp/dashboard.spec.ts:161 › should capture annotations via show --annotate @mcp-windows-latest
❌ [firefox] › mcp/dashboard.spec.ts:182 › should start dashboard and annotate when no dashboard is running @mcp-windows-latest
❌ [firefox] › mcp/dashboard.spec.ts:204 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-windows-latest
❌ [firefox] › mcp/dashboard.spec.ts:229 › should switch screencast to -s session on show --annotate @mcp-windows-latest
❌ [firefox] › mcp/dashboard.spec.ts:279 › should disengage annotate mode when --annotate client disconnects @mcp-windows-latest
❌ [firefox] › mcp/dashboard.spec.ts:346 › save recording streams WebM bytes to the chosen file @mcp-windows-latest
❌ [firefox] › mcp/test-debug.spec.ts:48 › test_debug (pause/resume) @mcp-windows-latest
❌ [firefox] › mcp/test-debug.spec.ts:167 › test_debug (pause/snapshot/resume) @mcp-windows-latest
❌ [firefox] › mcp/tracing.spec.ts:54 › check that trace is saved with browser_start_tracing (no output dir) @mcp-windows-latest
❌ [webkit] › mcp/cli-devtools.spec.ts:141 › video-start-stop @mcp-windows-latest
❌ [webkit] › mcp/cli-devtools.spec.ts:155 › video-chapter @mcp-windows-latest
❌ [webkit] › mcp/dashboard.spec.ts:121 › daemon show: closing page exits the process @mcp-windows-latest
❌ [webkit] › mcp/dashboard.spec.ts:161 › should capture annotations via show --annotate @mcp-windows-latest
❌ [webkit] › mcp/dashboard.spec.ts:182 › should start dashboard and annotate when no dashboard is running @mcp-windows-latest
❌ [webkit] › mcp/dashboard.spec.ts:204 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-windows-latest
❌ [webkit] › mcp/dashboard.spec.ts:229 › should switch screencast to -s session on show --annotate @mcp-windows-latest
❌ [webkit] › mcp/dashboard.spec.ts:279 › should disengage annotate mode when --annotate client disconnects @mcp-windows-latest
❌ [webkit] › mcp/dashboard.spec.ts:346 › save recording streams WebM bytes to the chosen file @mcp-windows-latest
❌ [webkit] › mcp/test-debug.spec.ts:48 › test_debug (pause/resume) @mcp-windows-latest
❌ [webkit] › mcp/test-debug.spec.ts:167 › test_debug (pause/snapshot/resume) @mcp-windows-latest
❌ [msedge] › mcp/cli-core.spec.ts:31 › close @mcp-windows-latest
❌ [msedge] › mcp/cli-devtools.spec.ts:141 › video-start-stop @mcp-windows-latest
❌ [msedge] › mcp/cli-devtools.spec.ts:155 › video-chapter @mcp-windows-latest
❌ [msedge] › mcp/cli-json.spec.ts:171 › close after open returns closed status @mcp-windows-latest
❌ [msedge] › mcp/cli-json.spec.ts:177 › close-all after open returns closed sessions @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:50 › close @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:60 › close named session @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:72 › persistent session shows in list after close @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:85 › close-all @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:99 › delete-data @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:111 › delete-data named session @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:128 › session stops when browser exits @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:142 › session reopen with different config @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:159 › workspace isolation - sessions in different workspaces are isolated @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:191 › list --all lists sessions from all workspaces @mcp-windows-latest
❌ [msedge] › mcp/dashboard.spec.ts:121 › daemon show: closing page exits the process @mcp-windows-latest
❌ [msedge] › mcp/dashboard.spec.ts:161 › should capture annotations via show --annotate @mcp-windows-latest
❌ [msedge] › mcp/dashboard.spec.ts:182 › should start dashboard and annotate when no dashboard is running @mcp-windows-latest
❌ [msedge] › mcp/dashboard.spec.ts:204 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-windows-latest
❌ [msedge] › mcp/dashboard.spec.ts:229 › should switch screencast to -s session on show --annotate @mcp-windows-latest
❌ [msedge] › mcp/dashboard.spec.ts:279 › should disengage annotate mode when --annotate client disconnects @mcp-windows-latest
❌ [msedge] › mcp/dashboard.spec.ts:346 › save recording streams WebM bytes to the chosen file @mcp-windows-latest
❌ [msedge] › mcp/test-debug.spec.ts:48 › test_debug (pause/resume) @mcp-windows-latest
❌ [msedge] › mcp/test-debug.spec.ts:167 › test_debug (pause/snapshot/resume) @mcp-windows-latest
❌ [firefox] › mcp/dashboard.spec.ts:204 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-macos-latest
❌ [firefox] › mcp/test-debug.spec.ts:48 › test_debug (pause/resume) @mcp-macos-latest
❌ [firefox] › mcp/test-debug.spec.ts:167 › test_debug (pause/snapshot/resume) @mcp-macos-latest
❌ [webkit] › mcp/dashboard.spec.ts:204 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-macos-latest
❌ [webkit] › mcp/test-debug.spec.ts:48 › test_debug (pause/resume) @mcp-macos-latest
❌ [webkit] › mcp/test-debug.spec.ts:167 › test_debug (pause/snapshot/resume) @mcp-macos-latest

6508 passed, 916 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