Repository navigation
fix(locator): name level, states, and exact: false in a locator's description - #2494
gagarinyury wants to merge 1 commit into
Conversation
…cription
describeExpression printed a role query's value, name, and visible only,
so getByRole('heading', { level: 2 }) read as getByRole("heading") and a
checked: false checkbox as the checked one. The description now appends
exact: false, the level, and each required state.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix · Severity of issue fixed: Low Merge Risk:
|
okwasniewski
left a comment
There was a problem hiding this comment.
Automated review (AI triage pass), not yet read by a maintainer.
Reviewed 7a317f85f. Correct, minimal root-cause fix: describeExpression now prints exact: false, level, and role states, the only query fields it dropped; no must-fix found.
Checked:
- On main the query case prints value, name and
visibleonly (expression.ts:185-191), whileroleQuerystoresstatesandlevel(L22-L35). After this change every field ofSemanticQuerythat affects matching shows up in the description (expression.ts:189-196). - Defaults still print nothing (
exact: true, regex patterns, no level, no states). Existing pinned descriptions are unchanged, andlocator-engine,mcp-test-lines,mcp-sessionandexpressionunit tests pass on the PR head (160 tests). - The description only labels steps, errors, report
details.locatorand MCP text. Cache keys come from recorded targets, not this string, so recordings are unaffected. - Mutation check: with main's
expression.tsrestored, the new test fails. It can fail. - States print in
roleQuery's fixed insertion order, so the output is deterministic. The test pinsdisabledbeforepressed. - The changeset (
@e2e-dev/corepatch) is accurate.
Nits
- expression.ts:189 - the comment repeats the test name. It can go. Optional.
CI: fork workflows (mobile, spec, docs, benchmark, microbench) are action_required and wait for maintainer approval. Only check and policy jobs have run, and those are green.
kdy1
left a comment
There was a problem hiding this comment.
Note
This text was drafted with AI and posted after human approval.
- Harness: T3 Code
- AI agents: coordinator: Claude Opus 5.5 (claude-opus-5-5), reviewer: GPT-6.2 Astra (gpt-6.2-astra), reviewer: GPT-6.2 Sol (gpt-6.2-sol), reviewer: Claude Opus 5.5 (claude-opus-5-5), reviewer: Claude Sonnet 5.5 (claude-sonnet-5-5)
Verdict: Approve
This review approves the pull request. The P3 items are optional and do not block the merge.
Whether the changeset wording below needs a fix before merge is left to @okwasniewski.
Reviewed commit: 7a317f85fb85cc0ad1d41f5367ced120ef97a413
- P3 (non-blocking): 1 (1 inline)
This review is posted as a comment because the reviewer asked for a plain review comment and leaves the call on the changeset wording to the maintainer. The verdict above still applies.
| '@e2e-dev/core': patch | ||
| --- | ||
|
|
||
| A locator in a failure message, a step label, or a report names every option it was built with: `getByRole("heading", level: 2)`, `getByRole("checkbox", name: "Agree", checked: false)`, and `getByText("Pro", exact: false)`. Locators that differ only by level, a state, or `exact` used to print the same. |
There was a problem hiding this comment.
P3 · Non-blocking · The changeset says every option is named, but some options are not printed
Optional. This does not block the merge.
The release note says a locator "names every option it was built with". describeExpression does not print an explicit exact: true, exact: false on a regular expression, or visible: false. These options are defaults or have no effect, so the output is correct, but the release note claims more than the formatter does. For example, getByText(/pro/i, { exact: false }) prints getByText(/pro/i) on this head. The ## What section of the PR body uses the same wording.
What
A locator in a failure message, step label or report names every option it was built with:
Why
Locators that differ only by
level, a state orexactprinted the same. A miss caused by one of those options read like a locator that should have matched.How it works
describeExpression's query case (packages/core/src/locator/expression.ts), after the name:exact: falsewhen the value or name is a loose string, thenlevel, then each required state in the orderroleQuerystores them. Defaults print nothing, so every existing description is unchanged.Issue
Fixes #2490
Verified
Ran it locally: yes
getByRole('heading', { level: 2 })getByRole("heading")getByRole("heading", level: 2)getByRole('checkbox', { name: 'Agree', checked: true })getByRole("checkbox", name: "Agree")getByRole("checkbox", name: "Agree", checked: true)New case in
packages/e2e/tests/unit/expression.test.ts. The e2e unit suite passes unchanged (5131 tests).pnpm checkpasses.Checklist
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it..d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures.e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.🤖 Generated with Claude Code
Summary by CodeRabbit
exact: false, making it easier to distinguish queries with different settings.exact: trueandexact: falsefor regular-expression text queries remain omitted.