Repository navigation
[test-helpers] Add EuiSelectableObject - #9908
Conversation
Ports the EuiSelectable Component Object prototyped and validated in Kibana's kbn-scout into the package, with selectors, validation specs against Storybook, and a component README. apps-dx elastic/apps-dx#74
Keep the surface minimal. Add it back when a consumer needs to read checked state.
326876c to
f99c79f
Compare
…ctOption() Prior review (kibana#284680) asked whether option() has a real non-click consumer and flagged check()'s retry loop for hiding rendering issues. Auditing the real Kibana consumers, option() is always immediately clicked and never used as a bare Locator, and check()'s sole consumer is a suite skipped upstream, so its retry loop was never proven safe. Collapsed both into a single selectOption(label) action: no-op if already checked, otherwise one click, no retries.
A reviewer bug report on the Kibana consumer PR found that a consumer using a custom renderOption to add content (e.g. a description) inside the option renders that content in the same label element, breaking selectOption()'s anchored match. The helper's matching is correct for default-rendered options; this documents the boundary so the next consumer doesn't hit the same trap.
weronikaolejniczak
left a comment
There was a problem hiding this comment.
Changes look good to me but the PR description is incorrect:
- there's no
checkedOptions, - there's no
aria-checkedretry loop.
Also, single-select mode uses aria-selected, not aria-checked. We should account for that.
…tion no-op Review feedback: single-selection EuiSelectable lists report selection via aria-selected, not aria-checked, and clicking a selected option deselects it, so the already-selected guard now checks both attributes. Adds a SingleSelection story (the Playground story's singleSelection radio control cannot be set through URL args) and a spec proving re-selecting keeps the option selected. Also clarifies the prefix-collision spec comment: that call throws because the anchored match finds zero options, not because the longer option is disabled.
|
Thanks for the valuable feedback @weronikaolejniczak - addressed! |
3 visual difference(s) found - expand to review, then click Approve visual changes to update baselineseuidatagrid (3 differences)
|
weronikaolejniczak
left a comment
There was a problem hiding this comment.
LGTM 🟢 Thank you for applying the changes, @steliosmavro! Awesome work as always 💪🏻
47 visual difference(s) found - expand to review, then click Approve visual changes to update baselineseuiicon (2 differences)
euicombobox (9 differences)
euiexpression (3 differences)
euiform (1 difference)
euiinlineedittext (2 differences)
euiflexgrid (1 difference)
euiflyout (14 differences)
euiheader (4 differences)
euicollapsiblenav (4 differences)
euicontextmenu (1 difference)
euikeypadmenu (1 difference)
euidatagrid (4 differences)
euitable (1 difference)
|
|
@steliosmavro I'm solving the weird VRT diff on #9916. No worries. Once merged, we'll have to rebase this PR and it should be 👌🏻 |
44 visual difference(s) found - expand to review, then click Approve visual changes to update baselineseuiicon (2 differences)
euicombobox (9 differences)
euiform (1 difference)
euiinlineedittext (2 differences)
euiflexgrid (1 difference)
euiflyout (14 differences)
euiheader (4 differences)
euicollapsiblenav (4 differences)
euicontextmenu (1 difference)
euikeypadmenu (1 difference)
euidatagrid (4 differences)
euitable (1 difference)
|
|
buildkite test this |
💚 Build Succeeded
History
|
💚 Build Succeeded
History
|
## Dependency updates `@elastic/eui` - 119.0.0 ⏩ 119.1.0 `@elastic/eui-test-helpers` - 1.3.0 ⏩ 1.4.0 ## Changes - Updated usages of `EuiFilePickerClass` to `EuiFilePickerRef` after the migration of `EuiFilePicker` from class to function component ## Package updates ### `@elastic/eui` [v119.1.0](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md) - Updated `EuiFlyoutMenu` action icon spacing: `leadingActions` and `trailingActions` icons are now grouped with a consistent gap between each icon ([#9887](elastic/eui#9887)) - Updated `EuiFlyoutMenu` back button to show a tooltip with the previous page title (e.g. "Back to Page 1") when history context is available ([#9887](elastic/eui#9887)) - Added `cursorDefault`, `logIn`, and `routeSplit` glyphs to `EuiIcon` ([#9885](elastic/eui#9885)) - Updated `EuiSplitButton` to apply redesign style changes ([#9865](elastic/eui#9865)) - Added a development warning to `useGeneratedHtmlId` and `htmlIdGenerator` when the passed `prefix`/`suffix` contains whitespace, which generates invalid HTML IDs ([#9868](elastic/eui#9868)) - Updated `EuiButtonGroup`: ([#9862](elastic/eui#9862)) - Added `variant="segmented"` which renders the group as visually connected control group - Added `showDividers` prop to optionally render dividers between group children - Added `layout` prop to optionally render icon button groups vertically - Added `wrap` prop to manually control the group wrapping behavior **Bug fixes** - Fixed `EuiDataGrid` header cell actions popover not opening when pressing Enter on a focused actions button ([#9931](elastic/eui#9931)) - Fixed `EuiFilePicker` losing imperative `ref` support when migrated from class to function component ([#9879](elastic/eui#9879)). Use `useRef<EuiFilePickerRef>()` where `useRef<EuiFilePickerClass>()` was previously used. ([#9930](elastic/eui#9930)) - Fixed `EuiSplitButton` having a wrong `inline-size` when `textProps={false}` is set on an action button that has `iconType` ([#9917](elastic/eui#9917)) ### `@elastic/eui-test-helpers` [v1.4.0](https://github.com/elastic/eui/blob/main/packages/test-helpers/changelogs/CHANGELOG_2026.md) - Added `EuiSelectableObject` with `options`, `selectOption(label)` and `search(term)` ([#9908](elastic/eui#9908)) --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Hannah Mudge <[email protected]>
…table prototype (#287680) ## Summary Consume the released [`@elastic/[email protected]`](https://www.npmjs.com/package/@elastic/eui-test-helpers) in Kibana and drop the in-repo prototype Component Object, now that the EUI port (elastic/eui#9908) is merged and published. ## Changes - Bump `@elastic/eui-test-helpers` `1.3.0` -> `1.4.0` (adds `EuiSelectableObject`) - `eui_components/index.ts` now re-exports it from the package instead of the local prototype file - Delete the prototype file (`selectable_object.ts`) ## Not in this PR `EuiBasicTableObject` and `EuiDraggableObject` also merged in EUI recently, but after the 1.4.0 release cut, so they are still local prototypes. They will be consumed the same way once the next official release includes them. ## Validation Type check green (kbn-scout), lint green. The object is byte-identical in behavior to the prototype already validated across every Scout lane in the original prototyping PR (#284674). This PR only changes where it is imported from.
## Dependency updates `@elastic/eui` - 119.0.0 ⏩ 119.1.0 `@elastic/eui-test-helpers` - 1.3.0 ⏩ 1.4.0 ## Changes - Updated usages of `EuiFilePickerClass` to `EuiFilePickerRef` after the migration of `EuiFilePicker` from class to function component ## Package updates ### `@elastic/eui` [v119.1.0](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md) - Updated `EuiFlyoutMenu` action icon spacing: `leadingActions` and `trailingActions` icons are now grouped with a consistent gap between each icon ([elastic#9887](elastic/eui#9887)) - Updated `EuiFlyoutMenu` back button to show a tooltip with the previous page title (e.g. "Back to Page 1") when history context is available ([elastic#9887](elastic/eui#9887)) - Added `cursorDefault`, `logIn`, and `routeSplit` glyphs to `EuiIcon` ([elastic#9885](elastic/eui#9885)) - Updated `EuiSplitButton` to apply redesign style changes ([elastic#9865](elastic/eui#9865)) - Added a development warning to `useGeneratedHtmlId` and `htmlIdGenerator` when the passed `prefix`/`suffix` contains whitespace, which generates invalid HTML IDs ([elastic#9868](elastic/eui#9868)) - Updated `EuiButtonGroup`: ([elastic#9862](elastic/eui#9862)) - Added `variant="segmented"` which renders the group as visually connected control group - Added `showDividers` prop to optionally render dividers between group children - Added `layout` prop to optionally render icon button groups vertically - Added `wrap` prop to manually control the group wrapping behavior **Bug fixes** - Fixed `EuiDataGrid` header cell actions popover not opening when pressing Enter on a focused actions button ([elastic#9931](elastic/eui#9931)) - Fixed `EuiFilePicker` losing imperative `ref` support when migrated from class to function component ([elastic#9879](elastic/eui#9879)). Use `useRef<EuiFilePickerRef>()` where `useRef<EuiFilePickerClass>()` was previously used. ([elastic#9930](elastic/eui#9930)) - Fixed `EuiSplitButton` having a wrong `inline-size` when `textProps={false}` is set on an action button that has `iconType` ([elastic#9917](elastic/eui#9917)) ### `@elastic/eui-test-helpers` [v1.4.0](https://github.com/elastic/eui/blob/main/packages/test-helpers/changelogs/CHANGELOG_2026.md) - Added `EuiSelectableObject` with `options`, `selectOption(label)` and `search(term)` ([elastic#9908](elastic/eui#9908)) --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Hannah Mudge <[email protected]>
…table prototype (elastic#287680) ## Summary Consume the released [`@elastic/[email protected]`](https://www.npmjs.com/package/@elastic/eui-test-helpers) in Kibana and drop the in-repo prototype Component Object, now that the EUI port (elastic/eui#9908) is merged and published. ## Changes - Bump `@elastic/eui-test-helpers` `1.3.0` -> `1.4.0` (adds `EuiSelectableObject`) - `eui_components/index.ts` now re-exports it from the package instead of the local prototype file - Delete the prototype file (`selectable_object.ts`) ## Not in this PR `EuiBasicTableObject` and `EuiDraggableObject` also merged in EUI recently, but after the 1.4.0 release cut, so they are still local prototypes. They will be consumed the same way once the next official release includes them. ## Validation Type check green (kbn-scout), lint green. The object is byte-identical in behavior to the prototype already validated across every Scout lane in the original prototyping PR (elastic#284674). This PR only changes where it is imported from.










































































































































Summary
Adds an
EuiSelectableObjectPlaywright Component Object to@elastic/eui-test-helpers, ported from Kibana's kbn-scout where it was prototyped against real consumer specs and validated end to end.apps-dx https://github.com/elastic/apps-dx/issues/74. Kibana helper and migrations: elastic/kibana#284674.
API
new EuiSelectableObject(scope, testSubj), guarded on.euiSelectable:options,checkedOptionslocatorsoption(label)locator, matched on the label in the accessible name (tolerates the screen-reader state text EUI appends andappendbadges, and will not match a different option whose label starts with the same text)search(term)check(label), an idempotent multi-select toggle that re-clicks untilaria-checkedsettlesoption(label)is for lists in their default state. Oncesearch()runs, EUI injects highlight markers into the accessible name, so a label match no longer resolves. That is documented on the method, and consumers select searched lists by the option's owndata-test-subj.Validation
tscclean. The 9 new Playwright validation specs (default state plus searchable) pass against Storybook locally. The same object passed a full Scout CI run in the Kibana umbrella elastic/kibana#284623.