feat(expect): include aria snapshot in expect failure messages#40390
feat(expect): include aria snapshot in expect failure messages#40390pavelfeldman merged 1 commit intomicrosoft:mainfrom
Conversation
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? }`.
4417dc5 to
0622e3e
Compare
This comment has been minimized.
This comment has been minimized.
Test results for "tests 1"4 flaky41432 passed, 847 skipped Merge workflow run. |
Test results for "MCP"77 failed 6508 passed, 916 skipped Merge workflow run. |
Summary
Aria snapshot:section to expect failure messages.toHaveText,toContainText) print the full subtree; property matchers (toBeChecked,toHaveAttribute,toHaveRole,toHaveValue,toHaveCSS, ...) print just the element line.to.have.count,*.arrayandto.match.ariaare excluded.