Skip to main content

Class: TableDriver

Defined in: packages/component-driver-angular-material-v20/src/components/TableDriver.ts:58

Driver for the Angular Material table (MatTable).

Locate it by the table host — the native <table mat-table> or the flex <mat-table> (e.g. a data-testid placed there). Both variants expose the same ARIA contract (role="table", role="row", role="columnheader", role="cell" — the CDK sets these explicitly on the native elements too), so one driver serves both; role="grid"/treegrid tables (whose cells are gridcell) are out of scope, as are MatSort/MatPaginator (follow-up work).

Rows are the ListComponentDriver items: getItemCount/getItemByIndex/ getItems are inherited, with getRowCount/getRowByIndex as the table-vocabulary aliases. Column-addressed reads resolve the column index through the header row's role="columnheader" cell texts.

See​

https://material.angular.dev/components/table

Extends​

Constructors​

Constructor​

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

Defined in: packages/component-driver-angular-material-v20/src/components/TableDriver.ts:59

Parameters​

locator​

PartLocator

interactor​

Interactor

option?​

Partial<TableDriverOption>

Returns​

TableDriver

Overrides​

ListComponentDriver<TableRowDriver>.constructor

Accessors​

driverName​

Get Signature​

get driverName(): string

Defined in: packages/component-driver-angular-material-v20/src/components/TableDriver.ts:123

Returns​

string

Overrides​

ListComponentDriver.driverName

Methods​

getCellText()​

getCellText(rowIndex, column): Promise<string | null>

Defined in: packages/component-driver-angular-material-v20/src/components/TableDriver.ts:111

The trimmed text of one cell, addressed by data-row index and column — either the zero-based column index or the column's header text. Returns null when the row, the column index, or the header text does not exist.

Parameters​

rowIndex​

number

column​

string | number

Returns​

Promise<string | null>


getColumnHeaders()​

getColumnHeaders(): Promise<string[]>

Defined in: packages/component-driver-angular-material-v20/src/components/TableDriver.ts:72

The trimmed text of every role="columnheader" cell, in column order. Assumes the single header row MatTable renders for one *matHeaderRowDef; with multiple header rows the lists concatenate in DOM order.

Returns​

Promise<string[]>


getColumnIndex()​

getColumnIndex(header): Promise<number>

Defined in: packages/component-driver-angular-material-v20/src/components/TableDriver.ts:85

The zero-based index of the column whose header text equals header (trimmed), or -1 when no column matches — Array.prototype.findIndex semantics.

Parameters​

string

Returns​

Promise<number>


getRowByIndex()​

getRowByIndex(rowIndex): Promise<TableRowDriver | null>

Defined in: packages/component-driver-angular-material-v20/src/components/TableDriver.ts:102

The driver of the data row at the given zero-based index, or null when the index is out of range.

Parameters​

rowIndex​

number

Returns​

Promise<TableRowDriver | null>


getRowCount()​

getRowCount(): Promise<number>

Defined in: packages/component-driver-angular-material-v20/src/components/TableDriver.ts:94

The number of data rows (header, footer and *matNoDataRow rows never count).

Returns​

Promise<number>

Inherited members (24)

Properties​

commutableOption​

readonly commutableOption: CommutableComponentDriverOption

Defined in: packages/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​

ListComponentDriver.commutableOption


interactor​

readonly interactor: Interactor

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

Inherited from​

ListComponentDriver.interactor

Accessors​

locator​

Get Signature​

get locator(): PartLocator

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

Return the locator of the component

Returns​

PartLocator

Inherited from​

ListComponentDriver.locator


parts​

Get Signature​

get parts(): ScenePartDriver<T>

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

Return driver instance of all the named parts

Returns​

ScenePartDriver<T>

Inherited from​

ListComponentDriver.parts

Methods​

click()​

click(option?): Promise<void>

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

Parameters​
option?​

Partial<ClickOption>

