Skip to main content

Class: DataGridProDriver

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:45

Driver for Material UI v7 DataGridPro component.

See

https://mui.com/x/react-data-grid/

Extends

  • ComponentDriver<typeof parts>

Constructors

Constructor

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

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:46

Parameters

locator

PartLocator

interactor

Interactor

option?

Partial<IComponentDriverOption<{ }>>

Returns

DataGridProDriver

Overrides

ComponentDriver<typeof parts>.constructor

Properties

commutableOption

readonly commutableOption: IComponentDriverOption<{ footer: { driver: typeof DataGridFooterDriver; locator: CssLocator; }; headerRow: { driver: typeof DataGridHeaderRowDriver; locator: PartLocator; }; loading: { driver: typeof HTMLElementDriver; locator: CssLocator; }; skeletonOverlay: { driver: typeof HTMLElementDriver; locator: CssLocator; }; }>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:20

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

ComponentDriver.commutableOption


interactor

readonly interactor: Interactor

Defined in: core/build/src/drivers/ComponentDriver.d.ts:11

Inherited from

ComponentDriver.interactor

Accessors

driverName

Get Signature

get driverName(): string

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:202

Returns

string

Overrides

ComponentDriver.driverName


locator

Get Signature

get locator(): PartLocator

Defined in: core/build/src/drivers/ComponentDriver.d.ts:51

Return the locator of the component

Returns

PartLocator

Inherited from

ComponentDriver.locator


parts

Get Signature

get parts(): ScenePartDriver<T>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:47

Return driver instance of all the named parts

Returns

ScenePartDriver<T>

Inherited from

ComponentDriver.parts

Methods

click()

click(option?): Promise<void>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:75

Parameters

option?

Partial<ClickOption>

Returns

Promise<void>

Inherited from

ComponentDriver.click


enforcePartExistence()

protected enforcePartExistence(partName): Promise<void>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:57

Check the specified parts' existences, and throw MissPartError 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

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

"headerRow" | "loading" | "skeletonOverlay" | "footer" | readonly ("headerRow" | "loading" | "skeletonOverlay" | "footer")[]

Returns

Promise<void>

Inherited from

ComponentDriver.enforcePartExistence


exists()

exists(): Promise<boolean>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:74

Whether the component exists/attached to the DOM

Returns

Promise<boolean>

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

Inherited from

ComponentDriver.exists


focus()

focus(option?): Promise<void>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:84

Parameters

option?

Partial<FocusOption>

Returns

Promise<void>

Inherited from

ComponentDriver.focus


getAttribute()

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

Defined in: core/build/src/drivers/ComponentDriver.d.ts:69

Parameters

attributeName

string

Returns

Promise<Optional<string>>

Inherited from

ComponentDriver.getAttribute


getCell()

getCell<DriverT>(query, driverClass): Promise<null | DriverT>

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:137

Get the cell driver for the cell, if the cell does not exist, return null The cell driver is default to HTMLElementDriver, you can specify a different driver class

Type Parameters

DriverT

DriverT extends ComponentDriver<{ }>

Parameters

query

DataGridCellQuery

The query to locate the cell

driverClass

typeof ComponentDriver = HTMLElementDriver

Optional, the driver class to use for the cell, default to HTMLElementDriver

Returns

Promise<null | DriverT>


getCellText()

getCellText(query): Promise<string>

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:160

Get the text content of the cell, if the cell does not exist, throw an error

Parameters

query

DataGridCellQuery

The query to locate the cell

Returns

Promise<string>


getColumnCount()

getColumnCount(): Promise<number>

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:76

The number of columns currently displayed in the data grid, note that data grid pro uses virtualize rendering, therefore the column count heavily depends on the viewport size

Returns

Promise<number>

The number of columns currently displayed in the data grid


getHeaderText()

getHeaderText(): Promise<string[]>

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:84

The array text of the header row, note that columns not shown in the viewport may not be included because of virtualize rendering

Returns

Promise<string[]>

The array of text of the header row


getMissingPartNames()

protected getMissingPartNames(partName): Promise<readonly ("headerRow" | "loading" | "skeletonOverlay" | "footer")[]>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:63

Get the names of parts not in the DOM

Parameters

partName

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

"headerRow" | "loading" | "skeletonOverlay" | "footer" | readonly ("headerRow" | "loading" | "skeletonOverlay" | "footer")[]

Returns

Promise<readonly ("headerRow" | "loading" | "skeletonOverlay" | "footer")[]>

Inherited from

ComponentDriver.getMissingPartNames


getPaginationDescription()

getPaginationDescription(): Promise<Optional<string>>

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:196

Returns

Promise<Optional<string>>


getRow()

getRow(rowIndex): Promise<null | DataGridHeaderRowDriver>

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:107

Return the row driver for the row at the specified index, if the row does not exist, return null

Parameters

rowIndex

number

Returns

Promise<null | DataGridHeaderRowDriver>


getRowCount()

getRowCount(): Promise<number>

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:93

The number of rows currently displayed in the data grid, note that data grid pro uses virtualize rendering, therefore the row count heavily depends on the viewport size

Returns

Promise<number>

The number of columns currently displayed in the data grid


getRowText()

getRowText(rowIndex): Promise<string[]>

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:122

