@next-starters/skill-playwright-testid-catalog
v1.0.0
Published
Builds a single typed data-testid catalog per feature area instead of scattering string literals across components and specs. A shared createTestIdRegistry helper builds a nested, as-const catalog…
Readme
playwright-testid-catalog
Build a single typed data-testid catalog per feature area instead of
scattering string literals across components and specs. A shared registry
helper validates id uniqueness at dev-time, and a Playwright-side mirror
module re-exports the exact same catalog object so app code and test code
can never drift apart on an id string.
What it covers
- A
createTestIdRegistryhelper that builds a nested,as constcatalog object and throws on duplicate leaf string values in development. - A documented key/suffix vocabulary — sections (list/detail/create/edit/ dialogs) and element suffixes (-page/-button/-input/-table/-row) — so ids are readable without opening the component that renders them.
- A mirror module for the Playwright side that re-exports the identical
catalog object, plus a
prefix-${id}convention (with a reverse-parse fallback) for dynamic per-row ids.
Use it
Read SKILL.md for the 7 invariants and the three-step verification loop
(typecheck → dev-mode run → lint). Copy the genericized templates from
references/ (utils.ts, example-catalog.ts,
example-catalog.mirror.ts) as the starting shape for a new feature's
catalog.
Install globally
Symlink into your global skills the same way as the other next-starters skills:
skills add [email protected]:catesandrew/next-starters.git --skill skills/playwright-testid-catalog -gCompanion
Pairs with playwright-testid-attributes, playwright-attribute-waits, and playwright-page-objects. This skill defines the registry and mirror mechanics that produce the catalog in the first place; those companion skills consume catalog ids inside components, waits, and page objects respectively, without redefining how the catalog itself is built, validated, or mirrored.
