Skip to content

[test-helpers] Add EuiSelectableObject - #9908

Merged
steliosmavro merged 10 commits into
elastic:mainfrom
steliosmavro:stelios/test-helpers-selectable
Aug 17, 2026
Merged

steliosmavro merged 10 commits into
elastic:mainfrom
steliosmavro:stelios/test-helpers-selectable

Conversation

@steliosmavro

Copy link
Copy Markdown
Contributor

Summary

Adds an EuiSelectableObject Playwright 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, checkedOptions locators
  • option(label) locator, matched on the label in the accessible name (tolerates the screen-reader state text EUI appends and append badges, 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 until aria-checked settles

option(label) is for lists in their default state. Once search() 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 own data-test-subj.

Validation

tsc clean. 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.

steliosmavro added a commit to steliosmavro/eui that referenced this pull request Aug 12, 2026
@steliosmavro
steliosmavro marked this pull request as ready for review August 12, 2026 15:14
@steliosmavro
steliosmavro requested a review from a team as a code owner August 12, 2026 15:14
@weronikaolejniczak
weronikaolejniczak self-requested a review August 12, 2026 15:15
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.
@steliosmavro
steliosmavro force-pushed the stelios/test-helpers-selectable branch from 326876c to f99c79f Compare August 12, 2026 15:53
steliosmavro and others added 3 commits August 13, 2026 10:52
…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.
@steliosmavro steliosmavro self-assigned this Aug 13, 2026

@weronikaolejniczak weronikaolejniczak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me but the PR description is incorrect:

  • there's no checkedOptions,
  • there's no aria-checked retry loop.

Also, single-select mode uses aria-selected, not aria-checked. We should account for that.

steliosmavro and others added 2 commits August 13, 2026 15:21
…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.
@steliosmavro

Copy link
Copy Markdown
Contributor Author

Thanks for the valuable feedback @weronikaolejniczak - addressed!

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
3 visual difference(s) found - expand to review, then click Approve visual changes to update baselines

euidatagrid (3 differences)

StoryBeforeAfterDiff
compact desktop
full screen toggle desktop
full screen toggle mobile

@weronikaolejniczak weronikaolejniczak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🟢 Thank you for applying the changes, @steliosmavro! Awesome work as always 💪🏻

@weronikaolejniczak weronikaolejniczak added the skip-changelog-eui Use on PRs to skip changelog requirement (for @elastic/eui) label Aug 14, 2026
@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
47 visual difference(s) found - expand to review, then click Approve visual changes to update baselines

euiicon (2 differences)

StoryBeforeAfterDiff
all icons desktop
all icons mobile

euicombobox (9 differences)

StoryBeforeAfterDiff
custom matcher desktop
custom truncation desktop
default truncation desktop
groups desktop
icons and many options selected desktop
nested options groups desktop
playground desktop
row height auto desktop
with tooltip desktop

euiexpression (3 differences)

StoryBeforeAfterDiff
high contrast mobile
kitchen sink mobile
playground mobile

euiform (1 difference)

StoryBeforeAfterDiff
playground mobile

euiinlineedittext (2 differences)

StoryBeforeAfterDiff
edit mode mobile
playground mobile

euiflexgrid (1 difference)

StoryBeforeAfterDiff
playground desktop

euiflyout (14 differences)

StoryBeforeAfterDiff
playground desktop
playground mobile
playground desktop
playground mobile
playground desktop
playground mobile
playground desktop
playground mobile
pagination example desktop
pagination example mobile
playground desktop
playground mobile
playground desktop
playground mobile

euiheader (4 differences)

StoryBeforeAfterDiff
elastic navigation pattern desktop
elastic navigation pattern mobile
multiple fixed headers mobile
popover example mobile

euicollapsiblenav (4 differences)

StoryBeforeAfterDiff
full header pattern desktop
full header pattern mobile
playground desktop
playground mobile

euicontextmenu (1 difference)

StoryBeforeAfterDiff
playground desktop

euikeypadmenu (1 difference)

StoryBeforeAfterDiff
playground mobile

euidatagrid (4 differences)

StoryBeforeAfterDiff
full screen with flyout mobile
column selector desktop
column selector mobile
toolbar visibility options desktop

euitable (1 difference)

StoryBeforeAfterDiff
playground mobile

@weronikaolejniczak

Copy link
Copy Markdown
Contributor

@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 👌🏻

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
44 visual difference(s) found - expand to review, then click Approve visual changes to update baselines

euiicon (2 differences)

StoryBeforeAfterDiff
all icons desktop
all icons mobile

euicombobox (9 differences)

StoryBeforeAfterDiff
custom matcher desktop
custom truncation desktop
default truncation desktop
groups desktop
icons and many options selected desktop
nested options groups desktop
playground desktop
row height auto desktop
with tooltip desktop

euiform (1 difference)

StoryBeforeAfterDiff
playground mobile

euiinlineedittext (2 differences)

StoryBeforeAfterDiff
edit mode mobile
playground mobile

euiflexgrid (1 difference)

StoryBeforeAfterDiff
playground desktop

euiflyout (14 differences)

StoryBeforeAfterDiff
playground desktop
playground mobile
playground desktop
playground mobile
playground desktop
playground mobile
playground desktop
playground mobile
pagination example desktop
pagination example mobile
playground desktop
playground mobile
playground desktop
playground mobile

euiheader (4 differences)

StoryBeforeAfterDiff
elastic navigation pattern desktop
elastic navigation pattern mobile
multiple fixed headers mobile
popover example mobile

euicollapsiblenav (4 differences)

StoryBeforeAfterDiff
full header pattern desktop
full header pattern mobile
playground desktop
playground mobile

euicontextmenu (1 difference)

StoryBeforeAfterDiff
playground desktop

euikeypadmenu (1 difference)

StoryBeforeAfterDiff
playground mobile

euidatagrid (4 differences)

StoryBeforeAfterDiff
full screen with flyout mobile
column selector desktop
column selector mobile
toolbar visibility options desktop

euitable (1 difference)

StoryBeforeAfterDiff
playground mobile

@steliosmavro
steliosmavro enabled auto-merge (squash) August 17, 2026 06:30
@mgadewoll mgadewoll added the skip-vrt Skips Visual Regression Testing job in CI (clearly state why you're using it in your PR) label Aug 17, 2026
@mgadewoll

Copy link
Copy Markdown
Contributor

buildkite test this

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

cc @steliosmavro

@infra-vault-gh-plugin-prod

infra-vault-gh-plugin-prod Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

💚 Build Succeeded

History

cc @steliosmavro

@steliosmavro
steliosmavro merged commit 4846733 into elastic:main Aug 17, 2026
4 checks passed
mgadewoll added a commit to elastic/kibana that referenced this pull request Aug 28, 2026
## 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]>
steliosmavro added a commit to elastic/kibana that referenced this pull request Aug 28, 2026
…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.
dej611 pushed a commit to dej611/kibana that referenced this pull request Aug 31, 2026
## 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]>
dej611 pushed a commit to dej611/kibana that referenced this pull request Aug 31, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog-eui Use on PRs to skip changelog requirement (for @elastic/eui) skip-vrt Skips Visual Regression Testing job in CI (clearly state why you're using it in your PR)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants