mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-09-26 02:08:57 +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
* check for a valid frame before using its shape With the camera offline, no preview frame, and `camera-error.jpg` missing, `latest_frame` read `frame.shape` before its `frame is None` check, so it raised `AttributeError` and answered 500 with a traceback instead of the intended "Unable to get valid frame". The check now runs first. * fix the has_clip self-heal for events with no recordings `vod_event` looked for a `(body, 404)` tuple, but `vod_ts` returns a `JSONResponse`, so the check never matched and an old event whose recordings are gone kept offering a clip that can't play. It now checks the response status code. * return 403 for a snapshot or thumbnail on another camera The broad `except Exception` handlers in `event_snapshot` and `event_thumbnail` caught the `HTTPException` from `require_camera_access`, so a restricted user asking for another camera's snapshot got a 404 instead of a 403, and for an object still being tracked the snapshot was rendered before the check ran. Both endpoints now look up the event and check access in their own block, the way the other endpoints do, so a denial propagates. * find DST transitions to the second `get_dst_transitions` probed the offset once every 24 hours from the start time and reported a change at the first probe after it, up to a day late, so events, review items and recordings near a transition were grouped into days with the old offset. A transition after the last daily probe wasn't found at all. The end of the range is probed too now, and a probe that sees the offset change bisects the interval to the second of the transition. * don't run page shortcuts for keys a dialog already handled Radix dismisses a dialog on Escape from a capture-phase keydown listener and calls `preventDefault()` without stopping propagation, so `useKeyboardListener` still ran the page's Escape shortcut: cancelling the delete dialog in the face library or a classification model also cleared the whole selection. Keys another shortcut hook handled still get through, since their listener order changes with every render. * fix train image filtering for a class with a dash The backend writes a class with a `-` as `_` in train file names, since it splits those names on `-`, while a dataset folder keeps the dash. Filtering the Train grid by `half-open` compared it with `half_open` and hid every attempt. Both sides are normalized the same way now. * don't edit a chat message while a reply streams The edit button stayed active while a reply streamed. `submitConversation` returns early while loading, but the message bubble still closed its editor, so the edit was silently lost. The edit button is hidden while a reply streams, and an editor that's already open keeps its draft with send disabled until the reply ends. * fix restart failing under non-root restart_frigate() called psutil.Process(1).terminate() to signal s6-svscan, but s6-svscan runs as root while frigate runs as uid 1000, so the call raised AccessDenied. That exception escaped every caller: the UI restart button dropped its websocket client, MQTT restart and Save & Restart just logged and did nothing, and the watchdog crashed its own monitoring thread on a dead detector. This catches AccessDenied and falls through to the existing SIGINT branch, which exits the process for s6 to restart it. * show runtime overrides in the settings form The settings form read a camera section's saved config value, but its dependent warnings (audio transcription requiring audio detection, snapshots requiring detect, etc.) read the live config instead. A runtime toggle from the live view, MQTT, or an active profile can turn a section off without touching yaml, and that override persists across restarts, so the Enable switch showed on while the warning said the feature wasn't enabled. This adds an "Overridden (Live)" badge to any field whose live value differs from what's saved, and swaps the affected warnings to runtime-specific wording when a runtime override is the actual cause instead of the config. * fix mobile overflowing icons in system due to new health pane * fix genai settings keeping a stale model and dropping roles after save Switching a GenAI entry's provider left the previous provider's model selected, so saving wrote a model the new provider doesn't serve. llama.cpp can't find that model in `/v1/models`, so the backend reported every capability as false for the entry, and once the save refetched `genai/models` the roles widget stripped `transcribe` from the form on its own. The section showed unsaved changes right after saving, and saving again would have dropped the role. Switching provider now clears the model, and the roles widget only strips a role for a model or provider picked in the form, since the entry-level capability flags only describe the saved model. A selected role stays visible when the provider can't confirm it, so it can still be switched off. The llama.cpp model list also no longer repeats a model whose alias matches its id, which is what `--alias` produces. * close onvif sessions on shutdown `OnvifController.close()` only stopped its event loop, so the aiohttp sessions each `ONVIFCamera` holds and the `_poll_config_updates` task were left to be garbage collected during interpreter shutdown, when their warnings can no longer be logged. Every restart ended with a run of `Unclosed client session` and `Task was destroyed but it is pending!` logging errors, which only became visible once restart started exiting the process itself under non-root. `close()` now closes each camera's client and cancels the tasks on the loop before stopping it. * fixes * fixes
287 lines
9.6 KiB
TypeScript
287 lines
9.6 KiB
TypeScript
/**
|
|
* System page tests -- MEDIUM tier (promoted to cover migrated
|
|
* RestartDialog test from radix-overlay-regressions.spec.ts).
|
|
*
|
|
* Tab switching, version + last-refreshed display, and the
|
|
* RestartDialog cancel flow.
|
|
*/
|
|
|
|
import { test, expect } from "../fixtures/frigate-test";
|
|
import {
|
|
expectBodyInteractive,
|
|
waitForBodyInteractive,
|
|
} from "../helpers/overlay-interaction";
|
|
|
|
test.describe("System — tabs @medium", () => {
|
|
test("general tab is active by default via #general hash", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.goto("/system#general");
|
|
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 15_000 },
|
|
);
|
|
await expect(frigateApp.page.getByLabel("Select storage")).toBeVisible();
|
|
await expect(frigateApp.page.getByLabel("Select cameras")).toBeVisible();
|
|
});
|
|
|
|
test("Storage tab activates and deactivates General", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.goto("/system#general");
|
|
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 15_000 },
|
|
);
|
|
await frigateApp.page.getByLabel("Select storage").click();
|
|
await expect(frigateApp.page.getByLabel("Select storage")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 5_000 },
|
|
);
|
|
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
|
"data-state",
|
|
"off",
|
|
);
|
|
});
|
|
|
|
test("Cameras tab activates", async ({ frigateApp }) => {
|
|
await frigateApp.goto("/system#general");
|
|
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 15_000 },
|
|
);
|
|
await frigateApp.page.getByLabel("Select cameras").click();
|
|
await expect(frigateApp.page.getByLabel("Select cameras")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 5_000 },
|
|
);
|
|
});
|
|
|
|
test("general tab shows version and last-refreshed", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.goto("/system#general");
|
|
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 15_000 },
|
|
);
|
|
await expect(frigateApp.page.getByText("0.15.0-test")).toBeVisible();
|
|
|
|
if (frigateApp.isMobile) {
|
|
// the "Last refreshed" label is dropped on mobile so the timestamp
|
|
// clears the centered logo
|
|
await expect(frigateApp.page.getByText(/Last refreshed/)).toHaveCount(0);
|
|
await expect(frigateApp.page.getByText(/Just now|ago/)).toBeVisible();
|
|
} else {
|
|
await expect(frigateApp.page.getByText(/Last refreshed/)).toBeVisible();
|
|
}
|
|
});
|
|
|
|
test("storage tab renders content after switching", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.goto("/system#general");
|
|
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 15_000 },
|
|
);
|
|
await frigateApp.page.getByLabel("Select storage").click();
|
|
await expect(frigateApp.page.getByLabel("Select storage")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 5_000 },
|
|
);
|
|
// On desktop, tab buttons render text labels so the word "storage"
|
|
// always appears in #pageRoot after switching. On mobile, tabs are
|
|
// icon-only, so we verify the general-tab content disappears instead
|
|
// (the storage tab's metrics section is hidden but general is gone).
|
|
if (!frigateApp.isMobile) {
|
|
await expect
|
|
.poll(
|
|
async () => (await frigateApp.page.textContent("#pageRoot")) ?? "",
|
|
{ timeout: 10_000 },
|
|
)
|
|
.toMatch(/storage|mount|disk|used|free/i);
|
|
} else {
|
|
// Mobile: tab activation (data-state "on") already asserted above.
|
|
// Additionally confirm general tab is no longer the active tab.
|
|
await expect(
|
|
frigateApp.page.getByLabel("Select general"),
|
|
).toHaveAttribute("data-state", "off", { timeout: 5_000 });
|
|
}
|
|
});
|
|
|
|
test("cameras tab renders each configured camera", async ({ frigateApp }) => {
|
|
await frigateApp.goto("/system#general");
|
|
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 15_000 },
|
|
);
|
|
await frigateApp.page.getByLabel("Select cameras").click();
|
|
await expect(frigateApp.page.getByLabel("Select cameras")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 5_000 },
|
|
);
|
|
// Cameras tab lists every camera from config/stats. The default
|
|
// mock has front_door, backyard, garage.
|
|
for (const cam of ["front_door", "backyard", "garage"]) {
|
|
await expect(
|
|
frigateApp.page
|
|
.getByText(new RegExp(cam.replace("_", ".?"), "i"))
|
|
.first(),
|
|
).toBeVisible({ timeout: 10_000 });
|
|
}
|
|
});
|
|
|
|
test("enrichments tab renders when semantic search is enabled", async ({
|
|
frigateApp,
|
|
}) => {
|
|
// Override config to guarantee the enrichments tab is present.
|
|
// System.tsx shows the tab when semantic_search.enabled === true.
|
|
await frigateApp.installDefaults({
|
|
config: { semantic_search: { enabled: true } },
|
|
});
|
|
await frigateApp.goto("/system#general");
|
|
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 15_000 },
|
|
);
|
|
const enrichTab = frigateApp.page.getByLabel(/select enrichments/i).first();
|
|
await expect(enrichTab).toBeVisible({ timeout: 5_000 });
|
|
await enrichTab.click();
|
|
await expect(enrichTab).toHaveAttribute("data-state", "on", {
|
|
timeout: 5_000,
|
|
});
|
|
});
|
|
});
|
|
|
|
test.describe("System — RestartDialog @medium", () => {
|
|
test.skip(
|
|
({ frigateApp }) => frigateApp.isMobile,
|
|
"Sidebar menu is desktop-only",
|
|
);
|
|
|
|
test("cancelling restart leaves body interactive", async ({ frigateApp }) => {
|
|
// Migrated from radix-overlay-regressions.spec.ts.
|
|
await frigateApp.goto("/");
|
|
|
|
const sidebarTriggers = frigateApp.page
|
|
.locator('[role="complementary"] [aria-haspopup="menu"]')
|
|
.or(frigateApp.page.locator('aside [aria-haspopup="menu"]'));
|
|
const triggerCount = await sidebarTriggers.count();
|
|
expect(triggerCount).toBeGreaterThan(0);
|
|
|
|
let opened = false;
|
|
for (let i = 0; i < triggerCount; i++) {
|
|
const trigger = sidebarTriggers.nth(i);
|
|
await trigger.click().catch(() => {});
|
|
const restartItem = frigateApp.page
|
|
.getByRole("menuitem", { name: /restart/i })
|
|
.first();
|
|
const visible = await expect(restartItem)
|
|
.toBeVisible({ timeout: 300 })
|
|
.then(() => true)
|
|
.catch(() => false);
|
|
if (visible) {
|
|
await restartItem.click();
|
|
opened = true;
|
|
break;
|
|
}
|
|
await frigateApp.page.keyboard.press("Escape").catch(() => {});
|
|
}
|
|
expect(opened).toBe(true);
|
|
|
|
const cancel = frigateApp.page.getByRole("button", { name: /cancel/i });
|
|
await expect(cancel).toBeVisible({ timeout: 3_000 });
|
|
await cancel.click();
|
|
|
|
await waitForBodyInteractive(frigateApp.page);
|
|
await expectBodyInteractive(frigateApp.page);
|
|
|
|
const postCancelTrigger = sidebarTriggers.first();
|
|
await postCancelTrigger.click();
|
|
await expect(
|
|
frigateApp.page
|
|
.locator('[role="menu"], [data-radix-menu-content]')
|
|
.first(),
|
|
).toBeVisible({ timeout: 3_000 });
|
|
});
|
|
});
|
|
|
|
test.describe("System — mobile @medium @mobile", () => {
|
|
test.skip(({ frigateApp }) => !frigateApp.isMobile, "Mobile-only");
|
|
|
|
test("tabs render at mobile viewport", async ({ frigateApp }) => {
|
|
await frigateApp.goto("/system#general");
|
|
await expect(frigateApp.page.getByLabel("Select general")).toBeVisible({
|
|
timeout: 15_000,
|
|
});
|
|
});
|
|
|
|
test("switching tabs works at mobile viewport", async ({ frigateApp }) => {
|
|
await frigateApp.goto("/system#general");
|
|
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 15_000 },
|
|
);
|
|
await frigateApp.page.getByLabel("Select storage").click();
|
|
await expect(frigateApp.page.getByLabel("Select storage")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 5_000 },
|
|
);
|
|
});
|
|
|
|
test("header controls leave the logo uncovered on a narrow phone", async ({
|
|
frigateApp,
|
|
}) => {
|
|
await frigateApp.goto("/system#general");
|
|
await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 15_000 },
|
|
);
|
|
await frigateApp.page.setViewportSize({ width: 320, height: 740 });
|
|
|
|
const logo = frigateApp.page.locator("svg.fill-current").first();
|
|
const tabs = frigateApp.page
|
|
.locator("[data-radix-scroll-area-viewport]")
|
|
.filter({ has: frigateApp.page.getByLabel("Select general") });
|
|
const refreshed = frigateApp.page.getByText(/Just now|ago/);
|
|
|
|
const logoBox = await logo.boundingBox();
|
|
const tabsBox = await tabs.boundingBox();
|
|
const refreshedBox = await refreshed.boundingBox();
|
|
|
|
expect(tabsBox!.x + tabsBox!.width).toBeLessThanOrEqual(logoBox!.x + 1);
|
|
expect(refreshedBox!.x).toBeGreaterThanOrEqual(logoBox!.x + logoBox!.width);
|
|
|
|
// the clipped tabs stay reachable by scrolling
|
|
const overflow = await tabs.evaluate((el) => ({
|
|
scroll: el.scrollWidth,
|
|
client: el.clientWidth,
|
|
}));
|
|
expect(overflow.scroll).toBeGreaterThan(overflow.client);
|
|
await tabs.evaluate((el) => {
|
|
el.scrollLeft = el.scrollWidth;
|
|
});
|
|
await frigateApp.page.getByLabel("Select cameras").click();
|
|
await expect(frigateApp.page.getByLabel("Select cameras")).toHaveAttribute(
|
|
"data-state",
|
|
"on",
|
|
{ timeout: 5_000 },
|
|
);
|
|
});
|
|
});
|