frigate/web/e2e/specs/explore.spec.ts

98 lines
3.5 KiB
TypeScript
Raw Normal View History

2026-04-06 19:15:22 +03:00
/**
* Explore page tests -- HIGH tier.
*
2026-04-06 20:04:51 +03:00
* Tests search input with text entry and clearing, camera filter popover
* opening with camera names, and content rendering with mock events.
2026-04-06 19:15:22 +03:00
*/
import { test, expect } from "../fixtures/frigate-test";
test.describe("Explore Page - Search @high", () => {
2026-04-06 20:04:51 +03:00
test("explore page renders with filter buttons", async ({ frigateApp }) => {
2026-04-06 19:15:22 +03:00
await frigateApp.goto("/explore");
2026-04-06 20:04:51 +03:00
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
2026-04-06 19:15:22 +03:00
const buttons = frigateApp.page.locator("#pageRoot button");
await expect(buttons.first()).toBeVisible({ timeout: 10_000 });
});
test("search input accepts text and can be cleared", async ({
frigateApp,
}) => {
2026-04-06 19:15:22 +03:00
await frigateApp.goto("/explore");
await frigateApp.page.waitForTimeout(1000);
const searchInput = frigateApp.page.locator("input").first();
if (await searchInput.isVisible()) {
await searchInput.fill("person");
await expect(searchInput).toHaveValue("person");
await searchInput.fill("");
await expect(searchInput).toHaveValue("");
2026-04-06 19:15:22 +03:00
}
});
2026-04-06 20:04:51 +03:00
test("search input submits on Enter", async ({ frigateApp }) => {
await frigateApp.goto("/explore");
await frigateApp.page.waitForTimeout(1000);
const searchInput = frigateApp.page.locator("input").first();
if (await searchInput.isVisible()) {
await searchInput.fill("car in driveway");
await searchInput.press("Enter");
await frigateApp.page.waitForTimeout(1000);
// Page should not crash after search submit
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
}
});
});
2026-04-06 19:15:22 +03:00
test.describe("Explore Page - Filters @high", () => {
2026-04-06 20:04:51 +03:00
test("camera filter button opens popover with camera names (desktop)", async ({
frigateApp,
}) => {
if (frigateApp.isMobile) {
2026-04-06 20:04:51 +03:00
test.skip();
return;
}
2026-04-06 19:15:22 +03:00
await frigateApp.goto("/explore");
await frigateApp.page.waitForTimeout(1000);
const camerasBtn = frigateApp.page.getByRole("button", {
name: /cameras/i,
});
if (await camerasBtn.isVisible().catch(() => false)) {
await camerasBtn.click();
await frigateApp.page.waitForTimeout(500);
const popover = frigateApp.page.locator(
"[data-radix-popper-content-wrapper]",
);
await expect(popover.first()).toBeVisible({ timeout: 3_000 });
2026-04-06 20:04:51 +03:00
// Camera names from config should be in the popover
await expect(frigateApp.page.getByText("Front Door")).toBeVisible();
await frigateApp.page.keyboard.press("Escape");
2026-04-06 19:15:22 +03:00
}
});
2026-04-06 20:04:51 +03:00
test("filter button opens and closes overlay cleanly", async ({
2026-04-06 19:15:22 +03:00
frigateApp,
}) => {
await frigateApp.goto("/explore");
await frigateApp.page.waitForTimeout(1000);
const firstButton = frigateApp.page.locator("#pageRoot button").first();
await expect(firstButton).toBeVisible({ timeout: 5_000 });
await firstButton.click();
await frigateApp.page.waitForTimeout(500);
await frigateApp.page.keyboard.press("Escape");
await frigateApp.page.waitForTimeout(300);
2026-04-06 20:04:51 +03:00
// Page is still functional after open/close cycle
2026-04-06 19:15:22 +03:00
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
});
});
2026-04-06 19:15:22 +03:00
test.describe("Explore Page - Content @high", () => {
2026-04-06 20:04:51 +03:00
test("explore page shows content with mock events", async ({
frigateApp,
}) => {
2026-04-06 19:15:22 +03:00
await frigateApp.goto("/explore");
await frigateApp.page.waitForTimeout(3000);
2026-04-06 19:15:22 +03:00
const pageText = await frigateApp.page.textContent("#pageRoot");
expect(pageText?.length).toBeGreaterThan(0);
});
});