API reference for Angular Material table-testing

import {MatTableHarness} from '@angular/material/table/testing';

Harness for interacting with a standard mat-table in tests.

Methods
async
getCellTextByColumnName

Gets the text inside the entire table organized by columns.

Returns
Promise<MatTableHarnessColumnsText>

async
getCellTextByIndex

Gets the text inside the entire table organized by rows.

Returns
Promise<string[][]>

async
getFooterRows

Gets all of the footer rows in a table.

Parameters

filter

RowHarnessFilters = {}

Returns
Promise<MatFooterRowHarness[]>

async
getHeaderRows

Gets all of the header rows in a table.

Parameters

filter

RowHarnessFilters = {}

Returns
Promise<MatHeaderRowHarness[]>

async
getRows

Gets all of the regular data rows in a table.

Parameters

filter

RowHarnessFilters = {}

Returns
Promise<MatRowHarness[]>

async
host

Gets a Promise for the TestElement representing the host element of the component.

Returns
Promise<TestElement>

Harness for interacting with a standard Angular Material table row.

Methods
async
getCellTextByColumnName

Gets the text inside the row organized by columns.

Returns
Promise<MatRowHarnessColumnsText>

async
getCellTextByIndex

Gets the text of the cells in the row.

Parameters

filter

CellHarnessFilters = {}

Returns
Promise<string[]>

async
getCells

Gets a list of MatCellHarness for all cells in the row.

Parameters

filter

CellHarnessFilters = {}

Returns
Promise<MatCellHarness[]>

async
host

Gets a Promise for the TestElement representing the host element of the component.

Returns
Promise<TestElement>

Harness for interacting with a standard Angular Material table header row.

Methods
async
getCellTextByColumnName

Gets the text inside the header row organized by columns.

Returns
Promise<MatRowHarnessColumnsText>

async
getCellTextByIndex

Gets the text of the cells in the header row.

Parameters

filter

CellHarnessFilters = {}

Returns
Promise<string[]>

async
getCells

Gets a list of MatHeaderCellHarness for all cells in the row.

Parameters

filter

CellHarnessFilters = {}

Returns
Promise<MatHeaderCellHarness[]>

async
host

Gets a Promise for the TestElement representing the host element of the component.

Returns
Promise<TestElement>

Harness for interacting with a standard Angular Material table footer row.

Methods
async
getCellTextByColumnName

Gets the text inside the footer row organized by columns.

Returns
Promise<MatRowHarnessColumnsText>

async
getCellTextByIndex

Gets the text of the cells in the footer row.

Parameters

filter

CellHarnessFilters = {}

Returns
Promise<string[]>

async
getCells

Gets a list of MatFooterCellHarness for all cells in the row.

Parameters

filter

CellHarnessFilters = {}

Returns
Promise<MatFooterCellHarness[]>

async
host

Gets a Promise for the TestElement representing the host element of the component.

Returns
Promise<TestElement>

Harness for interacting with a standard Angular Material table cell.

Methods
async
getColumnName

Gets the name of the column that the cell belongs to.

Returns
Promise<string>

async
getText

Gets the cell's text.

Returns
Promise<string>

async
host

Gets a Promise for the TestElement representing the host element of the component.

Returns
Promise<TestElement>

Harness for interacting with a standard Angular Material table header cell.

Methods
async
getColumnName

Gets the name of the column that the cell belongs to.

Returns
Promise<string>

async
getText

Gets the cell's text.

Returns
Promise<string>

async
host

Gets a Promise for the TestElement representing the host element of the component.

Returns
Promise<TestElement>

Harness for interacting with a standard Angular Material table footer cell.

Methods
async
getColumnName

Gets the name of the column that the cell belongs to.

Returns
Promise<string>

async
getText

Gets the cell's text.

Returns
Promise<string>

async
host

Gets a Promise for the TestElement representing the host element of the component.

Returns
Promise<TestElement>

Text extracted from a table organized by columns.

Methods
__index
Parameters

columnName

string

Returns
{ text: string[]; headerText: string[]; footerText: string[]; }

Text extracted from a table row organized by columns.

Methods
__index
Parameters

columnName

string

Returns
string

A set of criteria that can be used to filter a list of cell harness instances.

Properties
Name Description

text: string | RegExp

Only find instances whose text matches the given value.

A set of criteria that can be used to filter a list of row harness instances.

A set of criteria that can be used to filter a list of table harness instances.