Skip to content

[test-helpers] Add EuiContextMenuObject - #10013

Merged
steliosmavro merged 3 commits into
elastic:mainfrom
steliosmavro:stelios/test-helpers-context-menu
Sep 10, 2026
Merged

steliosmavro merged 3 commits into
elastic:mainfrom
steliosmavro:stelios/test-helpers-context-menu

Conversation

@steliosmavro

@steliosmavro steliosmavro commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds EuiContextMenuObject, a Playwright Component Object for EuiContextMenu and for a standalone EuiContextMenuPanel, following the package's CONTRIBUTING guide.

No live Scout consumer exists yet, so this is Storybook-validated only, same as the other recent helpers.

Context

Both prior audits (Scout and FTR) found consumers already click items by their own stable test-subj, never by label, so there is no genuine label-lookup gap to fix. This is scoped as a minimal getter-only wrapper as part of moving toward broader EUI component coverage over time, per team direction, rather than a response to a specific audit finding.

API

  • items: a Locator for the items in the current panel.

The root can be either an EuiContextMenu or a standalone EuiContextMenuPanel. In Kibana the standalone panel inside a popover is the more common pattern (207 files vs 157 for the wrapper), so the object accepts both, validated against each component's own story.

A design choice worth flagging

EuiContextMenu can render two panels at once during a panel transition (an outgoing one still animating out, plus the incoming one), both matching .euiContextMenuPanel. items resolves to the last panel in the DOM rather than a plain descendant search off the root, since the outgoing panel always renders first. I could not actually reproduce a stale-item collision in testing (the transition resolves fast enough here that a naive descendant search also passed 20/20), so this is a defensive scoping choice, not a proven bug fix, flagging it as such rather than overstating it.

Deliberately excluded from v1

  • Clicking an item by label: no evidenced need, see Context above.

Testing

tsc --noEmit clean. 2 Playwright validation specs pass against Storybook (Navigation/EuiContextMenu/EuiContextMenu, Playground story, which has a real nested-panel item), 10/10 on a repeat-5 flake check. Also ran the full package suite (93 specs), all green.

Playwright Component Object for EuiContextMenu, following the package
CONTRIBUTING guide. No live Scout consumer exists yet, so this is
Storybook-validated only.

Minimal getter API, per direction to move toward broader EUI component
coverage. Real consumers already give items their own stable test-subj, so
items is for filtering by content where that is genuinely needed instead.

Scoped items to the last panel in the DOM rather than a plain descendant
search, since two panels can exist at once during a transition (outgoing
plus incoming, outgoing rendered first). Could not reproduce a real
collision in testing given how fast the transition resolves here, but the
scoping is free and correct either way, so kept it as a defensive choice
rather than a proven fix.
In Kibana a single EuiContextMenuPanel inside a popover (207 files) is more
common than the multi panel EuiContextMenu wrapper (157), and the object
only accepted the wrapper. The guard now accepts either root, and items
resolves to the root itself when it is a panel, or to the current panel
otherwise. Validated against the panel's own story.
@steliosmavro steliosmavro self-assigned this Sep 8, 2026
@steliosmavro
steliosmavro marked this pull request as ready for review September 8, 2026 13:53
@steliosmavro
steliosmavro requested a review from a team as a code owner September 8, 2026 13:53
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

cc @steliosmavro

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

cc @steliosmavro

@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! 🟢

@steliosmavro
steliosmavro merged commit fe2903d into elastic:main Sep 10, 2026
8 checks passed
eokoneyo added a commit to elastic/kibana that referenced this pull request Sep 17, 2026
## Dependency updates

`@elastic/eui` - v121.0.0 ⏩ v122.0.0
`@elastic/eui-illustrations` - v1.0.2 ⏩ v1.1.0
`@elastic/eui-test-helpers` - v1.6.0 ⏩ v1.7.0

## Changes

