Skip to main content

Class: PowerSearchDriver

Defined in: component-driver-astryx/src/components/PowerSearchDriver.ts:29

Driver for the Astryx PowerSearch (@astryxdesign/core/PowerSearch) — the wave's hardest component (best-effort v1).

PowerSearch reuses the Tokenizer shell: a role="group" root (self-emitting data-testid) holding filter chips (span.astryx-token), a role="combobox" query <input> whose results list field/operator suggestions (${listboxId}-option-${i} ids, shared with Typeahead — hence the IndexedOptionListDriver base), and a trailing "N results" count. Each chip exposes a field/operator edit <button>, the value text, and a Remove <field: operator> button — so chips are addressed by their field/operator label.

Scoped v1 / blocking dependency: the per-operator edit popover opened by editFilter has no stable role/testid/open-state anchor in @astryxdesign/core@0.1.1, so reading or completing an in-popover edit is left to E2E/follow-up and is not modelled here; this driver covers chip enumeration, removal, clear, the query/field-suggestion search, and the result count. Building a brand-new filter is multi-step (field → operator → value) and likewise best-effort. See #913 / the umbrella's PowerSearch row.

Extends​

  • IndexedOptionListDriver

Constructors​

Constructor​

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

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

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. See the type-level fixture in @atomic-testing/component-driver-html.

Returns​

PowerSearchDriver

Inherited from​

IndexedOptionListDriver.constructor

Properties​

commutableOption​

readonly commutableOption: IComponentDriverOption<{ }>

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

Option passed to the constructor includes both universal options which can be shared across all component driver tree, and component specific options which are only applicable to the component.

Commutable option is the option that can be shared across all component driver tree.

Inherited from​

IndexedOptionListDriver.commutableOption


interactor​

readonly interactor: Interactor

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

Inherited from​

IndexedOptionListDriver.interactor


optionIdSeparator​

protected readonly optionIdSeparator: "option" = 'option'

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

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

Overrides​

IndexedOptionListDriver.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​

IndexedOptionListDriver.combobox


driverName​

Get Signature​

get driverName(): string

Defined in: component-driver-astryx/src/components/PowerSearchDriver.ts:146

Returns​

string

Overrides​

IndexedOptionListDriver.driverName


locator​

Get Signature​

get locator(): PartLocator

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

Return the locator of the component

Returns​

PartLocator

Inherited from​

IndexedOptionListDriver.locator


parts​

Get Signature​

get parts(): ScenePartDriver<T>

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

Return driver instance of all the named parts

Returns​

ScenePartDriver<T>

Inherited from​

IndexedOptionListDriver.parts

Methods​

activate()​

activate(): Promise<void>

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

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

Returns​

Promise<void>

Inherited from​

IndexedOptionListDriver.activate


clearAll()​

clearAll(): Promise<boolean>

Defined in: component-driver-astryx/src/components/PowerSearchDriver.ts:110

Remove every filter chip. Chips are removed individually (each via its own "Remove" button) rather than through the shared "Clear all" control, which under controlled filters state only drops one chip per click.

Returns​

Promise<boolean>

false when there were no chips to clear.


click()​

click(option?): Promise<void>

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

Parameters​

option?​

Partial<ClickOption>

Returns​

Promise<void>

Inherited from​

IndexedOptionListDriver.click


contextMenu()​

contextMenu(): Promise<void>

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

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

Returns​

Promise<void>

Inherited from​

IndexedOptionListDriver.contextMenu


drag()​

drag(delta): Promise<void>

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

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​

IndexedOptionListDriver.drag


dragTo()​

dragTo(target): Promise<void>

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

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​

IndexedOptionListDriver.dragTo


editFilter()​

editFilter(label): Promise<boolean>

Defined in: component-driver-astryx/src/components/PowerSearchDriver.ts:71

Open the edit popover for the chip with the given field/operator label by clicking its edit button. Reading/completing the popover edit is E2E/follow-up (the popover has no stable anchor in v1 — see the class doc).

Parameters​

label​

string

Returns​

Promise<boolean>

false when no such chip exists.


enforcePartExistence()​

protected enforcePartExistence(partName): Promise<void>

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

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​

IndexedOptionListDriver.enforcePartExistence


exists()​

exists(): Promise<boolean>

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

Whether the component exists/attached to the DOM

Returns​

Promise<boolean>

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

Inherited from​

IndexedOptionListDriver.exists


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​

IndexedOptionListDriver.findOptionByLabel


focus()​

focus(option?): Promise<void>

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

Parameters​

option?​

Partial<FocusOption>

Returns​

Promise<void>

Inherited from​

IndexedOptionListDriver.focus


getAttribute()​

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

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

Parameters​

attributeName​

string

Returns​

Promise<Optional<string>>

Inherited from​

IndexedOptionListDriver.getAttribute


getBoundingRect()​

getBoundingRect(): Promise<BoundingRect>

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

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​

IndexedOptionListDriver.getBoundingRect


getFieldSuggestionLabels()​

getFieldSuggestionLabels(): Promise<readonly string[]>

Defined in: component-driver-astryx/src/components/PowerSearchDriver.ts:60

The field/operator suggestion labels for the current query, waiting for the (debounced) results.

Returns​

Promise<readonly string[]>


getFilterCount()​

getFilterCount(): Promise<number>

Defined in: component-driver-astryx/src/components/PowerSearchDriver.ts:45

Number of filter chips.

Returns​

Promise<number>


getFilterLabels()​

getFilterLabels(): Promise<readonly string[]>

Defined in: component-driver-astryx/src/components/PowerSearchDriver.ts:38

