Skip to content

rickcedwhat/playwright-smart-table

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

312 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Playwright Smart Table

Dealing with tables sucks. Locators are brittle, hard to read, and break the moment a column moves or pagination kicks in.

Playwright Smart Table lets you find rows by column name instead of fragile DOM positions. You describe your table — it does the rest.

npm version License: MIT


// ❌ Before — breaks if columns reorder
const row = page.locator('tbody tr')
  .filter({ has: page.locator('td:nth-child(1)', { hasText: 'John' }) })
  .filter({ has: page.locator('td:nth-child(2)', { hasText: 'Doe' }) })
const email = await row.locator('td:nth-child(3)').innerText()
// ✅ After — column-aware, survives reordering
const row = table.getRow({ firstName: 'John', lastName: 'Doe' })
const email = await row.getCell('Email').innerText()

Installation

npm install @rickcedwhat/playwright-smart-table

Quick Start

import { useTable } from '@rickcedwhat/playwright-smart-table';

const table = await useTable(page.locator('#my-table')).init();

const row = table.getRow({ Name: 'John Doe' });
const email = await row.getCell('Email').innerText();

Features

  • Row access — find rows by column name, not DOM index
  • Pagination searchfindRow and findRows scan across pages automatically
  • IterationforEach, map, filter, with early exit via stop()
  • Table config — plug in any pagination shape, virtual scroll, or custom header logic
  • Fill / edit cells — write values back into table cells

MIT © Cedrick Catalan

About

Production-ready table testing for Playwright with smart column-aware locators.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors