From a31602b26580152b7407f44f91ff5bb9567b19cd Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Mon, 6 Apr 2026 16:39:11 -0500 Subject: [PATCH] reduce local test runs to 4 workers to match CI --- web/e2e/playwright.config.ts | 2 +- web/e2e/specs/system.spec.ts | 104 +++++++++++++++++++++++------------ 2 files changed, 71 insertions(+), 35 deletions(-) diff --git a/web/e2e/playwright.config.ts b/web/e2e/playwright.config.ts index 525d42818..4b21258f1 100644 --- a/web/e2e/playwright.config.ts +++ b/web/e2e/playwright.config.ts @@ -15,7 +15,7 @@ export default defineConfig({ fullyParallel: true, forbidOnly: !!process.env.CI, retries: process.env.CI ? 1 : 0, - workers: process.env.CI ? 4 : undefined, + workers: 4, reporter: process.env.CI ? [["json"], ["html"]] : [["html"]], timeout: 30_000, expect: { timeout: 5_000 }, diff --git a/web/e2e/specs/system.spec.ts b/web/e2e/specs/system.spec.ts index 3178c3dd7..a3aa512e5 100644 --- a/web/e2e/specs/system.spec.ts +++ b/web/e2e/specs/system.spec.ts @@ -1,54 +1,90 @@ /** * System page tests -- MEDIUM tier. * - * Tests tab switching between general/storage/cameras by name, - * verifies each tab renders content, and checks timestamp. + * Tests system page rendering with tabs and tab switching. + * Navigates to /system#general explicitly so useHashState resolves + * the tab state deterministically. */ import { test, expect } from "../fixtures/frigate-test"; test.describe("System Page @medium", () => { - test("system page renders with named tab buttons", async ({ frigateApp }) => { - await frigateApp.goto("/system"); - await expect(frigateApp.page.locator("#pageRoot")).toBeVisible(); - // Tab buttons have aria-labels like "Select general", "Select storage", etc. - await expect(frigateApp.page.getByLabel("Select general")).toBeVisible({ - timeout: 5_000, - }); + test("system page renders with tab buttons", 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("clicking Storage tab switches to storage view", async ({ + test("general tab is active when navigated via hash", async ({ frigateApp, }) => { - await frigateApp.goto("/system"); - await frigateApp.page.waitForTimeout(2000); - const storageTab = frigateApp.page.getByLabel("Select storage"); - if (await storageTab.isVisible().catch(() => false)) { - await storageTab.click(); - await frigateApp.page.waitForTimeout(1000); - // Verify tab switched (page may crash with incomplete mock stats) - await expect(frigateApp.page.locator("body")).toBeVisible(); - } + await frigateApp.goto("/system#general"); + await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute( + "data-state", + "on", + { timeout: 15_000 }, + ); }); - test("clicking Storage tab does not crash", async ({ frigateApp }) => { - await frigateApp.goto("/system"); - await frigateApp.page.waitForTimeout(2000); - const storageTab = frigateApp.page.getByLabel("Select storage"); - if (await storageTab.isVisible().catch(() => false)) { - await storageTab.click(); - await frigateApp.page.waitForTimeout(1000); - } - // Page may crash if mock stats are incomplete -- verify body is still present - await expect(frigateApp.page.locator("body")).toBeVisible(); + test("clicking Storage tab activates it 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("system page shows last refreshed text", async ({ frigateApp }) => { - await frigateApp.goto("/system"); - await frigateApp.page.waitForTimeout(3000); - const pageText = await frigateApp.page.textContent("#pageRoot"); - expect(pageText?.length).toBeGreaterThan(0); + test("clicking Cameras tab activates it 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 cameras").click(); + await expect(frigateApp.page.getByLabel("Select cameras")).toHaveAttribute( + "data-state", + "on", + { timeout: 5_000 }, + ); + await expect(frigateApp.page.getByLabel("Select general")).toHaveAttribute( + "data-state", + "off", + ); + }); + + test("system page 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(); + await expect(frigateApp.page.getByText(/Last refreshed/)).toBeVisible(); }); });