[test-helpers] Add EuiFilterButtonObject - #9942
Open
steliosmavro wants to merge 2 commits into
Open
Conversation
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).
💚 Build Succeeded
|
💚 Build Succeeded
|
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.
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: aLocatorfor the filter-count badge (present only whennumFilters/numActiveFiltersis set).euiFilterButton-hasActiveFilters,euiFilterButton-isSelected) is asserted directly on the inherited rootLocatorrather than through a dedicated method — both are synchronous CSS classes EUI already sets, no helper needed to read them.Deliberately excluded from v1
EuiPopoveralready setsaria-expanded/aria-controlson its toggle synchronously itself. Building that in here would duplicate scope already covered generically by EUI, andEuiPopoveritself was separately evaluated and parked as too thin to warrant its own helper.EuiSelectable(the modern pattern —EuiFilterSelectItemis deprecated in favor of it), compose with the existingEuiSelectableObjectinstead of reimplementing option matching here.Testing
tsc --noEmitclean. 3 Playwright validation specs pass against Storybook (Forms/EuiFilterButton→ Playground), covering the active-filters class, the notification badge count, and the isSelected variant.