Skip to main content

Class: TypeaheadDriver

Defined in: component-driver-astryx/src/components/TypeaheadDriver.ts:19

Driver for the Astryx Typeahead (@astryxdesign/core/Typeahead) — a search-as-you-type single-select combobox.

The scene anchors this driver on the root <div> (which self-emits data-testid); the role="combobox" is on the <input>, linked by aria-controls to the results role="listbox" (aria-label="Search results") whose options carry ${listboxId}-option-${i} ids. Results are produced by the (debounced, possibly async) searchSource, so reads wait for them via AstryxComboboxDriver.waitForOptions; the result panel renders in jsdom once React resolves the search, so query/results/selection are testable there as well as in the browser.

Extends​

Constructors​

Constructor​

new TypeaheadDriver(locator, interactor, option?): TypeaheadDriver

Defined in: core/dist/index.d.mts:1200

Parameters​

locator​

PartLocator

Locator for the root of this component.

interactor​

Interactor

Environment adapter used for all interactions.

option?​

Partial<IComponentDriverOption<{ }>>

Driver option carrying the shared driver-tree context.

Composite-driver authoring rule: a driver that declares non-empty parts must type this parameter as Partial<IComponentDriverOption> (i.e. the empty <{}> default) and hardcode its own parts in the body — super(locator, interactor, { ...option, parts }). The "natural" Partial<IComponentDriverOption<typeof parts>> signature does NOT satisfy ScenePartDefinition['driver'] (constructor parameters are checked contravariantly), so a driver written that way could not be placed in a parent ScenePart. Lock a composite driver against this rule in one line with AssertScenePlaceableDriver; the rule itself is regression-tested centrally in core/src/drivers/__type-tests__ and demonstrated in @atomic-testing/component-driver-html.

Returns​

TypeaheadDriver

Inherited from​

AstryxComboboxDriver.constructor

Accessors​

driverName​

Get Signature​

get driverName(): string

Defined in: component-driver-astryx/src/components/TypeaheadDriver.ts:91

Returns​

string

Overrides​

AstryxComboboxDriver.driverName

Methods​

clear()​

clear(): Promise<boolean>

Defined in: component-driver-astryx/src/components/TypeaheadDriver.ts:83

Clear the current selection/query via the clear control.

Returns​

Promise<boolean>

false when there is no clear control.


getDisabledMessage()​

getDisabledMessage(): Promise<Optional<string>>

Defined in: component-driver-astryx/src/components/TypeaheadDriver.ts:56

The disabledMessage tooltip text, resolved via the search input's (the role="combobox" control) aria-describedby link. undefined when the typeahead isn't in that disabled-with-message state.

Returns​

Promise<Optional<string>>


getQuery()​

getQuery(): Promise<string>

Defined in: component-driver-astryx/src/components/TypeaheadDriver.ts:23

The current query text in the input.

Returns​

Promise<string>


getResultLabels()​

getResultLabels(): Promise<readonly string[]>

Defined in: component-driver-astryx/src/components/TypeaheadDriver.ts:46

The result option labels for the current query, waiting for the (debounced) results to arrive.

Returns​

Promise<readonly string[]>


isLoading()​

isLoading(): Promise<boolean>

Defined in: component-driver-astryx/src/components/TypeaheadDriver.ts:39

Whether a search is in flight. The busy spinner is the only [role="status"][aria-label="Loading"] element; a bare role="status" match would also catch the clear button's always-present status span (every Astryx Button emits one without an aria-label), giving a false positive whenever a value is selected.

Returns​

Promise<boolean>


selectByLabel()​

selectByLabel(label): Promise<boolean>

Defined in: component-driver-astryx/src/components/TypeaheadDriver.ts:64

Select the result with the given label, waiting for results first.

Parameters​

label​

string

Returns​

Promise<boolean>

false when no such result exists.


type()​

type(text): Promise<void>

