fix(web): match getByText across a line break as the text reads

Closed
PO
3d ago
+87-2

What and why

  • getByText('Line one line two') found nothing for <p>Line one<br>line two</p>, though textContent() reads it that way. A string now also matches where a line break stands in for a space, the same way role names already tolerate icon glyphs.
  • Exact stays whole and case-sensitive; a RegExp is passed as written.

Issue

Fixes #2167

Verified

Ran it locally: yes

  • New tests/integration/text-line-breaks.test.ts fails on main and passes with this change.
  • @e2e-dev/web tests pass (7 video and svg visibility failures are the same on main in my environment), plus tsc --noEmit, oxlint and the changeset check.

Checklist

  • Changeset added (pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only

Summary by CodeRabbit

  • Bug Fixes
    • Text searches now match multiword text across line breaks, including case-insensitive and normalized queries. Exact matches remain whole-text and case-sensitive.