Repository navigation
feat(web): read range widgets in toHaveValue - #2061
Asheesh7298 wants to merge 7 commits into
Conversation
The web reader set a value only on native form controls, so toHaveValue could not read an ARIA slider, spinbutton, progressbar, meter, or scrollbar, or a native progress or meter. A locator read now gives them aria-valuetext, else aria-valuenow, else the value attribute. The agent tree is unchanged. Part of e2e-inc#1855.
There was a problem hiding this comment.
5 issues found across 11 files
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/reference/screen.mdx">
<violation number="1" location="docs/reference/screen.mdx:1054">
P3: This sentence is grammatically incomplete and does not identify which Playwright API throws. Say that Playwright's `inputValue()` throws on an ARIA widget.</violation>
</file>
<file name="docs/reference/expect.mdx">
<violation number="1" location="docs/reference/expect.mdx:203">
P3: The fallback description omits the verb `reads`, making the new value-selection rule incomplete. Add `reads` before `its \`value\``.</violation>
<violation number="2" location="docs/reference/expect.mdx:203">
P2: This describes every native `<progress>` as producing a clamped value, but an indeterminate `<progress>` without a `value` attribute is read as having no value and `toHaveValue` rejects it. Qualify the clamp behavior to valued progress elements and document indeterminate progress separately.</violation>
</file>
<file name="packages/e2e/tests/integration/to-have-value-widgets.test.ts">
<violation number="1" location="packages/e2e/tests/integration/to-have-value-widgets.test.ts:13">
P2: This integration test does not exercise the promised `scrollbar` widget support, so a regression in that role can pass unnoticed. Add a valued scrollbar fixture and assert its `toHaveValue()` result.</violation>
</file>
<file name="packages/web/src/in-page/read-semantics.ts">
<violation number="1" location="packages/web/src/in-page/read-semantics.ts:657">
P2: Generic ARIA range widgets should not use their arbitrary `value` attribute as the current value. Return no value after the ARIA attributes unless the element is a native range control, so widgets without `aria-valuetext`/`aria-valuenow` remain rejected.</violation>
</file>
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Reviewed at ce9e81f (main 5acb822, mergeable_state clean, all checks green). Claimed and assigned on #1855 (expect(locator).toHaveValue('On')), so in scope.
Semantics: Playwright's toHaveValue and inputValue() throw Not an input element on anything but input/textarea/select (checked in playwright-core 1.65.1). Reading aria-valuetext / aria-valuenow on range roles only turns a Playwright throw into a value, so no migrated test changes meaning. It also brings web in line with mobile, which already reports a value for these nodes. Native inputs still read .value first (<input type=range aria-valuetext> reads 30), and the tree projection stays unchanged (rangeValue: false), so model input, cache anchors and recordings stay the same. getByDisplayValue on web still only looks at native fields (VALUED_SELECTOR), so it is not affected. core/types.ts only changes JSDoc, so this adds no new contract and needs no core/e2e peer floor. The web-only patch changeset is right.
Must fix
- None.
Should fix
packages/web/src/in-page/read-semantics.ts:657return filled('value'): drop this fallback. No accessibility API reports avalueattribute as a non-native range widget's value, so the "as Chrome does" comment is not accurate here. On form-like custom elements that attribute is usually the initial value, not the current one:<x-range role="slider" value="20">dragged to 80 with noaria-valuenowwould read20, a stale value, where today it reads''. No test covers it (mutantreturn nullpasses every test). Returnnullinstead, and drop "and another widget itsvalueattribute" from the changeset andexpect.mdx. Same point as cubic's P2 on this line.to-have-value-widgets.test.ts: add an indeterminate<progress aria-label="Busy">(novalue) to the refused cases. Mutantreturn String(el.value)(indeterminate reads"0") passes today. A valuedrole="scrollbar"row would also cover the fifth role the docs list (cubic).
Nits
docs/reference/expect.mdx:203: "and another widget itsvalueattribute" goes away with the first should-fix. Say "a valued<progress>" so an indeterminate one is clearly the no-value case (cubic).docs/reference/screen.mdx:1054: "Playwright'sinputValue()throws on an ARIA widget." (cubic)read-semantics.ts: the file now has two range-value readers, the accname contribution (hasAttribute, matches Playwright's role-name rules) andrangeValueOf(skips blanks, clamps native values). They differ on purpose. A one-line pointer between them would stop someone from "unifying" them later.
Verified
- Built core/e2e/web from the PR.
to-have-value-widgets.test.ts,read-node-checked.test.tsand mobilelocate.test.tspass. @e2e-dev/webintegration: 571 passed, 1 skipped. e2eexpect-async-value,locator-basics,scripted-reads,scripted-matchers,web-platform: 102 passed.- Mutants caught: removing the locator branch (= main), turning
rangeValueon in the tree, dropping the blank skip, dropping the meter clamp. Mutants that survived: thevalueattribute fallback and indeterminate<progress>(see Should fix).
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: Claude Opus 5.5 (claude-opus-5-5), coordinator and drafter, Review Once subagents in T3 Code: GPT-6.2 Astra (gpt-6.2-astra), GPT-6.2 Sol (gpt-6.2-sol), Claude Opus 5.5 (claude-opus-5-5), Claude Sonnet 5.5 (claude-sonnet-5-5)
Requesting changes for one required fix: the value attribute fallback in rangeValueOf (inline comment on read-semantics.ts:657). The other inline comments are optional (P3), and you can do them here or leave them for later.
The core change works. On the base, the slider fixture fails with observed: value "". On this head, it passes. The tree projection still has no value (rangeValue: false), so model input and recordings do not change. getByDisplayValue still reads native fields only.
6 inline comments: 1 required, 5 optional.
… the docs A generic element with a range role but no aria-valuenow/aria-valuetext no longer reads a stray value attribute; only a native progress or meter reads a non-aria value, as Chrome reports. The docs qualify the clamp to valued progress/meter, note an indeterminate progress is refused, name the Playwright inputValue throw, and drop a verb-less fragment. Adds scrollbar and indeterminate-progress tests.
There was a problem hiding this comment.
1 issue found across 5 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/e2e/tests/integration/to-have-value-widgets.test.ts">
<violation number="1" location="packages/e2e/tests/integration/to-have-value-widgets.test.ts:58">
P2: This assertion is unreachable because the preceding unnegated `toHaveValue('')` rejects the test, so the new indeterminate `<progress>` fixture is never exercised. Split the refusal cases into separate expected-failure tests (or otherwise assert each failure independently).</violation>
</file>
…e case A progress or meter adopted from another frame keeps that frame's prototype, so instanceof missed it. The read now goes by tag. The indeterminate progress gets its own expected-failure test, since the assertion after a failing one never ran, and the comment says only the native clamp follows Chrome.
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked at 8699035 (main c330373). Every earlier ask is done: the value attribute fallback is gone (only a valued native <progress> / <meter> reads beyond the ARIA attributes), indeterminate <progress> and valued scrollbar have fixtures, the refusals are separate tests so each one runs (cubic's unreachable-assertion P2 was real and is fixed), the read goes by tag so an adopted <progress> clamps, the Chrome comment is narrowed, and both doc wordings are fixed. kdy1's required fix and all five optional ones are in. No regressions in the new commits.
Must fix
- None.
Should fix
to-have-value-widgets.test.ts: nothing pins the dropped fallback. Puttingreturn filled('value')back in place ofreturn nullinrangeValueOfstill passes every test. Add a refused case like<div role="progressbar" aria-label="Stray" value="20"></div>to the expected-failure titles.
Nits
read-semantics.tsrangeValueOf:(el as Element & { readonly value?: unknown }).valuecan drop the cast.if (!('value' in el) || typeof el.value !== 'number') return null;narrows without one.docs/reference/expect.mdx: "aprogressbarwith no value" in the last bullet repeats the refused case from the web bullet above it. Keep "a heading, a link".
CI
specat this head: all fivetestjobs hit the 15 min job timeout while tests were still passing (the last lines are greenbuilt-in-overrides.test.ts), sospec gatefails ontest cancelled. That is runner slowness, not this PR: other PRs' spec runs this morning were cancelled the same way, and the PR adds one 3s test. Needs a re-run. Everything else is green.
Verified
- Built core, e2e and web from the PR.
to-have-value-widgets.test.ts(e2e),read-node-checked.test.ts(web) and mobilelocate.test.tspass. - Mutants caught: indeterminate
<progress>reads"0",instanceofin place of the tag check (adopted-frame test fails), no blank skip,aria-valuenowbeforearia-valuetext, no locator branch (= main). Survived: thevalueattribute fallback (see Should fix).
|
Added the refused case in
|
There was a problem hiding this comment.
0 issues found across 3 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
|
/ready |
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked 7c8c4d2. The last ask is done: still refuses a stray value attribute on a range widget pins that a value attribute on role="progressbar" is not read, and the run-level check asserts it fails with no value (not a form control). The read-semantics.ts change only drops a cast ('value' in el narrows it) and keeps the by-tag rule. CI is green (26 success, 4 path-skipped). No new asks; the Ready for Human Review label from /ready stands. Maintainer decision still open: widen inputValue to ARIA range widgets (recommend accept).
michal-e2e
left a comment
There was a problem hiding this comment.
Drafted by an AI agent and posted autonomously on Michal's behalf, without him reading it first.
Drafted in Claude Code on T3 by Claude Opus 5.5, with GPT-6.2 Astra, GPT-6.2 Sol and Claude Fable 5.2 as second readers.
Reviewed at 7c8c4d2ca (merge base 3fec41f4b, main). It also merges cleanly onto the current main tip 97b51a229.
The ARIA slider case from #1855 works: on the merge base, toHaveValue('50') on <div role="slider" aria-valuenow="50"> observed value "", and on this head it passes. One thing needs a fix first. The new reader calls a page-defined value getter, and a getter that throws breaks lookups for unrelated fields.
Must fix
-
An exact
getByLabelfor an unrelated field fails when the page has a custom element with a range role whosevaluegetter throws. I put<label>Email <input value="ada@example.test"></label>next to an<upload-progress role="progressbar" aria-label="Upload">whose class definesget value() { throw new Error('upload-progress: not ready') }. On this head,await screen.getByLabel('Email', { exact: true }).count()fails withENGINE_FAILURE: locate failed: locator.elementHandles: Error: upload-progress: not ready. On the merge base the same page returns 1. The exact-label engine reads every[aria-label]element on the page, andrangeValueOfreadsel.valuebefore it checks the tag, so the getter runs during a lookup for the Email field. The repo's review notes list in-page code trusting the page as a recurring pattern (.dev/skills/babysit/references/review-triage.md, pattern 5). Please check the tag first, so the reader only reads.valuefrom a native<meter>or a<progress>with avalueattribute, and add that custom element next to an Email field to the widget test.read-semantics.ts:667One way, tried at
7c8c4d2ca: with this change the Email lookup returns 1 again. Your widget test (the frame-adopted<progress>included) and the tree test still pass.const tag = el.tagName.toLowerCase(); if (tag !== 'meter' && !(tag === 'progress' && el.hasAttribute('value'))) return null; if (!('value' in el) || typeof el.value !== 'number') return null; return String(el.value);
Optional
-
Your changeset says "A widget with none is refused", which doesn't hold in three cases. A
<div role="slider">or<div role="spinbutton">with no ARIA value passestoHaveValue(''), andinputValue()returns''. That's the same as on the merge base, and the docs bullet says so. A<meter>with novalueattribute now reads"0", where the merge base refused it. That also contradicts "A valued native<progress>or<meter>" inexpect.mdx, since a native meter always has a value: with novalueattribute it reads the low end of its range. Suggested changeset sentence: "Asliderorspinbuttonwith none reads'', as before, and any other widget with none, such as an indeterminate<progress>, is refused." Inexpect.mdx: "A native<meter>, and a<progress>with avalueattribute, read the value their range clamps them to." changeset,expect.mdx:233 -
The Android exception is wider than "a text view".
nodes.tsdrops the value of any non-editable Android node whose value equals its label (android && !editable && value === source.label). The checked-in Android capture shows this on a heading:inventory-headeris anandroid.view.Viewwith label and value bothPlain controls, every state exposed, and its projected node has no value. Please say "a non-editable Android node whose value repeats its label" in the Detox row and inexpect.mdx. The Android half of "mobile already reads a value outside the form roles" isn't shown either. In the 24 Android captures, every non-editable node with a value has it equal to its label, so none keeps one, and the benchmark app sets noaccessibilityValue. Either scope the device sentence to iOS, which the captures do show (status "In progress" value="1"), or attach an emulator run with anaccessibilityValuethat differs from the label. The edited Detox row also sits under "Planned".detox.mdx:166,expect.mdx:239,nodes.ts:654 -
Can we add three fixture rows for the precedence and blank rules? The head gets all three right when I run them. These mutants pass both new test files: reading a native
<progress>or<meter>before its ARIA value, treating a whitespace-onlyaria-valuetextas filled, and trimming the value it returns. Rows that would catch them:<progress aria-label="Mixed" value="7" max="10" aria-valuenow="70">reads'70'.aria-valuenow="50" aria-valuetext=" "reads'50'.aria-valuetext=" On "reads' On '.
Follow-ups
- An
<input type="range" value="30" aria-valuetext="Thirty">created in a same-origin iframe and appended to the page now reads"Thirty"instead of"30"; the merge base read"". The native-input branch still dispatches oninstanceof(read-semantics.ts:1721), so the element falls through to the new range branch. This is thelocalNamefollow-up an earlier round already mentioned.
Verified
All runs below are mine, on this machine, at 7c8c4d2ca. I built the merge base 3fec41f4b separately and gave it the same inputs. Each probe ran once per side.
-
Probes through the public matcher:
merge base this PR role="slider" aria-valuenow="50",toHaveValue('50')value ""passes <progress value="20" max="10" aria-valuetext="Complete">refused "Complete"<progress value="7" max="10" aria-valuenow="70">refused "70"aria-valuetext=" " aria-valuenow="50""""50"aria-valuetext=" On """" On "valueless slider and spinbutton, toHaveValue('')passes passes <meter>with novaluerefused "0"getByDisplayValue('3')with an input and a spinbutton both at 31 match 1 match exact getByLabel('Email')beside a throwingvaluegetter1 match ENGINE_FAILURErange input appended from an iframe """Thirty" -
Suites at
7c8c4d2ca, run here:- Green:
pnpm check,pnpm test(every package andtest:scripts), the testbed (600 passed, 1 skipped), and the web benchmark (95 passed). - Flaky: the first
pnpm testrun had one failure inparallel-workers.test.ts, "keeps the failed attempt before a retry that blocked its worker". It expected exit code 1 and got 3, with a load average of 133 on 18 cores. That test passed when rerun alone on this head and on the merge base, and a fullpnpm testrerun at load 27 was green. - Web agent suite (from recordings,
--strict-cache, no model key): 8 failures, allMODEL_PROVIDER_FAILEDon steps with no recording. The same 8 fail on the merge base, and neither side reportedREPLAY_STALE, so no recording changed.
- Green:
-
New tests: 3 added, and each fails under at least one mutant. The widget suite fails under 15 mutants. The tree test fails when the tree projection gets the range value. The mobile test fails when the Android echo is kept. Your widget test is red on the merge base with the expected assertion; the other two pass there, as guards of behavior that didn't change.
-
Mutation testing: 12 places this PR adds or changes a branch in
read-semantics.ts, 20 mutants, 16 killed by a failing assertion across the two new web-facing test files. Four survived both files and the whole@e2e-dev/websuite. Three are the precedence and blank cases above. The fourth leavesscrollbarout of the accessible-name path, which this PR only refactored. No mutant failed another way or failed to build. -
Contract:
api-diffbetween the built merge base and head shows one JSDoc line incore/dist/types.d.tsand no schema, protocol, export or peer change.@e2e-dev/corehas no changeset entry, which fits a comment-only change.
Not run
- Mobile benchmark: no mobile or core runtime source changed, and the benchmark app has no node that could show the Android case. Command:
pnpm test:mobile-benchmark. - An Android emulator run with an
accessibilityValuethat differs from the label (see the second optional item). pnpm bench:ab -- tests-agent/control-inventory.e2e.ts --config e2e.agent.config.ts: the machine was too loaded for timings. The tree projection is unchanged and the strict replay matched on both sides.- The crosscheck over every benchmark scenario:
CROSSCHECK_BENCHMARK_URL=http://127.0.0.1:4280 pnpm --filter @e2e-dev/web exec vitest run tests/integration/crosscheck.test.ts. CI's benchmark gate is green at this head (Source-reported), and the fixture-page crosscheck ran green insidepnpm test. - The 8 agent steps that need a model key.
Accepted as intended
- An ARIA value reads as the author wrote it, not clamped the way Chrome clamps it, so an assertion compares what the app set. A native
<progress>or<meter>reads its clamped value.
For the maintainer
locator.inputValue()now returns these values too. Playwright'sinputValue()throws on an ARIA widget (read inplaywright-core1.65.1, not run). The author offered to keepinputValue()to form controls instead.- On the merge base, an ARIA slider or spinbutton with
aria-valuenowread'', sotoHaveValue('')passed andinputValue()returned''. It now reads the value. The changeset is a plain patch with no note about that. scrollbarand native<progress>and<meter>go beyond the four roles in the claim on #1855, which asked for "a non-form node with a value".- #1869 at
f65722e13readstoBeEmptyfromnode.valuefor thesliderandspinbuttonroles. Once both land, an ARIA slider witharia-valuenowis no longer empty.
The findings are mine; the approval is @okwasniewski's.
|
Fixed in From your optional list:
Left for the follow-up you listed: the iframe-adopted
|
There was a problem hiding this comment.
0 issues found across 5 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
michal-e2e
left a comment
There was a problem hiding this comment.
Drafted by an AI agent and posted autonomously on Michal's behalf, without him reading it first.
Re-reviewed at f22dddeb5. The Email-field regression is fixed. The tag and attribute checks now happen before the value read, so the unrelated custom progress bar no longer breaks getByLabel('Email', { exact: true }). The new test exercised the exact case that failed at 7c8c4d2ca. The test for a native progress element moved out of an iframe passed too. Reader · Regression test
The release note and matcher docs now describe when a widget without a value returns an empty string or is refused. The Android note also describes the non-editable case accurately. I found no remaining code changes to request in this round. Approval stays with the maintainer.
Before merging: get a green spec gate. Both Node 24 jobs passed the widget regression, then were canceled while the larger test matrix was still running. Their timing matches the workflow's 15-minute limit, though the logs only confirm cancellation. Spec run
Verified locally: build, the widget integration test through the built browser runner, tree projection, and mobile snapshot projection. The current head merges cleanly with main at 97b51a229. This follow-up reran the affected checks. The full repository matrix, mutation sweep, and real-device tests were not repeated locally.
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: Request changes
This review requests changes. Fix the P2 items before merge. The P3 items are optional and do not block the merge.
The change does what #1855 asks. On the merge base, <div role="slider" aria-valuenow="50"> reads value "". On this head, toHaveValue('50') passes. The tree projection still has no range value, so model input and recordings do not change. I am requesting changes for one problem: the fix in f22dddeb5 does not stop a page's own value getter from running in every case, so an unrelated exact getByLabel can still fail. There is also one non-blocking problem with native inputs that come from another frame.
Reviewed commit: f22dddeb59faec6ca9b15bd82aa0a944ab0646f4
- P2 (fix before merge): 1 (1 inline)
- P3 (non-blocking): 1 (1 inline)
| if ((tag !== 'meter' && tag !== 'progress') || !el.hasAttribute('value')) return null; | ||
| if (!('value' in el) || typeof el.value !== 'number') return null; | ||
| return String(el.value); |
There was a problem hiding this comment.
P2 · Fix before merge · A customized built-in <progress> or <meter> still runs the page's value getter
The tag check stops an autonomous custom element, but it does not stop a customized built-in. For <progress is="upload-progress" value="1">, the tag is progress, so el.value calls the page's override. An exact getByLabel reads every labelable candidate before it compares labels, so this getter runs during a lookup for an unrelated field.
The page for the probe:
customElements.define('up-a', class extends HTMLProgressElement {
get value() { throw new Error('upload not ready'); }
}, { extends: 'progress' });
document.body.innerHTML = '<input aria-label="Email" value="ada"><progress is="up-a" aria-label="Upload" value="1" max="10"></progress>';screen.getByLabel('Email', { exact: true }).inputValue() |
Result |
|---|---|
Merge base 3fec41f4b |
"ada" |
This head f22dddeb5 |
locate failed: locator.elementHandles: Error: upload not ready |
The autonomous <up-b role="progressbar"> from the new test gives "ada" on both sides. A getter that returns a number is a second form of the same problem: for value="20" max="10", a getter that returns a percentage makes the read report "100", not the clamped "10" that expect.mdx documents. The PR description says that a page's own value getter never runs, but that is not true for this case.
| const text = (el.textContent ?? '').replace(//g, ''); | ||
| value = text === '' || (text.trim() === '' && rendered === '\n') ? '' : rendered; | ||
| if (projection.textLimit !== null) value = value.slice(0, projection.textLimit); | ||
| } else if (projection.rangeValue && RANGE_ROLES.indexOf(implicitRole(el) ?? '') !== -1) { |
There was a problem hiding this comment.
P3 · Non-blocking · A native input from another frame now reads its ARIA value
Optional. This does not block the merge.
An <input> that is created in a same-origin iframe and then moved into the page keeps the iframe's prototype. Thus el instanceof HTMLInputElement at line 1722 is false, and the element goes into this new range branch. rangeValueOf then returns its aria-valuetext or aria-valuenow, not its value.
getByTestId('t').inputValue() |
Merge base | This head | Native value |
|---|---|---|---|
Moved <input type="number" aria-valuetext="Unset">, empty |
"" |
"Unset" |
"" |
Moved <input type="range" value="30" aria-valuetext="Thirty"> |
"" |
"Thirty" |
"30" |
The changeset says "Form controls read as before", but the number input changes from a correct value to an incorrect one. The instanceof check is older than this PR, and an earlier review lists it as a follow-up. Thus this problem is non-blocking. rangeValueOf already checks the tag for <progress> for the same reason.
|
@kdy1 Fixed in Your P3 is in too: a form control adopted from another frame skips the range branch, so the moved New tests: a throwing and a misreporting customized built-in, the adopted control, and rows for the parser, each clamp, and a slider with no value. Each new rule fails a test when it is broken. A hostile-page audit (70 pages, 13 locator reads each) finds no read that works on main and fails here.
|
There was a problem hiding this comment.
0 issues found across 3 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Re-checked e1e1fd6 (merge base 3fec41f, main 5711573). kdy1's P2 from 02:33 UTC is fixed: a native <progress> / <meter> value is now computed from its attributes, so a customized built-in's value getter never runs, and getByLabel('Email', { exact: true }) reads "ada" next to a throwing <progress is>. His P3 is fixed too: an input / textarea / select / option adopted from another frame skips the range branch and reads "" as on the merge base. Every earlier ask from our reviews and from michal-e2e is still in place. cubic found nothing at this head.
Must fix
- Merge conflict with main (
mergeable_state: dirty) inpackages/web/src/in-page/read-semantics.ts,skills/e2e/references/writing-tests.mdandplugins/e2e/skills/e2e/references/writing-tests.md, from #2219 (toBeEmpty). Both sides are needed: keep main'semptyStateprojection field next torangeValue, and in the skill keep main'stoBeEmptysentence and "all four", with your "toHaveValuea control's value" wording. Then runpnpm plugins:sync. WebtoBeEmptyreadsstates.emptyfromemptyOf, notvalue, so a valued ARIA slider stays empty on the web after the merge, as in Playwright.
Should fix
read-semantics.ts:670-683reimplements the HTML float parser and both clamps (15 lines plus a regex) to avoid a page's getter. A smaller fix gives the same protection: call the built-in getter from the prototype, e.g.Object.getOwnPropertyDescriptor(tag === 'progress' ? HTMLProgressElement.prototype : HTMLMeterElement.prototype, 'value')!.get!.call(el). A subclass override does not affect it, and it works on an element adopted from an iframe. I checked this in Chromium, Firefox and WebKit, and with that swap the wholeto-have-value-widgetssuite passes, the customized built-in and adopted-frame tests included. It also follows each browser exactly, which the hand parser does not. It matches Chromium on all 1,860 combinations I tried, but differs from Firefox on 163 (Firefox's.valuetreats trailing text such asvalue="5 "or"70%"as an error and reads0, where this reads5/70) and from WebKit on 25 (meter value="1e400").@e2e-dev/webruns Firefox and WebKit, so in those browsers the matcher would disagree with the page's own.value. With the swap, the parser rows can go (Percent textwould read0on Firefox), and the clamp rows stay as browser-behavior pins.
Verified
- Built core, e2e and web from the head.
to-have-value-widgets.test.ts(e2e) andread-node-checked.test.ts(web) pass, webtsc --noEmitand oxlint are clean, and the diff adds no new dashes. - Mutants, each caught: the adopted-control guard removed,
.valuein place of the attribute parse (customized built-in test fails), nomax <= 0fallback for<progress>, nomin > maxfix for<meter>, and an integer-only parser. - CI at e1e1fd6 is green: spec gate, mobile, docs, benchmark and build all pass. It ran before main moved, so it needs a re-run after the merge.
|
🤖 Claude Opus 5.5 responding on behalf of @KrzysztofMoch Closing in favor of #2242, which carries this branch forward. Your commits are kept with your authorship, rebased onto main past the |
What and why
toHaveValuereads a node'svalue, but the web reader set one only on native form controls, so an ARIAslider,spinbutton,progressbar,meter, orscrollbar, and a native<progress>or<meter>, could not be asserted on.aria-valuetext, elsearia-valuenow, skipping a blank one. A native<progress>or<meter>with avalueattribute then reads the value its range clamps it to, as Chrome does. Asliderorspinbuttonwith none reads'', as before, any other widget with none has no value, and a strayvalueattribute on it is not read. A native value is computed from thevalue,min, andmaxattributes as HTML clamps them, never through.value, so a page's own getter (a customized built-in<progress is>) never runs; it equals Chrome's.valueon 6,510 attribute combinations. Native form controls and editors read as before, a control adopted from another frame included.locator.inputValue()reads the same field, so it returns these values too. Playwright's throws on an ARIA widget. I kept the two paired because the docs describe them together and mobile already works this way. If you'd rather keepinputValue()to form controls, that's a small follow-up here.locatetool now prints a range widget's value too (value "50"), through the same redaction as any other value.status "In progress" value="1"), so the matcher reads them today. Android drops the value of a non-editable node when it repeats the node's label, so that case usestoHaveText, and the Detox guide says so.reference/expect.mdx,reference/screen.mdx, the Detox guide (a "Not yet" row now covers only that Android case), and thewriting-testsskill line.Issue
Part of #1855:
expect(locator).toHaveValue('On'). @okwasniewski, this is ready for review.Verified
Ran it locally: yes
to-have-value-widgets.test.tsruns the public locator and matcher on a real page: ARIA slider,aria-valuetext, spinbutton, progressbar,<progress>,<meter>, over-max and invalid native values, a blank ARIA value, an editable spinbutton, a native range input that keeps its own value, and widgets with no value that are still refused. It fails on main's web source and passes here.read-node-checked.test.tspins that the agent's tree still has no value for a range widget, and one in the mobilelocate.test.tspins the device projection, including the Android label echo.pnpm check, the fullpnpm test(8,082 passed), the testbed (598 passed, 3 skipped), and the web suite pass. A hostile-page audit (70 pages, 13 locator reads each) finds no read that works on main and fails here. Each clamp, the attribute parser, and the adopted-control guard fail a test when broken.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.