The array text of the specified row, note that columns not shown in the viewport may not be included because of virtualize rendering

Parameters

rowIndex

number

The index of the row

Returns

Promise<string[]>

The array of text of the specified row


getText()

getText(): Promise<Optional<string>>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:68

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

ComponentDriver.getText


gotoNextPage()

gotoNextPage(): Promise<void>

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:191

Returns

Promise<void>


gotoPreviousPage()

gotoPreviousPage(): Promise<void>

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:181

Returns

Promise<void>


hover()

hover(option?): Promise<void>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:76

Parameters

option?

Partial<HoverOption>

Returns

Promise<void>

Inherited from

ComponentDriver.hover


innerHTML()

innerHTML(): Promise<string>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:116

Get the inner HTML of the component

Returns

Promise<string>

The inner HTML of the component

Inherited from

ComponentDriver.innerHTML


isFooterVisible()

isFooterVisible(): Promise<boolean>

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:172

Returns

Promise<boolean>


isLoading()

isLoading(): Promise<boolean>

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:57

Checks if the data grid is currently loading.

Returns

Promise<boolean>

A promise that resolves to a boolean indicating if the data grid is loading.


isNextPageEnabled()

isNextPageEnabled(): Promise<boolean>

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:186

Returns

Promise<boolean>


isPreviousPageEnabled()

isPreviousPageEnabled(): Promise<boolean>

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:176

Returns

Promise<boolean>


isVisible()

isVisible(): Promise<boolean>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:93

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 wether the component is within the viewport.

Returns

Promise<boolean>

true if the component is visible, false otherwise

Inherited from

ComponentDriver.isVisible


mouseDown()

mouseDown(option?): Promise<void>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:78

Parameters

option?

Partial<MouseDownOption>

Returns

Promise<void>

Inherited from

ComponentDriver.mouseDown


mouseEnter()

mouseEnter(option?): Promise<void>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:82

Parameters

option?

Partial<MouseEnterOption>

Returns

Promise<void>

Inherited from

ComponentDriver.mouseEnter


mouseLeave()

mouseLeave(option?): Promise<void>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:83

Parameters

option?

Partial<MouseLeaveOption>

Returns

Promise<void>

Inherited from

ComponentDriver.mouseLeave


mouseMove()

mouseMove(option?): Promise<void>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:77

Parameters

option?

Partial<MouseMoveOption>

Returns

Promise<void>

Inherited from

ComponentDriver.mouseMove


mouseOut()

mouseOut(option?): Promise<void>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:81

Parameters

option?

Partial<MouseOutOption>

Returns

Promise<void>

Inherited from

ComponentDriver.mouseOut


mouseOver()

mouseOver(option?): Promise<void>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:80

Parameters

option?

Partial<HoverOption>

Returns

Promise<void>

Inherited from

ComponentDriver.mouseOver


mouseUp()

mouseUp(option?): Promise<void>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:79

Parameters

option?

Partial<MouseUpOption>

Returns

Promise<void>

Inherited from

ComponentDriver.mouseUp


overriddenParentLocator()

overriddenParentLocator(): Optional<PartLocator>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:31

Usually this should be undefined as the component driver corresponds to a component nested inside the parent DOM, thus the driver's locator would automatically chain with its parent's locator.

When the component is rendered outside the parent's DOM, which usually happens when the component is a modal or popup, supply the PartLocator on how to locate the component with the component's own locator.

Caution of usage: this function is called before the construction of the driver, so it should not use any instance properties

Returns

Optional<PartLocator>

Inherited from

ComponentDriver.overriddenParentLocator


overrideLocatorRelativePosition()

overrideLocatorRelativePosition(): Optional<LocatorRelativePosition>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:43

Usually this should be undefined when the locator is defined by the ScenePart, thus it reflects the natural relative position of the component

However, in some implementation such as MUI v5 dialog, the actual dialog DOM is rendered outside the parent DOM, and the selector is "siblings", by defining this function, it allows the driver to have the knowledge of the actual relative position instead of offloading the knowledge to the consumer.

Caution of usage: this function is called before the construction of the driver, so it should not use any instance properties

Returns

Optional<LocatorRelativePosition>

Inherited from

ComponentDriver.overrideLocatorRelativePosition


runtimeCssSelector()

runtimeCssSelector(): Promise<string>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:122

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

ComponentDriver.runtimeCssSelector


waitForLoad()

waitForLoad(timeoutMs): Promise<void>

Defined in: component-driver-mui-x-v7/src/components/datagrid/DataGridProDriver.ts:66

Waits for the data grid to exit the loading state.

Parameters

timeoutMs

number = 10000

The maximum time to wait for the load to complete, in milliseconds.

Returns

Promise<void>


waitUntil()

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

Defined in: core/build/src/drivers/ComponentDriver.d.ts:111

Type Parameters

T

T

Parameters

option

WaitUntilOption<T>

Returns

Promise<T>

Inherited from

ComponentDriver.waitUntil


waitUntilComponentState()

waitUntilComponentState(option?): Promise<void>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:110

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

ComponentDriver.waitUntilComponentState


waitUntilVisible()

waitUntilVisible(timeoutMs?): Promise<void>

Defined in: core/build/src/drivers/ComponentDriver.d.ts:98

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

ComponentDriver.waitUntilVisible