Defined in: component-driver-astryx/src/components/TypeaheadDriver.ts:28

Type a query into the input (replacing any existing text), triggering a search.

Parameters​

text​

string

Returns​

Promise<void>

Inherited members (23)

Properties​

commutableOption​

readonly commutableOption: CommutableComponentDriverOption

Defined in: core/dist/index.d.mts:1182

The component-agnostic slice of the constructor option that is safe to share across the whole driver tree — everything the constructor received EXCEPT the component-specific parts, which each driver owns for itself. Parent drivers pass this straight to the constructors of children they create dynamically (see the list helpers). See CommutableComponentDriverOption.

Inherited from​

AstryxComboboxDriver.commutableOption


interactor​

readonly interactor: Interactor

Defined in: core/dist/index.d.mts:1172

Inherited from​

AstryxComboboxDriver.interactor

Accessors​

locator​

Get Signature​

get locator(): PartLocator

Defined in: core/dist/index.d.mts:1229

Return the locator of the component

Returns​

PartLocator

Inherited from​

AstryxComboboxDriver.locator


parts​

Get Signature​

get parts(): ScenePartDriver<T>

Defined in: core/dist/index.d.mts:1225

Return driver instance of all the named parts

Returns​

ScenePartDriver<T>

Inherited from​

AstryxComboboxDriver.parts

Methods​

click()​

click(option?): Promise<void>

Defined in: core/dist/index.d.mts:1253

Parameters​
option?​

Partial<ClickOption>

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.click


close()​

close(): Promise<void>

Defined in: component-driver-astryx/src/components/AstryxComboboxDriver.ts:42