Returns​

Promise<void>

Inherited from​

ListComponentDriver.click


exists()​

exists(): Promise<boolean>

Defined in: packages/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​

ListComponentDriver.exists


focus()​

focus(option?): Promise<void>

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

Parameters​
option?​

Partial<FocusOption>

Returns​

Promise<void>

Inherited from​

ListComponentDriver.focus


getAttribute()​

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

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

Parameters​
attributeName​

string

Returns​

Promise<Optional<string>>

Inherited from​

ListComponentDriver.getAttribute


getItemByIndex()​

getItemByIndex<ItemClass>(index, itemDriverClass?): Promise<ItemClass | null>

Defined in: packages/core/dist/index.d.mts:968

Get the item's driver instance at the given index

Type Parameters​
ItemClass​

ItemClass extends ComponentDriver<{ }> = TableRowDriver

Parameters​
index​

number

itemDriverClass?​

ComponentDriverCtor<ItemClass>

Returns​

Promise<ItemClass | null>

The item's driver instance at the given index, if the index is out of range, return null

Inherited from​

ListComponentDriver.getItemByIndex


getItemByLabel()​

getItemByLabel<ItemClass>(text, itemDriverClass?): Promise<ItemClass | null>

Defined in: packages/core/dist/index.d.mts:975

Get the item's driver instance by the given text

Type Parameters​
ItemClass​

ItemClass extends ComponentDriver<{ }> = TableRowDriver

Parameters​
text​

string

itemDriverClass?​

ComponentDriverCtor<ItemClass>

Returns​

Promise<ItemClass | null>

The item's driver instance by the given text, if the text is not found, return null

Inherited from​

ListComponentDriver.getItemByLabel


getItemCount()​

getItemCount(): Promise<number>

Defined in: packages/core/dist/index.d.mts:988

Get the number of items in the list. This is more efficient than calling getItems().length when you only need the count, as it does not instantiate driver instances for each item.

Returns​

Promise<number>

The number of items in the list

Inherited from​

ListComponentDriver.getItemCount


getItems()​

getItems<ItemClass>(itemDriverClass?): Promise<ItemClass[]>

Defined in: packages/core/dist/index.d.mts:981

Get all the items' driver instances in the list

Type Parameters​
ItemClass​

ItemClass extends ComponentDriver<{ }> = TableRowDriver

Parameters​
itemDriverClass?​

ComponentDriverCtor<ItemClass>

Returns​

Promise<ItemClass[]>

Inherited from​

ListComponentDriver.getItems


getText()​

getText(): Promise<Optional<string>>

Defined in: packages/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​

ListComponentDriver.getText


hover()​

hover(option?): Promise<void>

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

Parameters​
option?​

Partial<HoverOption>

Returns​

Promise<void>

Inherited from​

ListComponentDriver.hover


isVisible()​

isVisible(): Promise<boolean>

Defined in: packages/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​

ListComponentDriver.isVisible


pressKey()​

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

Defined in: packages/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​

ListComponentDriver.pressKey


runtimeCssSelector()​

runtimeCssSelector(): Promise<string>

Defined in: packages/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​

ListComponentDriver.runtimeCssSelector


scrollIntoView()​

scrollIntoView(): Promise<void>

Defined in: packages/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​

ListComponentDriver.scrollIntoView


typeText()​

typeText(text): Promise<void>

Defined in: packages/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​

ListComponentDriver.typeText


waitUntil()​

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

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

Type Parameters​
T​

T

Parameters​
option​

WaitUntilOption<T>

Returns​

Promise<T>

Inherited from​

ListComponentDriver.waitUntil


waitUntilComponentState()​

waitUntilComponentState(option?): Promise<void>

Defined in: packages/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​

ListComponentDriver.waitUntilComponentState


waitUntilVisible()​

waitUntilVisible(timeoutMs?): Promise<void>

Defined in: packages/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​

