mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-03 01:22:17 +03:00
Improve frontend e2e tests (#22958)
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
* add mock data * add helpers * page objects * updated specs * remove PENDING_REWARITE * formatting
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Face library factories.
|
||||
*
|
||||
* The /api/faces endpoint returns a record keyed by collection name
|
||||
* with the list of face image filenames. Grouped training attempts
|
||||
* live under the "train" key with filenames of the form
|
||||
* `${event_id}-${timestamp}-${label}-${score}.webp`.
|
||||
*
|
||||
* Used by face-library.spec.ts and chat.spec.ts (attachment chip).
|
||||
*/
|
||||
|
||||
export type FacesMock = Record<string, string[]>;
|
||||
|
||||
export function basicFacesMock(): FacesMock {
|
||||
return {
|
||||
alice: ["alice-1.webp", "alice-2.webp"],
|
||||
bob: ["bob-1.webp"],
|
||||
charlie: ["charlie-1.webp"],
|
||||
};
|
||||
}
|
||||
|
||||
export function emptyFacesMock(): FacesMock {
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a grouped recent-recognition training attempt to an existing
|
||||
* faces mock. The grouping key on the backend is the event id — so
|
||||
* images with the same event-id prefix render as one dialog-able card.
|
||||
*/
|
||||
export function withGroupedTrainingAttempt(
|
||||
base: FacesMock,
|
||||
opts: {
|
||||
eventId: string;
|
||||
attempts: Array<{ timestamp: number; label: string; score: number }>;
|
||||
},
|
||||
): FacesMock {
|
||||
const trainImages = opts.attempts.map(
|
||||
(a) => `${opts.eventId}-${a.timestamp}-${a.label}-${a.score}.webp`,
|
||||
);
|
||||
return {
|
||||
...base,
|
||||
train: [...(base.train ?? []), ...trainImages],
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user