test(e2e): drop the textarea fork and select the value editors by role - #8448
Draft
talissoncosta wants to merge 2 commits into
Draft
test(e2e): drop the textarea fork and select the value editors by role#8448talissoncosta wants to merge 2 commits into
talissoncosta wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The E2E ? textarea : Highlight fork was added in 2022 as a TestCafe workaround. Playwright landed in March and drives a contenteditable with fill(), so every E2E assertion about this editor has been running against a textarea that only exists during tests. placeholder and readOnly only ever worked on that textarea, so they go with it, along with the three call sites passing them. Highlight takes role and aria-readonly from the caller rather than deriving them from onChange, so ValueEditor can name its read-only editors while the code blocks that also use Highlight stay unlabelled. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ValueEditor no longer takes a data-test. Three accessors replace it, and
setText/waitForElementVisible accept a Locator so callers can pass one.
featureValueField() role=textbox, /^(Value|Control Value)/
variationValueField(i) role=textbox, "Variation Value", nth(i)
segmentOverrideValueField(i) scoped to the override, then role+name
The feature value alternation is not cosmetic: the label becomes
"Control Value <weight>%" once a feature has variations.
This also retires a selector that encoded its own value:
data-test={`featureVariationValue${featureStateToValue(value) || index}`}
The id was featureVariationValue1 only while the field was empty, and
became featureVariationValueadded once you typed. The tests passed because
they addressed it before typing.
toHaveValue becomes toHaveText in change-request-test: the editor is a
contenteditable, not a textarea, so there is no value to assert on.
No new type errors in e2e (3 before, 3 after, all pre-existing).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
talissoncosta
force-pushed
the
refactor/value-editor-typescript
branch
from
September 4, 2026 11:52
d0fef50 to
0d08e41
Compare
talissoncosta
force-pushed
the
test/value-editor-a11y-selectors
branch
from
September 4, 2026 11:52
9a921cc to
fa47156
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warning
Not for this round. #8446 is the PR that closes #8441 and #8442; this is
follow-up work and should not merge before it. Kept as a draft against a
non-main base for that reason.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Stacked on #8447 — review that first, this targets its branch.
Split out of #8447 deliberately: it is the only part of that work CI can validate and the only part I cannot check locally, so it is worth being able to revert on its own.
The fork.
E2E ? <textarea> : <Highlight>was added in 2022 (#1642) as a TestCafe workaround. Playwright landed in March (#6562) and drives acontenteditablewithfill(); TestCafe is gone frompackage.jsonentirely. Until now every E2E assertion about this editor ran against a<textarea>that only exists during tests — the real editor was never exercised.placeholderandreadOnlyonly ever worked on that textarea, so they go with it, along with the three call sites passing them.The selectors.
ValueEditorno longer takes adata-test. Three accessors replace it, andsetText/waitForElementVisibleaccept aLocator:This is only possible because #8447 gave the editor
role="textbox"and an accessible name.The alternation in
featureValueFieldis not defensive: the label becomesControl Value <weight>%once a feature has variations, andeditRemoteConfighits that path.It also retires a selector that encoded its own value:
The id was
featureVariationValue1only while the field was empty, and becamefeatureVariationValueaddedonce you typed. The tests passed because they addressed it before typing.toHaveValuebecomestoHaveTextinchange-request-test: the editor is acontenteditable, so there is novalueto assert on.How did you test this code?
CI is the test here, and that is the point of the split. I cannot run the suite locally — no API on :8000 and no containers — so this PR is unverified until the E2E job runs.
What I could check: reproduced what
fill()does to the live component in Storybook (focus, select all,insertText) and confirmed the edit reachesonChangeand survives a blur. No new type errors ine2e/(3 before, 3 after, all pre-existing).Reviewing this
If the E2E job is red, the two commits are independently revertible: the fork removal and the selector swap fail differently — a selector problem fails as "element not found", a contenteditable problem as "value not set".
Follow-up
The helper layer is the next thing this unlocks.
setTextwrapsfill()with a redundantwaitForandclear()(both already done byfill()), plus.first(), which disables Playwright's strict mode. Across the file: 1246 lines, 75 helpers, 51.first()calls, 47 redundant waits. As tests move togetByRole, they can call Playwright directly and the layer shrinks — no big-bang rewrite needed.