Skip to content

chore: port the assertions from the upstream matchers - #2071

Merged
Yury Semikhatsky (yury-s) merged 6 commits into
microsoft:mainfrom
yury-s:assertions-upstream
Nov 24, 2026
Merged

Yury Semikhatsky (yury-s) merged 6 commits into
microsoft:mainfrom
yury-s:assertions-upstream

Conversation

@yury-s

@yury-s Yury Semikhatsky (yury-s) commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The assertion classes are a line-by-line port of packages/playwright/src/matchers (matchers.ts, toBeTruthy.ts, toEqual.ts, toMatchText.ts, toMatchAriaSnapshot.ts, matcherHint.ts). jest is not ported: MatcherUtils prints the values in the same layout, and where upstream prints a diff both values are printed in full, as in the .NET port.
  • Failure messages have the upstream layout with the Java call: assertThat(locator).not().hasText(expected) failed, then Locator:, Expected:, Received:, Timeout: and the call log. Boolean matchers now carry an expected value on the AssertionFailedError.
  • Locator.toString() prints the Java locator code: it asks the driver (LocalUtils.asLocatorDescription), the locator generators are not ported. Without a connection it is the description or Locator@<selector>.
  • Ported tests that pin the message text are translated to the Java names and unmarked (64 @Fixme removed); the rules are in playwright/src/test/AGENTS.md.
  • The tests that change the default assertion timeout are in their own @Isolated class: the timeout is global and they raced with tests that pin the default.

@yury-s
Yury Semikhatsky (yury-s) merged commit 930933c into microsoft:main Nov 24, 2026
14 checks passed
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