Module: database/repositories/baselineRepo

Visual regression baseline CRUD (DIF-001).

Baselines are the "golden" screenshots that subsequent runs diff against. Each row references a PNG on disk under artifacts/baselines/<testId>/. Rows are identified by (testId, stepNumber, browser)stepNumber = 0 is the final end-of-test screenshot, stepNumber >= 1 are per-step captures (DIF-016).

Source:

Methods

(static) deleteByTestId(testId) → {number}

Delete all baselines for a test (invoked when a test is hard-deleted).

Parameters:
Name Type Description
testId string
Source:
Returns:

rows deleted

Type
number

(static) deleteOne(testId, stepNumber, browseropt) → {number}

Delete a single baseline row for a specific test + step + browser.

Parameters:
Name Type Attributes Default Description
testId string
stepNumber number
browser string <optional>
"chromium"
Source:
Returns:

rows deleted

Type
number

(static) get(testId, stepNumberopt, browseropt) → {Object|undefined}

Get a baseline entry for a specific test + step.

Parameters:
Name Type Attributes Default Description
testId string
stepNumber number <optional>
0
browser string <optional>
"chromium"
Source:
Returns:
Type
Object | undefined

(static) getAllByTestId(testId, browseropt) → {Array.<Object>}

List all baselines for a test, ordered by stepNumber.

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

(static) upsert(entry) → {void}

Upsert a baseline row. Creates on first call, updates updatedAt on subsequent calls (used when the user accepts visual changes).

Parameters:
Name Type Description
entry Object
Properties
Name Type Attributes Description
testId string
stepNumber number
browser string <optional>
imagePath string

Relative artifact path (e.g. /artifacts/baselines/TC-1/step-0.png).

width number <optional>
height number <optional>
Source:
Returns:
Type
void