[KongchangAI]
Product

TokenCap

A tool that parses JSX ASTs to extract front-end test targeting attributes (data-testid, ARIA roles, aria-label, htmlFor/id pairs) and generates index snapshots for use by AI coding agents, aiming to solve the hallucination problem caused by agents guessing DOM selectors when generating tests.

Timeline (last 90 days)

Oct 13

TokenCap extracts explicit test attributes (data-testid, role, aria-*, etc.) by parsing JSX AST nodes and indexes them centrally, turning how AI agents locate elements from guessing into querying.

Unverified50%
Oct 13

TokenCap defines and extracts four categories of attributes in src/frontend/testIds.js: data-testid/data-test/data-cy, role, aria-label/aria-labelledby/aria-describedby, and the pairing relationship between htmlFor and input id.

Unverified50%
Oct 13

TokenCap generates a component snapshot via the `tokencap make` command, and the snapshot contains the Playwright-style (getByTestId/getByRole) locator for each locator along with the source line number.

Unverified50%
Oct 13

Putting ARIA attributes and test identifiers in the same index can guide AI agents to use accessibility best-practice locators when generating tests, indirectly improving component accessibility.

Unverified50%
Oct 13

If the frontend's own locator attributes are chaotic (non-standard data-testid naming, incomplete ARIA), the index can only faithfully reflect the chaos and cannot automatically fix testability.

Unverified50%
Oct 13

Compared with having an AI agent read the entire DOM tree or rendered HTML, the AST-based indexing approach has controllable token consumption and higher accuracy.

Unverified50%
Oct 13

For teams already using AI agents to write tests, incorporating test locator attributes into the frontend index is a change with a very high return on investment.

Unverified50%

All Facts (7)

Source Articles