SmartRow
A SmartRow is a Playwright Locator extended with table-aware methods. Every method that returns a row (getRow, findRow, iteration callbacks, etc.) returns a SmartRow.
Because SmartRow extends Locator, all standard Playwright locator methods — click(), innerText(), waitFor(), locator(), etc. — are available directly on the row.
Properties
rowIndex
Signature
rowIndex?: numberThe 0-based row index within the table, if known. Set by findRow, findRows, getRowByIndex, filter, and async iteration. May be undefined when returned by getRow.
const row = await table.findRow({ Name: 'John' });
console.log(row.rowIndex); // e.g. 12tablePageIndex
Signature
tablePageIndex?: numberThe 0-based page index this row was found on during pagination. Set alongside rowIndex by async operations.
table
Signature
table: TableResult<T>Reference back to the parent TableResult. Useful when passing rows between helpers.
Methods
getCell
Signature
getCell(column: string): SmartCellParameters
column- Column name (case-sensitive)
Returns a SmartCell (Locator + bringIntoView) for the named column. Column name is case-sensitive.
const emailCell = row.getCell('Email');
await expect(emailCell).toHaveText('john@example.com');
// SmartCell also exposes bringIntoView
await row.getCell('Notes').bringIntoView();toJSON
Signature
toJSON(options?: { columns?: string[]; atomic?: boolean }): Promise<T>Parameters
options- Optional configuration
Reads all (or specified) columns and returns a plain object. Includes columnOverrides.read values and syntheticColumns.
columns— only read these columns.atomic— snapshot every cell in a single browser evaluate, so no column is read at a different moment than another (useful for live-updating rows). RequirescellSelectorto be a CSS string, not a function. Column overrides still run, against a frozen off-screen copy of the row. Non-override columns are read withtextContentrather thaninnerText.
const data = await row.toJSON();
// { Name: 'John', Email: 'john@example.com', Status: 'Active' }
const partial = await row.toJSON({ columns: ['Name', 'Status'] });
// { Name: 'John', Status: 'Active' }
const coherent = await row.toJSON({ atomic: true });getValue
Signature
getValue(column: string): Promise<string>Parameters
column- Column name (case-sensitive)
Returns the resolved value of one column as a string — works for real DOM columns, columnOverrides.read columns, and syntheticColumns.
When strategies.viewport or strategies.navigation is configured, it runs the same cell-navigation pipeline as toJSON(), so off-screen virtualized cells are mounted before reading. Without those strategies it reads the current DOM cell.
const email = await row.getValue('Email');
const total = await row.getValue('Total'); // synthetic columnbringIntoView
Signature
bringIntoView(): Promise<void>Scrolls and/or paginates to make this row visible. Requires rowIndex to be set — works when the row was returned by findRow, findRows, getRowByIndex, filter, or async iteration. Prefers strategies.viewport.scrollToRow when configured (avoids Y-axis eviction from scrollIntoViewIfNeeded on virtualized grids).
const rows = await table.findRows({ Status: 'Flagged' });
for (const row of rows) {
await row.bringIntoView();
await expect(row.getCell('Status')).toBeVisible();
}WARNING
Throws if rowIndex is unknown (e.g., rows from getRow).
smartFill
Signature
smartFill(data: Partial<T> | Record<string, any>, options?: FillOptions): Promise<void>Parameters
data- Column-value pairs to filloptions- Optional configuration
Fills form fields in the row. Auto-detects input type (text, select, checkbox, contenteditable). Uses columnOverrides.write when configured.
await row.smartFill({ Name: 'Jane', Status: 'Active', Subscribe: true });
// Custom input mapper for a non-standard input
await row.smartFill(
{ Notes: 'Updated' },
{ inputMappers: { Notes: (cell) => cell.locator('.rich-text-editor') } }
);wasFound
Signature
wasFound(): booleanReturns false if this is a sentinel "not found" row (e.g., when findRow finds no match in a non-throwing mode). Returns true for any real row.
const row = await table.findRow({ Name: 'Ghost' });
if (!row.wasFound()) {
console.log('Row not found');
}