Repository navigation
Match text and labels on the DOM, as Playwright does - #1089
Conversation
…loses #1073, Closes #1074) The web engine answered getByText with the control of a label and with a placeholder, found no text inside a button, and joined adjacent blocks with a space. Text now reads the DOM text, a label query reads the label sources, and a leaf lists its inline text. The three ported tests run as upstream wrote them. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ls2e1yaZFgZ3FEJkYScfkK
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 20 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…query # Conflicts: # src/E2E/Locator/Screen.cs
|
@coderabbitai review |
Action not completed
|
…query # Conflicts: # COMPATIBILITY.md # src/E2E/Engine/PageScript.cs # src/E2E/Locator/Screen.cs
…ge script does Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ls2e1yaZFgZ3FEJkYScfkK
|
@coderabbitai review |
Action not completed
|
On the web,
GetByTextreturned the control a label names, matched an input's placeholder, found no text inside a button, andhasTextjoined two adjacent blocks with a space. Upstream resolves these through Playwright on the real DOM; the port resolves them over its tree, and the tree matched accessible names and rendered (collapsed) text. Now the tree carries what Playwright reads.GetByTextandhasTextmatch the element's DOM text (no separator between blocks, a button input's value, script and style left out).GetByLabelmatches thearia-label, thearia-labelledbytargets and the<label>text. A label's text is listed, so the label answers a text query. A button lists the inline elements it holds, soGetByText("hello")finds the span inside it.The three tests that #1077 kept behind
ExpectedToFailAsyncor[Ignore]now run as upstream wrote them (GetByLabel_should_work,GetBy_escaping,Locators_should_not_be_affected_by_global_and_sticky_regex_flags,Should_filter_by_regex_with_a_single_quote,Should_filter_by_regex_with_special_symbols). Docs and COMPATIBILITY.md say the web reads DOM text and labels.Upstream parity
Ported: tester-army/e2e
bdf769btestsselectors-get-byandlocator-query(already in #1077). Upstream'slabelsof a raw node (web/src/in-page/read-semantics.ts,labelsOf) islabelshere. No upstream test is skipped or partial in this change..NET-only, with reasons (upstream uses Playwright locators, the port resolves over its tree):
SemanticNode.DomTextanddomTextin the page script: Playwright's element text.SemanticNode.Labels(internal): the label sources oflabelsOf.LocatorResolver.HasText: picks DOM text when a node has it.tests/E2E.Tests/TextQuery/TextQueryTests.cs: 6 tests with no upstreamit; they pin the tree behavior.Differences: a regex is tested on DOM text with whitespace collapsed; Playwright tests the raw text. As Playwright,
hasTextreads no input value and does not look into a nested frame. The agent's snapshot now lists a label's text beside its control, as upstream's tree does; DOM text is cut at 512 characters, asTextwas.Closes #1072
Closes #1073
Closes #1074
🤖 Generated with Claude Code
https://claude.ai/code/session_01Ls2e1yaZFgZ3FEJkYScfkK