- Cherry-picked staged Kibana prep commits from `kibana-prep-commits`:
- #288940 (`1fdf41c`) — type `EuiSuperSelect` refs as
`EuiSuperSelectRef` following the breaking `ref` change in
elastic/eui#9972
- #290240 (`54cae3c`) — update tests, page objects, the
EUI i18n mapping, and translation files for the removed
`euiSelectableListItem.checkedOption` screen-reader text
(elastic/eui#9850)
- Synced EUI i18n tokens: added `euiKeyboardShortcuts.cmd`,
`euiKeyboardShortcuts.copyTitle`, and
`euiKeyboardShortcuts.copyDescription` to `i18n_eui_mapping.tsx` and
updated the `i18n_service` snapshot

## Package updates

### `@elastic/eui`
[v122.0.0](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md)

- Added Ctrl/Cmd+C support on `EuiDataGrid` to copy the focused cell
value when no text is selected
([#9995](elastic/eui#9995))

**Bug fixes**

- Fixed `EuiDataGrid` copy/paste shifting body rows one column right of
the headers when control columns were present
([#9954](elastic/eui#9954))

**Breaking changes**

- Changed the `ref` of `EuiSuperSelect` from the class instance to an
`EuiSuperSelectRef` object, which exposes `openPopover()` and
`closePopover()` ([#9972](elastic/eui#9972))

**Accessibility**

- Improved the accessibility of `EuiSelectable` by removing redundant
"Checked option." screen-reader text (checked state is already conveyed
via `aria-checked`/`aria-selected`)
([#9850](elastic/eui#9850))
- Improved the accessibility of `EuiSelectable` and `EuiComboBox` by
moving the `title` attribute to the inner text element, preventing
duplicate screen-reader announcements of option names
([#9850](elastic/eui#9850))
### `@elastic/eui-illustrations`
[v1.1.0](https://github.com/elastic/eui/blob/main/packages/illustrations/changelogs/CHANGELOG_2026.md)

- Added `attachments`, `detection`, `discovery`, `fieldExtraction`,
`generatePreview`, `knowledgeIndicator`, `noData`, `processorsError`,
`processorsLoading`, and `processorsPreview` illustrations
([#10001](elastic/eui#10001))
### `@elastic/eui-test-helpers`
[v1.7.0](https://github.com/elastic/eui/blob/main/packages/test-helpers/changelogs/CHANGELOG_2026.md)

- Added `EuiTreeViewObject`, a Playwright Component Object for
`EuiTreeView` ([#10025](elastic/eui#10025))
- Added `EuiToolTipObject`, a Playwright Component Object for
`EuiToolTip` ([#10026](elastic/eui#10026))
- Added `EuiContextMenuObject`, a Playwright Component Object for
`EuiContextMenu` ([#10013](elastic/eui#10013))
- Added `EuiColorPickerObject`, a Playwright Component Object for
`EuiColorPicker` ([#10020](elastic/eui#10020))

**Bug fixes**

- Fixed Component Objects not finding components whose `data-test-subj`
holds several space-separated tokens, such as `EuiColorPicker`. The root
now matches one token, following Kibana's `data-test-subj` convention
([#10015](elastic/eui#10015))

---------

Co-authored-by: Weronika Olejniczak <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Alexey Antonov <[email protected]>
Co-authored-by: Lene Gadewoll <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
ppisljar pushed a commit to ppisljar/kibana that referenced this pull request Sep 21, 2026
## Dependency updates

`@elastic/eui` - v121.0.0 ⏩ v122.0.0
`@elastic/eui-illustrations` - v1.0.2 ⏩ v1.1.0
`@elastic/eui-test-helpers` - v1.6.0 ⏩ v1.7.0

## Changes

- Cherry-picked staged Kibana prep commits from `kibana-prep-commits`:
- elastic#288940 (`1fdf41c`) — type `EuiSuperSelect` refs as
`EuiSuperSelectRef` following the breaking `ref` change in
elastic/eui#9972
- elastic#290240 (`54cae3c`) — update tests, page objects, the
EUI i18n mapping, and translation files for the removed
`euiSelectableListItem.checkedOption` screen-reader text
(elastic/eui#9850)
- Synced EUI i18n tokens: added `euiKeyboardShortcuts.cmd`,
`euiKeyboardShortcuts.copyTitle`, and
`euiKeyboardShortcuts.copyDescription` to `i18n_eui_mapping.tsx` and
updated the `i18n_service` snapshot

## Package updates

### `@elastic/eui`
[v122.0.0](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md)

- Added Ctrl/Cmd+C support on `EuiDataGrid` to copy the focused cell
value when no text is selected
([elastic#9995](elastic/eui#9995))

**Bug fixes**

- Fixed `EuiDataGrid` copy/paste shifting body rows one column right of
the headers when control columns were present
([elastic#9954](elastic/eui#9954))

**Breaking changes**

- Changed the `ref` of `EuiSuperSelect` from the class instance to an
`EuiSuperSelectRef` object, which exposes `openPopover()` and
`closePopover()` ([elastic#9972](elastic/eui#9972))

**Accessibility**

- Improved the accessibility of `EuiSelectable` by removing redundant
"Checked option." screen-reader text (checked state is already conveyed
via `aria-checked`/`aria-selected`)
([elastic#9850](elastic/eui#9850))
- Improved the accessibility of `EuiSelectable` and `EuiComboBox` by
moving the `title` attribute to the inner text element, preventing
duplicate screen-reader announcements of option names
([elastic#9850](elastic/eui#9850))
### `@elastic/eui-illustrations`
[v1.1.0](https://github.com/elastic/eui/blob/main/packages/illustrations/changelogs/CHANGELOG_2026.md)

- Added `attachments`, `detection`, `discovery`, `fieldExtraction`,
`generatePreview`, `knowledgeIndicator`, `noData`, `processorsError`,
`processorsLoading`, and `processorsPreview` illustrations
([elastic#10001](elastic/eui#10001))
### `@elastic/eui-test-helpers`
[v1.7.0](https://github.com/elastic/eui/blob/main/packages/test-helpers/changelogs/CHANGELOG_2026.md)

- Added `EuiTreeViewObject`, a Playwright Component Object for
`EuiTreeView` ([elastic#10025](elastic/eui#10025))
- Added `EuiToolTipObject`, a Playwright Component Object for
`EuiToolTip` ([elastic#10026](elastic/eui#10026))
- Added `EuiContextMenuObject`, a Playwright Component Object for
`EuiContextMenu` ([elastic#10013](elastic/eui#10013))
- Added `EuiColorPickerObject`, a Playwright Component Object for
`EuiColorPicker` ([elastic#10020](elastic/eui#10020))

**Bug fixes**

- Fixed Component Objects not finding components whose `data-test-subj`
holds several space-separated tokens, such as `EuiColorPicker`. The root
now matches one token, following Kibana's `data-test-subj` convention
([elastic#10015](elastic/eui#10015))

---------

Co-authored-by: Weronika Olejniczak <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Alexey Antonov <[email protected]>
Co-authored-by: Lene Gadewoll <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
weronikaolejniczak pushed a commit to boriskirov/eui that referenced this pull request Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants