mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-02 09:02:15 +03:00
Add frontend tests (#22783)
* basic e2e frontend test framework * improve mock data generation and add test cases * more cases * add e2e tests to PR template * don't generate mock data in PR CI * satisfy codeql check * fix flaky system page tab tests by guarding against crashes from incomplete mock stats * reduce local test runs to 4 workers to match CI
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Settings page tests -- HIGH tier.
|
||||
*
|
||||
* Tests settings page rendering with content, form controls,
|
||||
* and section navigation.
|
||||
*/
|
||||
|
||||
import { test, expect } from "../../fixtures/frigate-test";
|
||||
|
||||
test.describe("Settings Page @high", () => {
|
||||
test("settings page renders with content", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/settings");
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
await expect(frigateApp.page.locator("#pageRoot")).toBeVisible();
|
||||
const text = await frigateApp.page.textContent("#pageRoot");
|
||||
expect(text?.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test("settings page has clickable navigation items", async ({
|
||||
frigateApp,
|
||||
}) => {
|
||||
await frigateApp.goto("/settings");
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
const navItems = frigateApp.page.locator(
|
||||
"#pageRoot button, #pageRoot [role='button'], #pageRoot a",
|
||||
);
|
||||
const count = await navItems.count();
|
||||
expect(count).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test("settings page has form controls", async ({ frigateApp }) => {
|
||||
await frigateApp.goto("/settings");
|
||||
await frigateApp.page.waitForTimeout(2000);
|
||||
const formElements = frigateApp.page.locator(
|
||||
'#pageRoot input, #pageRoot button[role="switch"], #pageRoot button[role="combobox"]',
|
||||
);
|
||||
const count = await formElements.count();
|
||||
expect(count).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user