Skip to content

[test-helpers] Add EuiFilterButtonObject - #9942

Open
steliosmavro wants to merge 2 commits into
elastic:mainfrom
steliosmavro:stelios/test-helpers-filter-group
Open

[test-helpers] Add EuiFilterButtonObject#9942
steliosmavro wants to merge 2 commits into
elastic:mainfrom
steliosmavro:stelios/test-helpers-filter-group

Conversation

@steliosmavro

Copy link
Copy Markdown
Contributor

Summary

Adds EuiFilterButtonObject, a Playwright Component Object for EuiFilterButton, following the package's CONTRIBUTING guide.

No live Scout consumer exists yet, so this skips the usual kbn-scout prototype/validation step from the guide's lifecycle. It found evidence in Kibana's FTR suite instead: three independently-authored FTR page objects (ML notifications, Lens tagging, Uptime filters) each reimplement the same filter-dropdown open/select/apply flow with incompatible, brittle selector strategies, forced by a real gap: EuiFilterButton/EuiFilterSelectItem expose no stable per-option hook. Validated against Storybook only for this v1; a real Scout consumer migrating onto it is the next real validation pass.

API

Deliberately minimal — reading the actual EuiFilterButton/EuiPopover source changed the original scope:

  • notificationBadge: a Locator for the filter-count badge (present only when numFilters/numActiveFilters is set).
  • Active/selected state (euiFilterButton-hasActiveFilters, euiFilterButton-isSelected) is asserted directly on the inherited root Locator rather than through a dedicated method — both are synchronous CSS classes EUI already sets, no helper needed to read them.

Deliberately excluded from v1

  • Popover open/close mechanics: EuiPopover already sets aria-expanded/aria-controls on its toggle synchronously itself. Building that in here would duplicate scope already covered generically by EUI, and EuiPopover itself was separately evaluated and parked as too thin to warrant its own helper.
  • Option selection inside the popover: when the popover content is an EuiSelectable (the modern pattern — EuiFilterSelectItem is deprecated in favor of it), compose with the existing EuiSelectableObject instead of reimplementing option matching here.

Testing

tsc --noEmit clean. 3 Playwright validation specs pass against Storybook (Forms/EuiFilterButton → Playground), covering the active-filters class, the notification badge count, and the isSelected variant.

Playwright Component Object for EuiFilterButton, following the package CONTRIBUTING guide.

Scoped to what is genuinely EUI-owned: the active/selected state classes
(hasActiveFilters, isSelected) via the inherited root locator, and the
notification badge as a dedicated Locator. Deliberately excludes popover
open/close mechanics (EuiPopover already exposes aria-expanded/aria-controls
synchronously) and option selection inside the popover (compose with the
existing EuiSelectableObject for that instead).
@steliosmavro steliosmavro self-assigned this Aug 21, 2026
@steliosmavro
steliosmavro marked this pull request as ready for review August 21, 2026 14:09
@steliosmavro
steliosmavro requested a review from a team as a code owner August 21, 2026 14:09
@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

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.

1 participant