mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-15 00:11:15 +03:00
add mock data
This commit is contained in:
parent
3b81416299
commit
8b3e21703d
54
web/e2e/fixtures/mock-data/debug-replay.ts
Normal file
54
web/e2e/fixtures/mock-data/debug-replay.ts
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/**
|
||||||
|
* Debug replay status factory.
|
||||||
|
*
|
||||||
|
* The Replay page polls /api/debug_replay/status every 1s via SWR.
|
||||||
|
* The no-session state shows an empty state; the active state
|
||||||
|
* renders the live camera image + debug toggles + objects/messages
|
||||||
|
* tabs. Used by replay.spec.ts.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type DebugReplayStatus = {
|
||||||
|
active: boolean;
|
||||||
|
replay_camera: string | null;
|
||||||
|
source_camera: string | null;
|
||||||
|
start_time: number | null;
|
||||||
|
end_time: number | null;
|
||||||
|
live_ready: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function noSessionStatus(): DebugReplayStatus {
|
||||||
|
return {
|
||||||
|
active: false,
|
||||||
|
replay_camera: null,
|
||||||
|
source_camera: null,
|
||||||
|
start_time: null,
|
||||||
|
end_time: null,
|
||||||
|
live_ready: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function activeSessionStatus(
|
||||||
|
opts: {
|
||||||
|
camera?: string;
|
||||||
|
sourceCamera?: string;
|
||||||
|
startTime?: number;
|
||||||
|
endTime?: number;
|
||||||
|
liveReady?: boolean;
|
||||||
|
} = {},
|
||||||
|
): DebugReplayStatus {
|
||||||
|
const {
|
||||||
|
camera = "front_door",
|
||||||
|
sourceCamera = "front_door",
|
||||||
|
startTime = Date.now() / 1000 - 3600,
|
||||||
|
endTime = Date.now() / 1000 - 1800,
|
||||||
|
liveReady = true,
|
||||||
|
} = opts;
|
||||||
|
return {
|
||||||
|
active: true,
|
||||||
|
replay_camera: camera,
|
||||||
|
source_camera: sourceCamera,
|
||||||
|
start_time: startTime,
|
||||||
|
end_time: endTime,
|
||||||
|
live_ready: liveReady,
|
||||||
|
};
|
||||||
|
}
|
||||||
45
web/e2e/fixtures/mock-data/faces.ts
Normal file
45
web/e2e/fixtures/mock-data/faces.ts
Normal file
@ -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],
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user