Close the popup, if open, by pressing Escape on the combobox. (Re-clicking the trigger is unreliable once the popup's top layer overlaps it — Firefox cannot land the click — whereas Astryx closes the listbox on Escape.)

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.close


exists()​

exists(): Promise<boolean>

Defined in: core/dist/index.d.mts:1252

Whether the component exists/attached to the DOM

Returns​

Promise<boolean>

true if the component is attached to the DOM, false otherwise

Inherited from​

AstryxComboboxDriver.exists


focus()​

focus(option?): Promise<void>

Defined in: core/dist/index.d.mts:1262

Parameters​
option?​

Partial<FocusOption>

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.focus


getAttribute()​

getAttribute(attributeName): Promise<Optional<string>>

Defined in: core/dist/index.d.mts:1247

Parameters​
attributeName​

string

Returns​

Promise<Optional<string>>

Inherited from​

AstryxComboboxDriver.getAttribute


getText()​

getText(): Promise<Optional<string>>

Defined in: core/dist/index.d.mts:1246

Get the combined text content of the component

Returns​

Promise<Optional<string>>

If the component exists and has content, it should return the text or otherwise undefined

Inherited from​

AstryxComboboxDriver.getText


hover()​

hover(option?): Promise<void>

Defined in: core/dist/index.d.mts:1254

Parameters​
option?​

Partial<HoverOption>

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.hover


isExpanded()​

isExpanded(): Promise<boolean>

Defined in: component-driver-astryx/src/components/AstryxComboboxDriver.ts:20

Whether the popup is open — read from the combobox's aria-expanded.

Returns​

Promise<boolean>

Inherited from​

AstryxComboboxDriver.isExpanded


isVisible()​

isVisible(): Promise<boolean>

Defined in: core/dist/index.d.mts:1336

Whether the component is visible. Visibility is defined that the component does not have the CSS property display: none, visibility: hidden, or opacity: 0. However this does not check whether the component is within the viewport.

Returns​

Promise<boolean>

true if the component is visible, false otherwise

Inherited from​

AstryxComboboxDriver.isVisible


open()​

open(): Promise<void>

Defined in: component-driver-astryx/src/components/AstryxComboboxDriver.ts:30

Open the popup by clicking the combobox, if not already open, then wait for aria-expanded to flip. The wait matters in the browser: click() resolves once the event dispatches, but the listbox and its options mount on React's subsequent render, so a read that races ahead would see an empty popup.

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.open


pressKey()​

pressKey(key, option?): Promise<void>

Defined in: core/dist/index.d.mts:1268

Dispatch a keyboard key press on the component. See Interactor.pressKey.

Parameters​
key​

string

A KeyboardEvent.key value, e.g. 'Escape', 'Backspace', 'Enter'

option?​

Partial<PressKeyOption>

Reserved for future modifier-key support

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.pressKey


runtimeCssSelector()​

runtimeCssSelector(): Promise<string>

Defined in: core/dist/index.d.mts:1367

Get the runtime CSS selector of the component. This is useful for debugging and testing purposes.

Returns​

Promise<string>

The runtime CSS selector of the component

Inherited from​

AstryxComboboxDriver.runtimeCssSelector


scrollIntoView()​

scrollIntoView(): Promise<void>

Defined in: core/dist/index.d.mts:1289

Scroll the component into the viewport. See Interactor.scrollIntoView.

jsdom has no layout engine, so the scroll is a no-op there and behavioral assertions (visibility, offset) are E2E-only.

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.scrollIntoView


typeText()​

typeText(text): Promise<void>

Defined in: core/dist/index.d.mts:1274

Type text into the component as real per-character keystrokes, inserting at the current caret without clearing. See Interactor.typeText.

Parameters​
text​

string

The literal text to type, one keystroke per character

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.typeText


waitUntil()​

waitUntil<T>(option): Promise<T>

Defined in: core/dist/index.d.mts:1356

Type Parameters​
T​

T

Parameters​
option​

WaitUntilOption<T>

Returns​

Promise<T>

Inherited from​

AstryxComboboxDriver.waitUntil


waitUntilComponentState()​

waitUntilComponentState(option?): Promise<void>

Defined in: core/dist/index.d.mts:1355

Wait until the component is in the expected state such as the component's visibility or existence. If the component has not reached the expected state within the timeout, it will throw an error.

By default it waits until the component is attached to the DOM within 30 seconds.

Parameters​
option?​

Partial<Readonly<WaitForOption>>

The option to configure the wait behavior

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.waitUntilComponentState


waitUntilVisible()​

waitUntilVisible(timeoutMs?): Promise<void>

Defined in: core/dist/index.d.mts:1343

Wait until the component is attached and becomes visible to the DOM.

Parameters​
timeoutMs?​

number

The number of milliseconds to wait before timing out. Defaults to defaultWaitForOption.timeoutMs so this wait shares a single flake-tolerance source with waitUntilComponentState (#1057).

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.waitUntilVisible


overriddenParentLocator()​

static overriddenParentLocator(): Optional<PartLocator>

Defined in: core/dist/index.d.mts:1211

Portal hook: where to re-root this driver's locator when its component renders outside the parent's DOM (a modal, popup, drawer). Return the PartLocator that locates the component from the document root, or undefined (the default) for normal in-tree components whose locator chains from the parent.

This is static because it is per-class metadata read off the constructor before any instance exists — which makes the "no instance state" constraint structural rather than a documented caution. Override with static override.

Returns​

Optional<PartLocator>

Inherited from​

AstryxComboboxDriver.overriddenParentLocator


overrideLocatorRelativePosition()​

static overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>

Defined in: core/dist/index.d.mts:1221

Portal hook: the locator relative position to apply when the component's real DOM is a sibling/elsewhere rather than a descendant (e.g. a MUI dialog rendered at the document root, located by a "Same"-level selector). Return undefined (the default) to keep the natural position declared by the ScenePart.

Static for the same reason as ComponentDriver.overriddenParentLocator: it is class-level metadata read before construction. Override with static override.

Returns​

Optional<LocatorRelativePosition>

Inherited from​

AstryxComboboxDriver.overrideLocatorRelativePosition

Protected members (24)

Properties​

optionIdSeparator​

protected readonly optionIdSeparator: "option" = 'option'

Defined in: component-driver-astryx/src/components/TypeaheadDriver.ts:20

The id-segment between the listbox id and the option index ('item' or 'option').

Overrides​

AstryxComboboxDriver.optionIdSeparator

Accessors​

combobox​

Get Signature​

get protected combobox(): PartLocator

Defined in: component-driver-astryx/src/internal/IndexedOptionListDriver.ts:26

The role="combobox" control — a <button> for the selectors, an <input> for the typeaheads/palette.

Returns​

PartLocator

Inherited from​

AstryxComboboxDriver.combobox

Methods​

activate()​

protected activate(): Promise<void>

Defined in: core/dist/index.d.mts:1282

Activate the component without relying on pointer geometry. See Interactor.activate.

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.activate


contextMenu()​

protected contextMenu(): Promise<void>

Defined in: core/dist/index.d.mts:1278

Dispatch a right-click / contextmenu event on the component. See Interactor.contextMenu.

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.contextMenu


drag()​

protected drag(delta): Promise<void>

Defined in: core/dist/index.d.mts:1320

Drag this component by the given pixel delta from its center. See Interactor.drag.

Prefer a keyboard-driven setValue over a true drag in real drivers — these drag primitives exist only for cases keyboard cannot express (e.g. panning a Lightbox, reordering a column). jsdom has no layout engine, so the positional outcome of the drag is E2E-only there.

Parameters​
delta​

Point

Pixel offset to drag by

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.drag


dragTo()​

protected dragTo(target): Promise<void>

Defined in: core/dist/index.d.mts:1309

Drag this component and drop it onto another component. See Interactor.dragTo.

Prefer a keyboard-driven setValue over a true drag in real drivers — these drag primitives exist only for cases keyboard cannot express (e.g. panning a Lightbox, reordering a column). jsdom has no layout engine, so the positional outcome of the drag is E2E-only there.

Parameters​
target​

ComponentDriver<any>

Another driver whose root element is the drop target

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.dragTo


enforcePartExistence()​

protected enforcePartExistence(partName): Promise<void>

Defined in: core/dist/index.d.mts:1235

Check the specified parts' existences, and throw MissingPartError if any of the part is found not existence. Existence is defined by the part's existence in the DOM regardless of its visibility on the screen

Parameters​
partName​

readonly never[]

Single or array of the names of the parts to be enforced

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.enforcePartExistence


findOptionByLabel()​

protected findOptionByLabel(label): Promise<PartLocator | null>

Defined in: component-driver-astryx/src/internal/IndexedOptionListDriver.ts:50

The option locator whose visible text matches label, or null when absent.

Parameters​
label​

string

Returns​

Promise<PartLocator | null>

Inherited from​

AstryxComboboxDriver.findOptionByLabel


getBoundingRect()​

protected getBoundingRect(): Promise<BoundingRect>

Defined in: core/dist/index.d.mts:1327

Get this component's bounding rectangle. See Interactor.getBoundingRect.

jsdom has no layout engine, so every coordinate and dimension is 0 there; real geometry is E2E-only.

Returns​

Promise<BoundingRect>

Inherited from​

AstryxComboboxDriver.getBoundingRect


getMissingPartNames()​

protected getMissingPartNames(partName): Promise<readonly never[]>

Defined in: core/dist/index.d.mts:1241

Get the names of parts not in the DOM

Parameters​
partName​

readonly never[]

Single or array of the names of the parts to be examined

Returns​

Promise<readonly never[]>

Inherited from​

AstryxComboboxDriver.getMissingPartNames


innerHTML()​

protected innerHTML(): Promise<string>

Defined in: core/dist/index.d.mts:1361

Get the inner HTML of the component

Returns​

Promise<string>

The inner HTML of the component

Inherited from​

AstryxComboboxDriver.innerHTML


isOptionLabelSelected()​

protected isOptionLabelSelected(label): Promise<boolean>

Defined in: component-driver-astryx/src/internal/IndexedOptionListDriver.ts:72

Whether the option with the given label is selected (aria-selected="true"). false when absent.

Parameters​
label​

string

Returns​

Promise<boolean>

Inherited from​

AstryxComboboxDriver.isOptionLabelSelected


mouseDown()​

protected mouseDown(option?): Promise<void>

Defined in: core/dist/index.d.mts:1256

Parameters​
option?​

Partial<MouseDownOption>

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.mouseDown


mouseEnter()​

protected mouseEnter(option?): Promise<void>

Defined in: core/dist/index.d.mts:1260

Parameters​
option?​

Partial<MouseEnterOption>

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.mouseEnter


mouseLeave()​

protected mouseLeave(option?): Promise<void>

Defined in: core/dist/index.d.mts:1261

Parameters​
option?​

Partial<MouseLeaveOption>

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.mouseLeave


mouseMove()​

protected mouseMove(option?): Promise<void>

Defined in: core/dist/index.d.mts:1255

Parameters​
option?​

Partial<MouseMoveOption>

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.mouseMove


mouseOut()​

protected mouseOut(option?): Promise<void>

Defined in: core/dist/index.d.mts:1259

Parameters​
option?​

Partial<MouseOutOption>

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.mouseOut


mouseOver()​

protected mouseOver(option?): Promise<void>

Defined in: core/dist/index.d.mts:1258

Parameters​
option?​

Partial<HoverOption>

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.mouseOver


mouseUp()​

protected mouseUp(option?): Promise<void>

Defined in: core/dist/index.d.mts:1257

Parameters​
option?​

Partial<MouseUpOption>

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.mouseUp


optionIdPrefix()​

protected optionIdPrefix(): Promise<Optional<string>>

Defined in: component-driver-astryx/src/internal/IndexedOptionListDriver.ts:31

The ${listboxId}-${separator}- id prefix shared by the open popup's options, or undefined when closed.

Returns​

Promise<Optional<string>>

Inherited from​

AstryxComboboxDriver.optionIdPrefix


optionLabels()​

protected optionLabels(): Promise<readonly string[]>

Defined in: component-driver-astryx/src/internal/IndexedOptionListDriver.ts:60

The visible labels of the options currently in the open popup, in DOM order.

Returns​

Promise<readonly string[]>

Inherited from​

AstryxComboboxDriver.optionLabels


optionLocators()​

protected optionLocators(): Promise<PartLocator[]>

Defined in: component-driver-astryx/src/internal/IndexedOptionListDriver.ts:37

Every option locator in the open popup, in DOM order. Empty when closed.

Returns​

Promise<PartLocator[]>

Inherited from​

AstryxComboboxDriver.optionLocators


scrollBy()​

protected scrollBy(delta): Promise<void>

Defined in: core/dist/index.d.mts:1298

Scroll the component by the given pixel delta. See Interactor.scrollBy.

jsdom has no layout engine, so the scroll is a no-op there and behavioral assertions (resulting offset) are E2E-only.

Parameters​
delta​

Point

Pixel offset to scroll by

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.scrollBy


waitForOptions()​

protected waitForOptions(timeoutMs?): Promise<void>

Defined in: component-driver-astryx/src/internal/IndexedOptionListDriver.ts:83

Wait until the open popup has at least one option, for the debounced/async result lists of the type-to-search members (Typeahead, Tokenizer, PowerSearch, CommandPalette). Resolves early once options appear; otherwise returns after the timeout (e.g. a query with no results), leaving the caller to read an empty list.

Parameters​
timeoutMs?​

number = 2000

Returns​

Promise<void>

Inherited from​

AstryxComboboxDriver.waitForOptions