Module: database/repositories/testFixtureRepo

Data-driven test fixture CRUD (CAP-001).

A fixture is a CSV / JSON row-set bound to a specific test version. The runner replays the test once per row, substituting {{column}} placeholders in playwrightCode from the row values. Rows are persisted as a JSON blob in the rows column (parsed lazily on read via rowToFixture); the column is TEXT rather than the dialect-specific JSON type so the same SQL works on SQLite and Postgres without an adapter shim.

Rows are keyed on (testId, version) where version mirrors tests.codeVersion — a new code version (e.g. after an AI fix bumps the test body) starts with a fresh fixture slot. Old fixtures stay around for run-history replay rather than being cascade-deleted on version bump.

Source:

Methods

(static) getFixture(testId, version) → {Object|undefined}

Get a fixture row for a specific test + version.

Parameters:
Name Type Description
testId string
version number
Source:
Returns:
Type
Object | undefined

(static) listFixtures(testId) → {Array.<Object>}

List all fixtures for a test, newest version first. Powers the history table in the Test Detail fixture panel.

Parameters:
Name Type Description
testId string
Source:
Returns:
Type
Array.<Object>

(static) upsertFixture(entry) → {Object}

Upsert a fixture row. Creates on first call, replaces on subsequent calls at the same (testId, version) — re-uploading at the same code version is intentionally a replace rather than an append so the fixture panel's history table never grows unbounded for a single version.

Parameters:
Name Type Description
entry Object
Properties
Name Type Description
testId string
version number
format "csv" | "json"
rows Array.<Object>
Source:
Returns:

The freshly persisted fixture row.

Type
Object

(inner) rowToFixture(row) → {Object|undefined}

Map a raw test_fixtures row to its public shape, parsing the JSON rows column into an array. Returns undefined for missing rows so callers can use the same if (!fixture) return … pattern as the sibling repos.

Parameters:
Name Type Description
row Object | undefined
Source:
Returns:
Type
Object | undefined