ListComponentDriver.waitUntilVisible


overriddenParentLocator()​

static overriddenParentLocator(): Optional<PartLocator>

Defined in: packages/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​

ListComponentDriver.overriddenParentLocator


overrideLocatorRelativePosition()​

static overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>

Defined in: packages/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​

ListComponentDriver.overrideLocatorRelativePosition

Protected members (18)

Methods​

activate()​

protected activate(): Promise<void>

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

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

Returns​

Promise<void>

Inherited from​

ListComponentDriver.activate


contextMenu()​

protected contextMenu(): Promise<void>

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

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

Returns​

Promise<void>

Inherited from​

ListComponentDriver.contextMenu


drag()​

protected drag(delta): Promise<void>

Defined in: packages/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​

ListComponentDriver.drag


dragTo()​

protected dragTo(target): Promise<void>

Defined in: packages/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​

ListComponentDriver.dragTo


enforcePartExistence()​

protected enforcePartExistence(partName): Promise<void>

Defined in: packages/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​

ListComponentDriver.enforcePartExistence


getBoundingRect()​

protected getBoundingRect(): Promise<BoundingRect>

Defined in: packages/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​

ListComponentDriver.getBoundingRect


getItemClass()​

protected getItemClass<ItemClass>(itemDriverClass?): ComponentDriverCtor<ItemClass>

Defined in: packages/core/dist/index.d.mts:961

Type Parameters​
ItemClass​

ItemClass extends ComponentDriver<{ }> = TableRowDriver

Parameters​
itemDriverClass?​

ComponentDriverCtor<ItemClass>

Returns​

ComponentDriverCtor<ItemClass>

Inherited from​

ListComponentDriver.getItemClass


getItemLocator()​

protected getItemLocator(): PartLocator

Defined in: packages/core/dist/index.d.mts:960

Returns​

PartLocator

Inherited from​

ListComponentDriver.getItemLocator


getMissingPartNames()​

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

Defined in: packages/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​

ListComponentDriver.getMissingPartNames


innerHTML()​

protected innerHTML(): Promise<string>

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

Get the inner HTML of the component

Returns​

Promise<string>

The inner HTML of the component

Inherited from​

ListComponentDriver.innerHTML


mouseDown()​

protected mouseDown(option?): Promise<void>

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

Parameters​
option?​

Partial<MouseDownOption>

Returns​

Promise<void>

Inherited from​

ListComponentDriver.mouseDown


mouseEnter()​

protected mouseEnter(option?): Promise<void>

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

Parameters​
option?​

Partial<MouseEnterOption>

Returns​

Promise<void>

Inherited from​

ListComponentDriver.mouseEnter


mouseLeave()​

protected mouseLeave(option?): Promise<void>

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

Parameters​
option?​

Partial<MouseLeaveOption>

Returns​

Promise<void>

Inherited from​

ListComponentDriver.mouseLeave


mouseMove()​

protected mouseMove(option?): Promise<void>

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

Parameters​
option?​

Partial<MouseMoveOption>

Returns​

Promise<void>

Inherited from​

ListComponentDriver.mouseMove


mouseOut()​

protected mouseOut(option?): Promise<void>

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

Parameters​
option?​

Partial<MouseOutOption>

Returns​

Promise<void>

Inherited from​

ListComponentDriver.mouseOut


mouseOver()​

protected mouseOver(option?): Promise<void>

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

Parameters​
option?​

Partial<HoverOption>

Returns​

Promise<void>

Inherited from​

ListComponentDriver.mouseOver


mouseUp()​

protected mouseUp(option?): Promise<void>

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

Parameters​
option?​

Partial<MouseUpOption>

Returns​

Promise<void>

Inherited from​

ListComponentDriver.mouseUp


scrollBy()​

protected scrollBy(delta): Promise<void>

Defined in: packages/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​

ListComponentDriver.scrollBy