Add EuiComboBoxObject Playwright helper to @elastic/eui-test-helpers#9644
Draft
steliosmavro wants to merge 3 commits intoelastic:mainfrom
Draft
Add EuiComboBoxObject Playwright helper to @elastic/eui-test-helpers#9644steliosmavro wants to merge 3 commits intoelastic:mainfrom
EuiComboBoxObject Playwright helper to @elastic/eui-test-helpers#9644steliosmavro wants to merge 3 commits intoelastic:mainfrom
Conversation
Implements milestone 2 of elastic#798. Adds BaseObject + EuiComboBoxObject with selectOption / clear / getSelectedOptions, validation tests against EUI Storybook (including a multi-combo isolation test using a new MultipleInstances story), Playwright config aligned with kbn-scout, and typescript lint via tsc --noEmit. Updates the existing selectors.ts to fix `data-test-subj` matching: EUI propagates the consumer's data-test-subj into the options list as a whitespace-joined token, so exact `=` was broken; switched OPTION/SELECTED_OPTION to factory functions using `~=`.
pheyos
reviewed
May 8, 2026
Per review feedback, switch the EuiComboBoxObject API from `selectOption(label)` (add-semantic) to `setSelectedOptions(labels)` (replace-semantic). The setter form is symmetric with `getSelectedOptions`, idempotent against the desired end-state, and removes the ambiguity flagged in review around what `selectOption` does when the label is already selected. Implementation: naive replace (clear + add each), with set-equality short circuit when current matches target. Per-label add logic extracted to a private addOption() for readability. Adds a test that explicitly verifies the replace semantic against an existing multi-selection.
steliosmavro
commented
May 8, 2026
Per review feedback, use sorted-array equality for both the early-return short-circuit and the post-action guard. Previously the short-circuit used length+every-includes (set-equality) while the guard used sort + toEqual; same concept, two idioms. The unified form also lets us reuse the sorted target array between the two checks.
Collaborator
💚 Build SucceededHistory
|
Collaborator
💚 Build Succeeded
History
|
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
First Playwright Component Object in
@elastic/eui-test-helpers:EuiComboBoxObject. Implements Milestone 2 of the eui-test-helpers epic.The plan is to wire one component (EuiComboBox) end-to-end first; subsequent helpers follow incrementally.
@elastic/eui-test-helperspackage #9616) — package scaffolding ✅ (@tkajtoch)What's in this PR
BaseObject— base class for Playwright Component Objects. Storesscope,root, andtestSubj.EuiComboBoxObject— three minimal methods:selectOption(label),clear(),getSelectedOptions(). All idempotent; descriptive errors viaexpect.poll.playwright.config.ts— defaults track kbn-scout's config (testIdAttribute: 'data-test-subj', conservative timeouts,retries: 0).MultipleInstancesstory added tocombo_box.stories.tsx).Selector fix in
selectors.tsThe existing
OPTION/SELECTED_OPTIONconstants used[data-test-subj="comboBoxOptionsList"](exact match). EUI propagates the consumer'sdata-test-subjto the options list as${testSubj}-optionsList, joined viaclassNames— so the actual attribute value is"comboBoxOptionsList foo-optionsList"(whitespace-separated). Exact=doesn't match;~=does.Switched both to factory functions
optionFor(testSubj, label?)/selectedOptionFor(testSubj, label?)using~=. Verified by temp-breaking the scoping, observing the multi-combo test fail, and reverting.Screenshots
N/AImpact Assessment
🔴 Breaking changes— Package isprivate: true, no external consumers.💅 Visual changes🧪 Test impact— Adds new tests; doesn't change existing behavior.🔧 Hard to integrateImpact level: 🟢 None
Release Readiness
packages/test-helpers/README.mdupdated with usage + contribution guide.Figma:Migration guide:QA instructions for reviewer
Expected: 5/5 tests pass in ~3–4s.
Checklist before marking Ready for Review
QA: light/dark modes, high contrast, mobile, browsers, keyboard, screen readerQA: Tested in CodeSandbox and Kibana— Kibana consumption is M4.QA: Tested docs changesChangelog— Package is private, not released.Breaking changes labelReviewer checklist