Each chip's field/operator label, read from its Remove <field: operator> button. Astryx wraps each chip in its own <span>, so the remove buttons — read in one multi-attribute pass — are the portable enumeration anchor (every chip has exactly one, present whether or not the chip is wrapped).

Returns​

Promise<readonly string[]>


getMissingPartNames()​

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

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

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​

IndexedOptionListDriver.getMissingPartNames


getQuery()​

getQuery(): Promise<string>

Defined in: component-driver-astryx/src/components/PowerSearchDriver.ts:50

The current query text in the input.

Returns​

Promise<string>


getResultCount()​

getResultCount(): Promise<Optional<number>>

Defined in: component-driver-astryx/src/components/PowerSearchDriver.ts:140

The numeric result count parsed from getResultText, or undefined when not a number.

Returns​

Promise<Optional<number>>


getResultText()​

getResultText(): Promise<Optional<string>>

Defined in: component-driver-astryx/src/components/PowerSearchDriver.ts:130

The trailing result-count text, e.g. "42 results", or undefined when absent.

Astryx 0.1.1 renders the count as the combobox's endContent with no role/testid/data hook (only StyleX-hashed classes, which this package does not couple to), so it is read from the root's trailing region positionally. The read is guarded on a digit so a markup shift that moves a non-count element into that slot yields undefined rather than unrelated text.

Returns​

Promise<Optional<string>>


getText()​

getText(): Promise<Optional<string>>

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

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​

IndexedOptionListDriver.getText


hover()​

hover(option?): Promise<void>

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

Parameters​

option?​

Partial<HoverOption>

Returns​

Promise<void>

Inherited from​

IndexedOptionListDriver.hover


innerHTML()​

innerHTML(): Promise<string>

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

Get the inner HTML of the component

Returns​

Promise<string>

The inner HTML of the component

Inherited from​

IndexedOptionListDriver.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​

IndexedOptionListDriver.isOptionLabelSelected


isVisible()​

isVisible(): Promise<boolean>

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

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​

IndexedOptionListDriver.isVisible


mouseDown()​

mouseDown(option?): Promise<void>

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

Parameters​

option?​

Partial<MouseDownOption>

Returns​

Promise<void>

Inherited from​

IndexedOptionListDriver.mouseDown


mouseEnter()​

mouseEnter(option?): Promise<void>

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

Parameters​

option?​

Partial<MouseEnterOption>

Returns​

Promise<void>

Inherited from​

IndexedOptionListDriver.mouseEnter


mouseLeave()​

mouseLeave(option?): Promise<void>

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

Parameters​

option?​

Partial<MouseLeaveOption>

Returns​

Promise<void>

Inherited from​

IndexedOptionListDriver.mouseLeave


mouseMove()​

mouseMove(option?): Promise<void>

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

Parameters​

option?​

Partial<MouseMoveOption>

Returns​

Promise<void>

Inherited from​

IndexedOptionListDriver.mouseMove


mouseOut()​

mouseOut(option?): Promise<void>

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

Parameters​

option?​

Partial<MouseOutOption>

Returns​

Promise<void>

Inherited from​

IndexedOptionListDriver.mouseOut


mouseOver()​

mouseOver(option?): Promise<void>

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

Parameters​

option?​

Partial<HoverOption>

Returns​

Promise<void>

Inherited from​

IndexedOptionListDriver.mouseOver


mouseUp()​

mouseUp(option?): Promise<void>

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

Parameters​

option?​

Partial<MouseUpOption>

Returns​

Promise<void>

Inherited from​

IndexedOptionListDriver.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​

IndexedOptionListDriver.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​

IndexedOptionListDriver.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​

IndexedOptionListDriver.optionLocators


pressKey()​

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

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

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​

IndexedOptionListDriver.pressKey


removeFilter()​

removeFilter(label): Promise<boolean>

Defined in: component-driver-astryx/src/components/PowerSearchDriver.ts:95

Remove the chip with the given field/operator label via its "Remove" button. byAriaLabel escapes the label, so field/operator names containing quotes are matched safely.

Parameters​

label​

string

Returns​

Promise<boolean>

false when no such chip exists.


runtimeCssSelector()​

runtimeCssSelector(): Promise<string>

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

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​

IndexedOptionListDriver.runtimeCssSelector


scrollBy()​

scrollBy(delta): Promise<void>

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

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​

IndexedOptionListDriver.scrollBy


scrollIntoView()​

scrollIntoView(): Promise<void>

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

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​

IndexedOptionListDriver.scrollIntoView


type()​

type(text): Promise<void>

Defined in: component-driver-astryx/src/components/PowerSearchDriver.ts:55

Type into the query input to search field/operator suggestions.

Parameters​

text​

string

Returns​

Promise<void>


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​

IndexedOptionListDriver.waitForOptions


waitUntil()​

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

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

Type Parameters​

T​

T

Parameters​

option​

WaitUntilOption<T>

Returns​

Promise<T>

Inherited from​

IndexedOptionListDriver.waitUntil


waitUntilComponentState()​

waitUntilComponentState(option?): Promise<void>

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

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​

IndexedOptionListDriver.waitUntilComponentState


waitUntilVisible()​

waitUntilVisible(timeoutMs?): Promise<void>

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

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

Parameters​

timeoutMs?​

number

The number of milliseconds to wait before timing out

Returns​

Promise<void>

Inherited from​

IndexedOptionListDriver.waitUntilVisible


overriddenParentLocator()​

static overriddenParentLocator(): Optional<PartLocator>

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

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​

IndexedOptionListDriver.overriddenParentLocator


overrideLocatorRelativePosition()​

static overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>

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

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​

IndexedOptionListDriver.overrideLocatorRelativePosition