mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-12-01 17:57:08 +03:00
CI / AMD64 Build (push) Canceled after 0s
CI / AMD64 Smoke Test (push) Canceled after 0s
CI / ARM Build (push) Canceled after 0s
CI / Jetson Jetpack 6 (push) Canceled after 0s
CI / AMD64 Extra Build (push) Canceled after 0s
CI / ARM Extra Build (push) Canceled after 0s
CI / Synaptics Build (push) Canceled after 0s
CI / Assemble and push default build (push) Canceled after 0s
* encode notice ids in notice action urls Notice ids went into the URL raw, so a detector on a repeated device like openvino:GPU#2 had everything after the # dropped as a fragment. The acknowledge, mute, and unhide requests 404'd and the buttons did nothing. The hooks now encode the id. * re-sweep a replaced media volume despite the ownership sentinel The boot sweep skipped whenever the sentinel in /config matched, so wiping or swapping /media/frigate while keeping the config volume left the new root-owned folder unswept and Frigate failed to create /media/frigate/recordings. The sentinel is now honored only when each volume root is still owned by the runtime user. Filesystems that accept chown without applying it (CIFS without setuids) get an unmanaged sentinel after a clean sweep so they don't re-sweep on every boot. * don't seed relative move translation from a status without position * disable relative movement when the camera doesn't report its position * stop at startup when the database location isn't writable The ownership sweep only covers /config and /media/frigate, so a database.path on another volume stayed root-owned after upgrading and Frigate boot-looped on a SQLite error. Frigate now checks the database directory and files before opening them and exits with an error naming the path, the runtime uid/gid, and the new docs section. backup.db is checked only when a migration is about to write it. * add note about explicit detect resolution * track where each camera's detect resolution came from The health tab's stream check told users to set the detect resolution whenever a probe returned no size, even when they had already set it, and a camera running on the 1280x720 fallback after a failed startup probe was never flagged unless the stream check was run by hand. The config now records whether the resolution came from the config, a startup probe, or the fallback, and /api/config exposes it per camera. The stream check skips the probe warning when the resolution is set, a camera on the fallback gets a detect settings warning that also shows on the health tab, and cloning detect from a fallback camera no longer copies the fallback size. * don't strip the fallback detect size when cloning * free tracker state when an object is deregistered deregister() removed the object from tracked_objects, disappeared and track_id_map but left its entries in positions, stationary_box_history and the stationary classifier's four per-object dicts, including a 96x96 anchor crop for every object that went stationary. Every object tracked since the camera process started stayed in memory. deregister() now pops those entries and calls a new StationaryMotionClassifier.forget() to clear the classifier's state. * avoid opencv path leak on recurring image writes OpenCV 4.11's Python bindings keep a reference to every path string passed to cv2.imwrite or cv2.imread (opencv/opencv#28047, fixed in 4.13, which needs numpy 2). Callers that write on every frame or event leaked one string per call for the life of the process, about 8 MB a day from preview frames on two cameras. New write_image and read_image helpers encode and decode in memory and do the file I/O through numpy, so OpenCV never sees the path. Preview frames, review and event thumbnails, face and classification training attempts, and the offline preview frame read now use them.
1425 lines
44 KiB
TypeScript
1425 lines
44 KiB
TypeScript
/**
|
|
* Health tab tests -- MEDIUM tier.
|
|
*
|
|
* Default tab, notice list rendering, acknowledge and mute, empty state,
|
|
* update notice.
|
|
*/
|
|
|
|
import { test, expect } from "../fixtures/frigate-test";
|
|
import { systemTab } from "../helpers/system-tabs";
|
|
import { viewerProfile } from "../fixtures/mock-data/profile";
|
|
|
|
const NOW = Math.floor(Date.now() / 1000);
|
|
|
|
// the fixture detector runs at 75.5 ms, above the live warning threshold
|
|
const QUIET_STATS = { detectors: { cpu: { inference_speed: 10 } } };
|
|
|
|
// the fixture has no go2rtc streams, which gives every camera a live view hint
|
|
const RESTREAMED = {
|
|
go2rtc: {
|
|
streams: {
|
|
front_door: ["rtsp://x"],
|
|
backyard: ["rtsp://x"],
|
|
garage: ["rtsp://x"],
|
|
},
|
|
},
|
|
};
|
|
|
|
const ERROR_NOTICE = {
|
|
id: "model_download_failed:yolo/model.onnx",
|
|
kind: "model_download_failed",
|
|
severity: "error",
|
|
category: "model",
|
|
scope: "yolo/model.onnx",
|
|
params: { file: "model.onnx", model: "yolo", error: "timeout" },
|
|
link: null,
|
|
first_seen: NOW - 600,
|
|
last_seen: NOW,
|
|
count: 2,
|
|
acknowledgeable: true,
|
|
acknowledged_at: null,
|
|
muted_at: null,
|
|
};
|
|
|
|
const EVENT_NOTICE = {
|
|
id: "detector_stuck",
|
|
kind: "detector_stuck",
|
|
severity: "warning",
|
|
category: "detector",
|
|
scope: null,
|
|
params: { detector: "ov" },
|
|
link: "/system#general",
|
|
first_seen: NOW - 7200,
|
|
last_seen: NOW - 60,
|
|
count: 3,
|
|
acknowledgeable: true,
|
|
acknowledged_at: null,
|
|
muted_at: null,
|
|
};
|
|
|
|
// a repeated device gets a '#2' suffix, which a raw URL would cut off as a fragment
|
|
const SUFFIXED_NOTICE = {
|
|
...EVENT_NOTICE,
|
|
id: "detector_stuck:openvino:GPU#2",
|
|
scope: "openvino:GPU#2",
|
|
params: { detector: "openvino:GPU#2" },
|
|
};
|
|
|
|
test.describe("System — Health tab @medium", () => {
|
|
test("Health is the default tab and lists notices by severity", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
config: RESTREAMED,
|
|
stats: QUIET_STATS,
|
|
notices: [ERROR_NOTICE, EVENT_NOTICE],
|
|
});
|
|
await frigateApp.goto("/system");
|
|
|
|
await expect(systemTab(frigateApp, "health")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 15_000 },
|
|
);
|
|
|
|
const rows = frigateApp.page.locator("[data-testid^='health-problem-']");
|
|
await expect(rows).toHaveCount(2);
|
|
await expect(rows.nth(0)).toHaveAttribute("data-severity", "error");
|
|
await expect(rows.nth(0)).toContainText(
|
|
"Downloading model.onnx for yolo failed: timeout",
|
|
);
|
|
await expect(rows.nth(0)).toContainText("2 times");
|
|
await expect(rows.nth(1)).toContainText("Detector ov was restarted");
|
|
await expect(rows.nth(1)).toContainText("3 times");
|
|
for (const index of [0, 1]) {
|
|
await expect(
|
|
rows.nth(index).getByRole("button", { name: "Acknowledge" }),
|
|
).toBeVisible();
|
|
await expect(
|
|
rows.nth(index).getByRole("button", { name: "Mute", exact: true }),
|
|
).toBeVisible();
|
|
}
|
|
});
|
|
|
|
for (const action of ["acknowledge", "mute"] as const) {
|
|
test(`${action} posts and removes the row`, async ({ frigateApp }) => {
|
|
const path = `/api/notices/${encodeURIComponent(SUFFIXED_NOTICE.id)}/${action}`;
|
|
await frigateApp.installDefaults({
|
|
config: RESTREAMED,
|
|
stats: QUIET_STATS,
|
|
notices: [SUFFIXED_NOTICE],
|
|
});
|
|
|
|
// the list shrinks after the POST so the refetch shows the row gone
|
|
let hidden = false;
|
|
await frigateApp.page.route("**/api/notices", (route) =>
|
|
route.fulfill({ json: hidden ? [] : [SUFFIXED_NOTICE] }),
|
|
);
|
|
await frigateApp.page.route(
|
|
(url) => url.pathname.endsWith(path),
|
|
(route) => {
|
|
hidden = true;
|
|
return route.fulfill({ json: { success: true } });
|
|
},
|
|
);
|
|
|
|
await frigateApp.goto("/system#health");
|
|
const request = frigateApp.page.waitForRequest(
|
|
(req) =>
|
|
new URL(req.url()).pathname.endsWith(path) && req.method() === "POST",
|
|
);
|
|
await frigateApp.page
|
|
.getByTestId(`health-problem-notice:${SUFFIXED_NOTICE.id}`)
|
|
.getByRole("button", {
|
|
name: action === "mute" ? "Mute" : "Acknowledge",
|
|
exact: true,
|
|
})
|
|
.click();
|
|
await request;
|
|
|
|
await expect(
|
|
frigateApp.page.locator("[data-testid^='health-problem-']"),
|
|
).toHaveCount(0, { timeout: 5_000 });
|
|
await expect(
|
|
frigateApp.page.getByText("Your Frigate installation is healthy"),
|
|
).toBeVisible();
|
|
});
|
|
}
|
|
|
|
test("empty state with no notices", async ({ frigateApp }) => {
|
|
await frigateApp.installDefaults({
|
|
config: RESTREAMED,
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
await expect(
|
|
frigateApp.page.getByText("Your Frigate installation is healthy"),
|
|
).toBeVisible({
|
|
timeout: 15_000,
|
|
});
|
|
});
|
|
|
|
test("update notice renders as info with a release link", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
stats: QUIET_STATS,
|
|
notices: [
|
|
{
|
|
id: "update_available:0.19.0",
|
|
kind: "update_available",
|
|
severity: "info",
|
|
category: "system",
|
|
scope: "0.19.0",
|
|
params: { version: "0.19.0" },
|
|
link: "https://github.com/blakeblackshear/frigate/releases/tag/v0.19.0",
|
|
first_seen: NOW - 3600,
|
|
last_seen: NOW,
|
|
count: 1,
|
|
acknowledgeable: false,
|
|
acknowledged_at: null,
|
|
muted_at: null,
|
|
},
|
|
],
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId(
|
|
"health-problem-notice:update_available:0.19.0",
|
|
);
|
|
await expect(row).toBeVisible({ timeout: 15_000 });
|
|
await expect(row).toHaveAttribute("data-severity", "info");
|
|
await expect(row).toContainText("Frigate 0.19.0 is available");
|
|
await expect(row.getByRole("link", { name: "Open link" })).toHaveAttribute(
|
|
"href",
|
|
"https://github.com/blakeblackshear/frigate/releases/tag/v0.19.0",
|
|
);
|
|
await expect(
|
|
row.getByRole("button", { name: "Mute", exact: true }),
|
|
).toBeVisible();
|
|
await expect(row.getByRole("button", { name: "Acknowledge" })).toHaveCount(
|
|
0,
|
|
);
|
|
});
|
|
|
|
const ACKNOWLEDGED_NOTICE = {
|
|
...EVENT_NOTICE,
|
|
id: "detector_stuck:coral",
|
|
params: { detector: "coral" },
|
|
acknowledged_at: NOW - 60,
|
|
};
|
|
const MUTED_NOTICE = { ...ERROR_NOTICE, muted_at: NOW - 120 };
|
|
|
|
test("the filter shows hidden notices marked by how they were hidden", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
stats: QUIET_STATS,
|
|
notices: [EVENT_NOTICE],
|
|
});
|
|
await frigateApp.page.route(
|
|
(url) =>
|
|
url.pathname.endsWith("/api/notices") &&
|
|
url.searchParams.get("include_hidden") === "true",
|
|
(route) =>
|
|
route.fulfill({
|
|
json: [EVENT_NOTICE, ACKNOWLEDGED_NOTICE, MUTED_NOTICE],
|
|
}),
|
|
);
|
|
await frigateApp.goto("/system#health");
|
|
|
|
await frigateApp.page.getByRole("button", { name: "Filter" }).click();
|
|
const showHidden = frigateApp.page.getByRole("switch", {
|
|
name: "Show hidden",
|
|
});
|
|
await expect(showHidden).toHaveAttribute("aria-checked", "false");
|
|
await showHidden.click();
|
|
// mobile opens the filter as a modal drawer, which hides the rows' roles
|
|
await frigateApp.page.keyboard.press("Escape");
|
|
|
|
const acknowledged = frigateApp.page.getByTestId(
|
|
"health-problem-notice:detector_stuck:coral",
|
|
);
|
|
await expect(acknowledged).toBeVisible({ timeout: 15_000 });
|
|
await expect(acknowledged).toContainText("Acknowledged");
|
|
await expect(
|
|
acknowledged.getByRole("button", { name: "Show again" }),
|
|
).toBeVisible();
|
|
await expect(
|
|
acknowledged.getByRole("button", { name: "Acknowledge" }),
|
|
).toHaveCount(0);
|
|
|
|
const muted = frigateApp.page.getByTestId(
|
|
"health-problem-notice:model_download_failed:yolo/model.onnx",
|
|
);
|
|
await expect(muted).toContainText("Muted");
|
|
await expect(muted.getByRole("button", { name: "Unmute" })).toBeVisible();
|
|
await expect(
|
|
muted.getByRole("button", { name: "Mute", exact: true }),
|
|
).toHaveCount(0);
|
|
|
|
await frigateApp.page.getByRole("button", { name: "Filter" }).click();
|
|
await showHidden.click();
|
|
await expect(muted).toHaveCount(0);
|
|
});
|
|
|
|
test("unmute deletes the row's hidden state", async ({ frigateApp }) => {
|
|
await frigateApp.installDefaults({ stats: QUIET_STATS, notices: [] });
|
|
await frigateApp.page.route(
|
|
(url) =>
|
|
url.pathname.endsWith("/api/notices") &&
|
|
url.searchParams.get("include_hidden") === "true",
|
|
(route) => route.fulfill({ json: [MUTED_NOTICE] }),
|
|
);
|
|
const path = `/api/notices/${encodeURIComponent(MUTED_NOTICE.id)}/hidden`;
|
|
await frigateApp.page.route(
|
|
(url) => url.pathname.endsWith(path),
|
|
(route) => route.fulfill({ json: { success: true } }),
|
|
);
|
|
await frigateApp.goto("/system#health");
|
|
|
|
await frigateApp.page.getByRole("button", { name: "Filter" }).click();
|
|
await frigateApp.page.getByRole("switch", { name: "Show hidden" }).click();
|
|
await frigateApp.page.keyboard.press("Escape");
|
|
|
|
const request = frigateApp.page.waitForRequest(
|
|
(req) =>
|
|
new URL(req.url()).pathname.endsWith(path) && req.method() === "DELETE",
|
|
);
|
|
await frigateApp.page
|
|
.getByTestId(
|
|
"health-problem-notice:model_download_failed:yolo/model.onnx",
|
|
)
|
|
.getByRole("button", { name: "Unmute" })
|
|
.click({ timeout: 15_000 });
|
|
await request;
|
|
});
|
|
|
|
test("show all again unhides every row after confirming", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
stats: QUIET_STATS,
|
|
notices: [EVENT_NOTICE],
|
|
});
|
|
|
|
// the hidden list loses its muted row once the DELETE lands
|
|
let cleared = false;
|
|
await frigateApp.page.route(
|
|
(url) =>
|
|
url.pathname.endsWith("/api/notices") &&
|
|
url.searchParams.get("include_hidden") === "true",
|
|
(route) =>
|
|
route.fulfill({
|
|
json: cleared ? [EVENT_NOTICE] : [EVENT_NOTICE, MUTED_NOTICE],
|
|
}),
|
|
);
|
|
await frigateApp.page.route("**/api/notices/hidden", (route) => {
|
|
cleared = true;
|
|
return route.fulfill({ json: { success: true } });
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
await frigateApp.page.getByRole("button", { name: "Filter" }).click();
|
|
await frigateApp.page.getByRole("switch", { name: "Show hidden" }).click();
|
|
const row = frigateApp.page.getByTestId(
|
|
"health-problem-notice:model_download_failed:yolo/model.onnx",
|
|
);
|
|
await expect(row).toBeVisible({ timeout: 15_000 });
|
|
await frigateApp.page.keyboard.press("Escape");
|
|
|
|
await frigateApp.page
|
|
.getByRole("button", { name: "Show all again" })
|
|
.click();
|
|
const request = frigateApp.page.waitForRequest(
|
|
(req) =>
|
|
req.url().endsWith("/api/notices/hidden") && req.method() === "DELETE",
|
|
);
|
|
await frigateApp.page
|
|
.getByRole("alertdialog")
|
|
.getByRole("button", { name: "Show all again" })
|
|
.click();
|
|
await request;
|
|
|
|
await expect(row).toHaveCount(0);
|
|
await expect(frigateApp.page.getByText("No hidden notices")).toBeVisible();
|
|
});
|
|
|
|
test("severity switches hide notices of that severity", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
config: RESTREAMED,
|
|
stats: QUIET_STATS,
|
|
notices: [ERROR_NOTICE, EVENT_NOTICE],
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const rows = frigateApp.page.locator("[data-testid^='health-problem-']");
|
|
await expect(rows).toHaveCount(2, { timeout: 15_000 });
|
|
|
|
await frigateApp.page.getByRole("button", { name: "Filter" }).click();
|
|
await frigateApp.page.getByRole("switch", { name: "Warning" }).click();
|
|
await expect(rows).toHaveCount(1);
|
|
await expect(rows.first()).toHaveAttribute("data-severity", "error");
|
|
|
|
await frigateApp.page.getByRole("switch", { name: "Error" }).click();
|
|
await expect(rows).toHaveCount(0);
|
|
await expect(
|
|
frigateApp.page.getByText("No notices match the filter"),
|
|
).toBeVisible();
|
|
});
|
|
|
|
test("failed login bursts are per user and show their attempt count", async ({
|
|
frigateApp,
|
|
}) => {
|
|
const burst = (user: string, start: number, count: number) => ({
|
|
id: `failed_login:${user}:${start}`,
|
|
kind: "failed_login",
|
|
severity: "warning",
|
|
category: "system",
|
|
scope: `${user}:${start}`,
|
|
params: { user },
|
|
link: "/logs",
|
|
first_seen: start,
|
|
last_seen: start + 60,
|
|
count,
|
|
acknowledgeable: true,
|
|
acknowledged_at: null,
|
|
muted_at: null,
|
|
});
|
|
await frigateApp.installDefaults({
|
|
stats: QUIET_STATS,
|
|
notices: [burst("admin", NOW - 60, 7), burst("ghost", NOW - 3600, 1)],
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const attack = frigateApp.page.getByTestId(
|
|
`health-problem-notice:failed_login:admin:${NOW - 60}`,
|
|
);
|
|
await expect(attack).toBeVisible({ timeout: 15_000 });
|
|
await expect(attack).toContainText("Failed login attempts for admin");
|
|
await expect(attack).toContainText("7 times");
|
|
await expect(attack).not.toContainText(String(NOW - 60));
|
|
await expect(
|
|
attack.getByRole("link", { name: "Open settings" }),
|
|
).toHaveAttribute("href", "/logs");
|
|
await expect(
|
|
frigateApp.page.getByTestId(
|
|
`health-problem-notice:failed_login:ghost:${NOW - 3600}`,
|
|
),
|
|
).toContainText("Failed login attempt for ghost");
|
|
});
|
|
|
|
test("skipped detections notice links to camera stats", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
stats: QUIET_STATS,
|
|
notices: [
|
|
{
|
|
id: "skipped_detections:front_door",
|
|
kind: "skipped_detections",
|
|
severity: "warning",
|
|
category: "camera",
|
|
scope: "front_door",
|
|
params: { pct: 12.5 },
|
|
link: "/system#cameras",
|
|
first_seen: NOW - 600,
|
|
last_seen: NOW - 600,
|
|
count: 1,
|
|
acknowledgeable: true,
|
|
acknowledged_at: null,
|
|
muted_at: null,
|
|
},
|
|
],
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId(
|
|
"health-problem-notice:skipped_detections:front_door",
|
|
);
|
|
await expect(row).toBeVisible({ timeout: 15_000 });
|
|
await expect(row).toContainText("skipped 12.5% of frames");
|
|
await expect(
|
|
row.getByRole("link", { name: "Open settings" }),
|
|
).toHaveAttribute("href", "/system#cameras");
|
|
});
|
|
|
|
test("shm notice links to storage metrics", async ({ frigateApp }) => {
|
|
await frigateApp.installDefaults({
|
|
stats: QUIET_STATS,
|
|
notices: [
|
|
{
|
|
id: "shm_too_low",
|
|
kind: "shm_too_low",
|
|
severity: "warning",
|
|
category: "system",
|
|
scope: null,
|
|
params: { total: 64, min: 180 },
|
|
link: "/system#storage",
|
|
first_seen: NOW - 600,
|
|
last_seen: NOW - 600,
|
|
count: 1,
|
|
acknowledgeable: true,
|
|
acknowledged_at: null,
|
|
muted_at: null,
|
|
},
|
|
],
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId(
|
|
"health-problem-notice:shm_too_low",
|
|
);
|
|
await expect(row).toBeVisible({ timeout: 15_000 });
|
|
await expect(row).toContainText(
|
|
"/dev/shm allocation (64 MB) should be increased to at least 180 MB",
|
|
);
|
|
await expect(
|
|
row.getByRole("link", { name: "Open settings" }),
|
|
).toHaveAttribute("href", "/system#storage");
|
|
});
|
|
});
|
|
|
|
test.describe("System — Health tab mobile @medium @mobile", () => {
|
|
test.skip(({ frigateApp }) => !frigateApp.isMobile, "Mobile-only");
|
|
|
|
test("notices render at mobile viewport", async ({ frigateApp }) => {
|
|
await frigateApp.installDefaults({
|
|
stats: QUIET_STATS,
|
|
notices: [ERROR_NOTICE],
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
await expect(
|
|
frigateApp.page.getByTestId(
|
|
"health-problem-notice:model_download_failed:yolo/model.onnx",
|
|
),
|
|
).toBeVisible({ timeout: 15_000 });
|
|
});
|
|
});
|
|
|
|
test.describe("System — Health hardware pane @medium", () => {
|
|
test("detection row is ok with matching probe and fast inference", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
config: { models: [{ scene: "default", devices: ["openvino:GPU"] }] },
|
|
stats: {
|
|
...QUIET_STATS,
|
|
detectors: { "openvino:GPU": { inference_speed: 12.3 } },
|
|
},
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId("hardware-row-detection:0");
|
|
await expect(row).toHaveAttribute("data-state", "ok", { timeout: 15_000 });
|
|
await expect(row).toContainText("12.3 ms");
|
|
});
|
|
|
|
test("detection row errors when the device is not probed", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
config: { models: [{ scene: "default", devices: ["hailo"] }] },
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId("hardware-row-detection:0");
|
|
await expect(row).toHaveAttribute("data-state", "error", {
|
|
timeout: 15_000,
|
|
});
|
|
await expect(row).toContainText("hailo was not found on this system");
|
|
});
|
|
|
|
test("a generic device the probe cannot enumerate is judged by its runtime", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
config: { models: [{ scene: "default", devices: ["openvino:AUTO"] }] },
|
|
stats: {
|
|
...QUIET_STATS,
|
|
detectors: { "openvino:AUTO": { inference_speed: 12 } },
|
|
},
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId("hardware-row-detection:0");
|
|
await expect(row).toHaveAttribute("data-state", "ok", {
|
|
timeout: 15_000,
|
|
});
|
|
await expect(row).toContainText("12 ms");
|
|
});
|
|
|
|
test("a bare onnx detector with no probed accelerator is not an error", async ({
|
|
frigateApp,
|
|
}) => {
|
|
// the default image runs onnx on the CPU and the probe reports nothing
|
|
await frigateApp.installDefaults({
|
|
config: { models: [{ scene: "default", devices: ["onnx"] }] },
|
|
stats: { ...QUIET_STATS, detectors: { onnx: { inference_speed: 40 } } },
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId("hardware-row-detection:0");
|
|
await expect(row).toHaveAttribute("data-state", "ok", {
|
|
timeout: 15_000,
|
|
});
|
|
});
|
|
|
|
test("detection row warns on slow inference", async ({ frigateApp }) => {
|
|
await frigateApp.installDefaults({
|
|
config: { models: [{ scene: "default", devices: ["openvino:GPU"] }] },
|
|
stats: {
|
|
...QUIET_STATS,
|
|
detectors: { "openvino:GPU": { inference_speed: 60 } },
|
|
},
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId("hardware-row-detection:0");
|
|
await expect(row).toHaveAttribute("data-state", "warning", {
|
|
timeout: 15_000,
|
|
});
|
|
await expect(row).toContainText("Inference is slow (60 ms)");
|
|
});
|
|
|
|
test("hwaccel row states", async ({ frigateApp }) => {
|
|
await frigateApp.installDefaults({
|
|
config: {
|
|
cameras: {
|
|
front_door: { ffmpeg: { hwaccel_args: "preset-vaapi" } },
|
|
backyard: { ffmpeg: { hwaccel_args: "preset-nvidia" } },
|
|
garage: { ffmpeg: { hwaccel_args: "" } },
|
|
},
|
|
},
|
|
hwaccel: {
|
|
recommended: "vaapi",
|
|
available: [{ key: "vaapi", presets: { any: "preset-vaapi" } }],
|
|
},
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
await expect(
|
|
frigateApp.page.getByTestId("hardware-row-hwaccel:preset-vaapi"),
|
|
).toHaveAttribute("data-state", "ok", { timeout: 15_000 });
|
|
await expect(
|
|
frigateApp.page.getByTestId("hardware-row-hwaccel:preset-nvidia"),
|
|
).toHaveAttribute("data-state", "warning");
|
|
await expect(
|
|
frigateApp.page.getByTestId("hardware-row-hwaccel:preset-nvidia"),
|
|
).toContainText("the hardware probe did not report it");
|
|
await expect(
|
|
frigateApp.page.getByTestId("hardware-row-hwaccel:"),
|
|
).toHaveAttribute("data-state", "warning");
|
|
});
|
|
|
|
test("slow face recognition on the CPU warns when an accelerator exists", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
config: { face_recognition: { enabled: true } },
|
|
stats: {
|
|
...QUIET_STATS,
|
|
embeddings: {
|
|
face_recognition_speed: 800,
|
|
devices: { face_recognition: "CPU" },
|
|
},
|
|
},
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId(
|
|
"hardware-row-enrichment:face_recognition",
|
|
);
|
|
await expect(row).toHaveAttribute("data-state", "warning", {
|
|
timeout: 15_000,
|
|
});
|
|
await expect(row).toContainText(
|
|
"Running on the CPU although an accelerator is available",
|
|
);
|
|
});
|
|
|
|
test("fast face recognition on the CPU is ok", async ({ frigateApp }) => {
|
|
await frigateApp.installDefaults({
|
|
config: { face_recognition: { enabled: true } },
|
|
stats: {
|
|
...QUIET_STATS,
|
|
embeddings: {
|
|
face_recognition_speed: 40,
|
|
devices: { face_recognition: "CPU" },
|
|
},
|
|
},
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId(
|
|
"hardware-row-enrichment:face_recognition",
|
|
);
|
|
await expect(row).toHaveAttribute("data-state", "ok", { timeout: 15_000 });
|
|
await expect(row).toContainText("CPU");
|
|
await expect(row).not.toContainText("although an accelerator");
|
|
});
|
|
|
|
test("explicit GPU that loaded on CUDA is ok despite the probe", async ({
|
|
frigateApp,
|
|
}) => {
|
|
// the fixture probes an Intel GPU only; ONNX Runtime still puts a GPU
|
|
// request on CUDA when that image has it
|
|
await frigateApp.installDefaults({
|
|
config: { face_recognition: { enabled: true, device: "GPU" } },
|
|
stats: {
|
|
...QUIET_STATS,
|
|
embeddings: { devices: { face_recognition: "CUDA" } },
|
|
},
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId(
|
|
"hardware-row-enrichment:face_recognition",
|
|
);
|
|
await expect(row).toHaveAttribute("data-state", "ok", { timeout: 15_000 });
|
|
await expect(row).toContainText("CUDA");
|
|
});
|
|
|
|
test("explicit GPU falling back to CPU is an error", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
config: { face_recognition: { enabled: true, device: "GPU" } },
|
|
stats: {
|
|
...QUIET_STATS,
|
|
embeddings: { devices: { face_recognition: "CPU" } },
|
|
},
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId(
|
|
"hardware-row-enrichment:face_recognition",
|
|
);
|
|
await expect(row).toHaveAttribute("data-state", "error", {
|
|
timeout: 15_000,
|
|
});
|
|
});
|
|
|
|
test("enrichment without a runtime device is unknown", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
config: { face_recognition: { enabled: true } },
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId(
|
|
"hardware-row-enrichment:face_recognition",
|
|
);
|
|
await expect(row).toHaveAttribute("data-state", "unknown", {
|
|
timeout: 15_000,
|
|
});
|
|
});
|
|
|
|
test("all-excellent camera connections show a green check", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({ stats: QUIET_STATS });
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const line = frigateApp.page.getByText(
|
|
"All cameras have an excellent connection.",
|
|
);
|
|
await expect(line).toBeVisible({ timeout: 15_000 });
|
|
await expect(line.locator("svg")).toHaveClass(/text-success/);
|
|
});
|
|
|
|
test("camera connections lists only non-excellent cameras", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
stats: {
|
|
...QUIET_STATS,
|
|
cameras: {
|
|
backyard: { connection_quality: "poor", camera_fps: 2.1 },
|
|
},
|
|
},
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
await expect(
|
|
frigateApp.page.getByTestId("camera-connection-backyard"),
|
|
).toBeVisible({ timeout: 15_000 });
|
|
await expect(
|
|
frigateApp.page.getByTestId("camera-connection-front_door"),
|
|
).toHaveCount(0);
|
|
});
|
|
});
|
|
|
|
test.describe("System — Health notices sources @medium", () => {
|
|
test("config checks render with links", async ({ frigateApp }) => {
|
|
await frigateApp.installDefaults({
|
|
config: {
|
|
cameras: {
|
|
garage: { detect: { width: 2560, height: 1440, fps: 10 } },
|
|
},
|
|
},
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
await expect(
|
|
frigateApp.page.getByText(
|
|
"This detect resolution is higher than recommended",
|
|
),
|
|
).toBeVisible({ timeout: 15_000 });
|
|
const fpsRow = frigateApp.page.getByTestId(
|
|
"health-problem-config:detect:fps-greater-than-five:camera.garage",
|
|
);
|
|
await expect(fpsRow).toHaveAttribute("data-severity", "info");
|
|
await expect(
|
|
fpsRow.getByRole("link", { name: "Open settings" }),
|
|
).toHaveAttribute("href", "/settings?page=cameraDetect&camera=garage");
|
|
});
|
|
|
|
test("status bar problems stay out of the list", async ({ frigateApp }) => {
|
|
test.skip(frigateApp.isMobile, "Status bar is desktop-only");
|
|
await frigateApp.installDefaults({
|
|
config: RESTREAMED,
|
|
stats: {
|
|
service: { retention_unmet: true },
|
|
cameras: { front_door: { camera_fps: 0 } },
|
|
},
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
// the status bar shows a problem, so stats have loaded
|
|
await expect(
|
|
frigateApp.page.getByText("Recordings are being deleted"),
|
|
).toBeVisible({ timeout: 15_000 });
|
|
await expect(
|
|
frigateApp.page.locator("[data-testid^='health-problem-']"),
|
|
).toHaveCount(0);
|
|
await expect(
|
|
frigateApp.page.getByText("Your Frigate installation is healthy"),
|
|
).toBeVisible();
|
|
});
|
|
|
|
// the fixture's cameras all have a record role with recording off, so
|
|
// dropping the role isolates the gate on record.enabled
|
|
const NO_RECORD_ROLE = {
|
|
ffmpeg: { inputs: [{ path: "rtsp://x", roles: ["detect"] }] },
|
|
};
|
|
|
|
test("record role warning is hidden while recording is off", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
config: {
|
|
cameras: {
|
|
front_door: { ...NO_RECORD_ROLE, record: { enabled: false } },
|
|
},
|
|
},
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
await expect(systemTab(frigateApp, "health")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 15_000 },
|
|
);
|
|
await expect(
|
|
frigateApp.page.getByText("No streams have the record role defined"),
|
|
).toHaveCount(0);
|
|
});
|
|
|
|
test("record role warning shows once recording is on", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
config: {
|
|
cameras: {
|
|
front_door: { ...NO_RECORD_ROLE, record: { enabled: true } },
|
|
},
|
|
},
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
await expect(
|
|
frigateApp.page.getByText("No streams have the record role defined"),
|
|
).toBeVisible({ timeout: 15_000 });
|
|
});
|
|
|
|
test("a camera without a go2rtc stream gets a live view hint", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
config: { go2rtc: { streams: { front_door: ["rtsp://x"] } } },
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId(
|
|
"health-problem-config:live:no-go2rtc-stream:camera.backyard",
|
|
);
|
|
await expect(row).toBeVisible({ timeout: 15_000 });
|
|
await expect(row).toHaveAttribute("data-severity", "info");
|
|
await expect(row).toContainText("lower frame rate and no audio");
|
|
await expect(
|
|
frigateApp.page.getByTestId(
|
|
"health-problem-config:live:no-go2rtc-stream:camera.front_door",
|
|
),
|
|
).toHaveCount(0);
|
|
});
|
|
|
|
test("a global config problem is not repeated per camera", async ({
|
|
frigateApp,
|
|
}) => {
|
|
// every fixture camera inherits the global size, with resolved defaults
|
|
// the global block leaves null, so only text equality can dedupe them
|
|
const size = { width: 2560, height: 1440 };
|
|
await frigateApp.installDefaults({
|
|
config: {
|
|
detect: size,
|
|
cameras: {
|
|
front_door: { detect: size },
|
|
backyard: { detect: size },
|
|
garage: { detect: size },
|
|
},
|
|
},
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const rows = frigateApp.page.locator(
|
|
"[data-testid^='health-problem-config:detect:detect-resolution-high']",
|
|
);
|
|
await expect(rows.first()).toBeVisible({ timeout: 15_000 });
|
|
await expect(rows).toHaveCount(1);
|
|
await expect(rows.first()).toHaveAttribute(
|
|
"data-testid",
|
|
"health-problem-config:detect:detect-resolution-high:global",
|
|
);
|
|
});
|
|
|
|
test("a camera that overrides the global value keeps its own row", async ({
|
|
frigateApp,
|
|
}) => {
|
|
// two cameras inherit the global size and are folded into the global
|
|
// row; the one that overrides it keeps a row with its own link
|
|
const size = { width: 2560, height: 1440 };
|
|
await frigateApp.installDefaults({
|
|
config: {
|
|
detect: size,
|
|
cameras: {
|
|
front_door: { detect: size },
|
|
backyard: { detect: size },
|
|
garage: { detect: { width: 3840, height: 2160 } },
|
|
},
|
|
},
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const rows = frigateApp.page.locator(
|
|
"[data-testid^='health-problem-config:detect:detect-resolution-high']",
|
|
);
|
|
await expect(rows.first()).toBeVisible({ timeout: 15_000 });
|
|
await expect(rows).toHaveCount(2);
|
|
await expect(
|
|
frigateApp.page.getByTestId(
|
|
"health-problem-config:detect:detect-resolution-high:camera.garage",
|
|
),
|
|
).toBeVisible();
|
|
});
|
|
|
|
test("empty state when stats, config, and registry are clean", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
config: RESTREAMED,
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
await expect(
|
|
frigateApp.page.getByText("Your Frigate installation is healthy"),
|
|
).toBeVisible({
|
|
timeout: 15_000,
|
|
});
|
|
await expect(
|
|
frigateApp.page.locator("[data-testid^='health-problem-']"),
|
|
).toHaveCount(0);
|
|
});
|
|
|
|
test("stream checks probe every camera and flag non-AAC audio", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
// the default record preset transcodes to AAC, so the codec only
|
|
// matters for a camera that copies audio through
|
|
config: {
|
|
cameras: {
|
|
backyard: {
|
|
ffmpeg: {
|
|
output_args: { record: "preset-record-generic-audio-copy" },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
ffprobe: {
|
|
backyard: [
|
|
{
|
|
return_code: 0,
|
|
stderr: "",
|
|
stdout: {
|
|
streams: [
|
|
{
|
|
codec_type: "video",
|
|
codec_name: "h264",
|
|
width: 1920,
|
|
height: 1080,
|
|
},
|
|
{ codec_type: "audio", codec_name: "pcm_mulaw" },
|
|
],
|
|
},
|
|
},
|
|
],
|
|
garage: [
|
|
{
|
|
return_code: 1,
|
|
// the backend sends every line; the tab shows the last one
|
|
stderr: [
|
|
"[tcp @ 0x1] Connection to tcp://10.0.0.3:554 failed",
|
|
"Connection refused",
|
|
],
|
|
stdout: "",
|
|
},
|
|
],
|
|
},
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const requests: string[] = [];
|
|
frigateApp.page.on("request", (req) => {
|
|
if (req.url().includes("/api/ffprobe")) {
|
|
requests.push(req.url());
|
|
}
|
|
});
|
|
|
|
await frigateApp.page
|
|
.getByRole("button", { name: "Run stream checks" })
|
|
.click();
|
|
|
|
await expect(
|
|
frigateApp.page.getByText("Stream 1: The AAC audio codec is required"),
|
|
).toBeVisible({ timeout: 15_000 });
|
|
await expect(
|
|
frigateApp.page.getByText(
|
|
"Stream 1 could not be probed: Connection refused",
|
|
),
|
|
).toBeVisible();
|
|
const streams = frigateApp.page.getByTestId("camera-streams");
|
|
await expect(streams).toContainText("3 cameras checked");
|
|
await expect(streams).toContainText("2 with problems");
|
|
await expect(frigateApp.page.getByText(/^Checked/)).toBeVisible();
|
|
await expect(
|
|
frigateApp.page.getByRole("button", { name: "Run again" }),
|
|
).toBeVisible();
|
|
// axios leaves ":" unescaped in query strings
|
|
expect(requests.filter((u) => u.includes("paths=camera:")).length).toBe(3);
|
|
});
|
|
|
|
test("non-AAC audio is fine when recordings transcode to AAC", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
ffprobe: {
|
|
backyard: [
|
|
{
|
|
return_code: 0,
|
|
stderr: "",
|
|
stdout: {
|
|
streams: [
|
|
{
|
|
codec_type: "video",
|
|
codec_name: "h264",
|
|
width: 1920,
|
|
height: 1080,
|
|
},
|
|
{ codec_type: "audio", codec_name: "pcm_mulaw" },
|
|
],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
await frigateApp.page
|
|
.getByRole("button", { name: "Run stream checks" })
|
|
.click();
|
|
|
|
await expect(frigateApp.page.getByText(/^Checked/)).toBeVisible({
|
|
timeout: 15_000,
|
|
});
|
|
await expect(
|
|
frigateApp.page.getByText("The AAC audio codec is required"),
|
|
).toHaveCount(0);
|
|
});
|
|
|
|
test("a camera on the fallback detect resolution is flagged", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
config: { cameras: { garage: { detect_resolution_source: "default" } } },
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId(
|
|
"health-problem-config:detect:detect-resolution-not-probed:camera.garage",
|
|
);
|
|
await expect(row).toBeVisible({ timeout: 15_000 });
|
|
await expect(row).toHaveAttribute("data-severity", "warning");
|
|
await expect(
|
|
frigateApp.page.getByTestId(
|
|
"health-problem-config:detect:detect-resolution-not-probed:camera.front_door",
|
|
),
|
|
).toHaveCount(0);
|
|
});
|
|
|
|
test("an unprobeable resolution is only flagged when Frigate must probe it", async ({
|
|
frigateApp,
|
|
}) => {
|
|
const noSize = [
|
|
{
|
|
return_code: 0,
|
|
stderr: "",
|
|
stdout: {
|
|
streams: [
|
|
{ codec_type: "video", codec_name: "h264" },
|
|
{ codec_type: "audio", codec_name: "aac" },
|
|
],
|
|
},
|
|
},
|
|
];
|
|
await frigateApp.installDefaults({
|
|
config: {
|
|
cameras: {
|
|
backyard: { detect_resolution_source: "probed" },
|
|
front_door: { detect_resolution_source: "default" },
|
|
},
|
|
},
|
|
ffprobe: { backyard: noSize, front_door: noSize, garage: noSize },
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
await frigateApp.page
|
|
.getByRole("button", { name: "Run stream checks" })
|
|
.click();
|
|
|
|
await expect(
|
|
frigateApp.page.getByTestId(
|
|
"health-problem-stream:backyard:0:resolution-unknown",
|
|
),
|
|
).toBeVisible({ timeout: 15_000 });
|
|
await expect(
|
|
frigateApp.page.getByTestId(
|
|
"health-problem-stream:garage:0:resolution-unknown",
|
|
),
|
|
).toHaveCount(0);
|
|
// the startup probe's own row already covers this camera
|
|
await expect(
|
|
frigateApp.page.getByTestId(
|
|
"health-problem-stream:front_door:0:resolution-unknown",
|
|
),
|
|
).toHaveCount(0);
|
|
});
|
|
|
|
test("wizard-only Reolink advice stays off the tab", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({
|
|
config: {
|
|
cameras: {
|
|
front_door: {
|
|
ffmpeg: {
|
|
inputs: [
|
|
{
|
|
path: "rtsp://10.0.0.1:554/h264Preview_01_main",
|
|
roles: ["detect", "record"],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
await frigateApp.page
|
|
.getByRole("button", { name: "Run stream checks" })
|
|
.click();
|
|
|
|
await expect(frigateApp.page.getByText(/^Checked/)).toBeVisible({
|
|
timeout: 15_000,
|
|
});
|
|
await expect(
|
|
frigateApp.page.getByText("Reolink RTSP is not recommended"),
|
|
).toHaveCount(0);
|
|
});
|
|
|
|
test("re-check re-probes the hardware and dates the probe", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.installDefaults({ stats: QUIET_STATS });
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const probes: string[] = [];
|
|
frigateApp.page.on("request", (req) => {
|
|
if (req.url().includes("refresh=true")) {
|
|
probes.push(req.url());
|
|
}
|
|
});
|
|
|
|
const recheck = frigateApp.page.getByRole("button", {
|
|
name: "Re-check hardware",
|
|
});
|
|
await expect(recheck).toBeVisible({ timeout: 15_000 });
|
|
await expect(frigateApp.page.getByText(/^Probed/)).toHaveCount(0);
|
|
await recheck.click();
|
|
await expect(frigateApp.page.getByText(/^Probed/)).toBeVisible();
|
|
await expect(recheck).toBeEnabled();
|
|
expect(probes.length).toBe(1);
|
|
});
|
|
|
|
test("a camera notice link opens that camera's settings page", async ({
|
|
frigateApp,
|
|
}) => {
|
|
// garage is not the camera Settings would pick on its own, so a wrong
|
|
// selection here is visible rather than accidentally right
|
|
await frigateApp.installDefaults({
|
|
config: {
|
|
lpr: { enabled: false },
|
|
cameras: { garage: { lpr: { enabled: true } } },
|
|
},
|
|
stats: QUIET_STATS,
|
|
});
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId(
|
|
"health-problem-config:lpr:global-disabled:camera.garage",
|
|
);
|
|
await expect(row).toBeVisible({ timeout: 15_000 });
|
|
await expect(
|
|
row.getByRole("link", { name: "Open settings" }),
|
|
).toHaveAttribute("href", "/settings?page=cameraLpr&camera=garage");
|
|
|
|
await row.getByRole("link", { name: "Open settings" }).click();
|
|
|
|
await expect(frigateApp.page.getByLabel("Select a camera")).toContainText(
|
|
"Garage",
|
|
{ timeout: 15_000 },
|
|
);
|
|
});
|
|
|
|
test("status bar healthy text links to the Health tab", async ({
|
|
frigateApp,
|
|
}) => {
|
|
test.skip(frigateApp.isMobile, "Status bar is desktop-only");
|
|
await frigateApp.installDefaults({ stats: QUIET_STATS });
|
|
await frigateApp.goto("/");
|
|
|
|
await frigateApp.page
|
|
.getByRole("link", { name: "System is healthy" })
|
|
.click();
|
|
await expect(frigateApp.page).toHaveURL(/\/system#health/);
|
|
});
|
|
|
|
test("status bar counts shown notices next to the health text", async ({
|
|
frigateApp,
|
|
}) => {
|
|
test.skip(frigateApp.isMobile, "Status bar is desktop-only");
|
|
await frigateApp.installDefaults({
|
|
config: RESTREAMED,
|
|
stats: QUIET_STATS,
|
|
notices: [EVENT_NOTICE],
|
|
});
|
|
await frigateApp.goto("/");
|
|
|
|
const notices = frigateApp.page.getByRole("link", {
|
|
name: "1 system notice",
|
|
});
|
|
await expect(notices).toBeVisible({ timeout: 15_000 });
|
|
await expect(notices).toHaveAttribute("href", "/system#health");
|
|
await expect(
|
|
frigateApp.page.getByRole("link", { name: "System is healthy" }),
|
|
).toBeVisible();
|
|
});
|
|
|
|
test("status bar shows viewers no problems or health text", async ({
|
|
frigateApp,
|
|
}) => {
|
|
test.skip(frigateApp.isMobile, "Status bar is desktop-only");
|
|
await frigateApp.installDefaults({
|
|
profile: viewerProfile(),
|
|
stats: {
|
|
cpu_usages: { "frigate.full_system": { cpu: "12.0" } },
|
|
cameras: { front_door: { camera_fps: 0 } },
|
|
},
|
|
});
|
|
await frigateApp.goto("/");
|
|
|
|
// the CPU reading comes from the same stats as the offline problem
|
|
await expect(frigateApp.page.getByText("CPU 12%")).toBeVisible({
|
|
timeout: 15_000,
|
|
});
|
|
await expect(
|
|
frigateApp.page.getByText("Front Door is offline"),
|
|
).toHaveCount(0);
|
|
await expect(frigateApp.page.getByText("System is healthy")).toHaveCount(0);
|
|
});
|
|
|
|
// the slow detector warning is added before the offline error
|
|
const TWO_PROBLEM_STATS = {
|
|
detectors: { cpu: { inference_speed: 60 } },
|
|
cameras: { front_door: { camera_fps: 0 } },
|
|
};
|
|
|
|
test("status bar collapses several problems behind the most severe", async ({
|
|
frigateApp,
|
|
}) => {
|
|
test.skip(frigateApp.isMobile, "Status bar is desktop-only");
|
|
await frigateApp.installDefaults({ stats: TWO_PROBLEM_STATS });
|
|
await frigateApp.goto("/");
|
|
|
|
const summary = frigateApp.page.getByRole("button", {
|
|
name: "Front Door is offline +1",
|
|
});
|
|
await expect(summary).toBeVisible({ timeout: 15_000 });
|
|
await expect(frigateApp.page.getByText("Cpu is slow")).toHaveCount(0);
|
|
|
|
await summary.click();
|
|
const list = frigateApp.page.getByTestId("status-message-list");
|
|
await expect(list.getByRole("link")).toHaveText([
|
|
"Front Door is offline",
|
|
"Cpu is slow (60 ms)",
|
|
]);
|
|
|
|
await list.getByRole("link", { name: "Cpu is slow (60 ms)" }).click();
|
|
await expect(frigateApp.page).toHaveURL(/\/system#general/);
|
|
await expect(list).toHaveCount(0);
|
|
});
|
|
|
|
test("mobile status drawer stacks every problem", async ({ frigateApp }) => {
|
|
test.skip(!frigateApp.isMobile, "Mobile-only");
|
|
await frigateApp.installDefaults({ stats: TWO_PROBLEM_STATS });
|
|
await frigateApp.goto("/");
|
|
|
|
await frigateApp.page
|
|
.getByTestId("status-alert-trigger")
|
|
.click({ timeout: 15_000 });
|
|
const items = frigateApp.page
|
|
.getByTestId("status-message-list")
|
|
.getByRole("link");
|
|
await expect(items).toHaveText([
|
|
"Front Door is offline",
|
|
"Cpu is slow (60 ms)",
|
|
]);
|
|
|
|
const [first, second] = await Promise.all([
|
|
items.nth(0).boundingBox(),
|
|
items.nth(1).boundingBox(),
|
|
]);
|
|
expect(second!.y).toBeGreaterThan(first!.y);
|
|
});
|
|
|
|
test("a config row can be muted but not acknowledged", async ({
|
|
frigateApp,
|
|
}) => {
|
|
const id = "config:detect:fps-greater-than-five:camera.garage";
|
|
await frigateApp.installDefaults({
|
|
config: {
|
|
cameras: {
|
|
garage: { detect: { width: 2560, height: 1440, fps: 10 } },
|
|
},
|
|
},
|
|
stats: QUIET_STATS,
|
|
});
|
|
|
|
// the list gains the mute after the POST so the refetch hides the row
|
|
let muted = false;
|
|
const path = `/api/notices/${encodeURIComponent(id)}/mute`;
|
|
await frigateApp.page.route(
|
|
(url) => url.pathname.endsWith(path),
|
|
(route) => {
|
|
muted = true;
|
|
return route.fulfill({ json: { success: true } });
|
|
},
|
|
);
|
|
await frigateApp.page.route("**/api/notices/muted_checks", (route) =>
|
|
route.fulfill({ json: muted ? [{ id, muted_at: NOW }] : [] }),
|
|
);
|
|
await frigateApp.goto("/system#health");
|
|
|
|
const row = frigateApp.page.getByTestId(`health-problem-${id}`);
|
|
await expect(row).toBeVisible({ timeout: 15_000 });
|
|
await expect(row.getByRole("button", { name: "Acknowledge" })).toHaveCount(
|
|
0,
|
|
);
|
|
const request = frigateApp.page.waitForRequest(
|
|
(req) =>
|
|
new URL(req.url()).pathname.endsWith(path) && req.method() === "POST",
|
|
);
|
|
await row.getByRole("button", { name: "Mute", exact: true }).click();
|
|
await request;
|
|
await expect(row).toHaveCount(0);
|
|
});
|
|
|
|
test("muted config rows move to the hidden list", async ({ frigateApp }) => {
|
|
const id = "config:detect:fps-greater-than-five:camera.garage";
|
|
await frigateApp.installDefaults({
|
|
config: {
|
|
cameras: {
|
|
garage: { detect: { width: 2560, height: 1440, fps: 10 } },
|
|
},
|
|
},
|
|
stats: QUIET_STATS,
|
|
mutedChecks: [{ id, muted_at: NOW - 120 }],
|
|
});
|
|
await frigateApp.page.route(
|
|
(url) =>
|
|
url.pathname.endsWith("/api/notices") &&
|
|
url.searchParams.get("include_hidden") === "true",
|
|
(route) => route.fulfill({ json: [] }),
|
|
);
|
|
await frigateApp.goto("/system#health");
|
|
|
|
await expect(
|
|
frigateApp.page.getByText(
|
|
"This detect resolution is higher than recommended",
|
|
),
|
|
).toBeVisible({ timeout: 15_000 });
|
|
const row = frigateApp.page.getByTestId(`health-problem-${id}`);
|
|
await expect(row).toHaveCount(0);
|
|
|
|
await frigateApp.page.getByRole("button", { name: "Filter" }).click();
|
|
await frigateApp.page.getByRole("switch", { name: "Show hidden" }).click();
|
|
await frigateApp.page.keyboard.press("Escape");
|
|
|
|
await expect(row).toBeVisible();
|
|
await expect(row).toContainText("Muted");
|
|
await expect(row.getByRole("button", { name: "Unmute" })).toBeVisible();
|
|
await expect(
|
|
row.getByRole("button", { name: "Mute", exact: true }),
|
|
).toHaveCount(0);
|
|
});
|
|
});
|