Add deep-check e2e coverage
CI / web (push) Successful in 16s
CI / api (push) Successful in 23s

Verified via real HTTP path (not just the direct SSH test done while
building it): correctly identified Home Assistant via SSDP, 400 on
malformed IP, 401 unauthenticated, clean empty result for a device
with nothing to find (Echo-type devices deliberately minimize their
LAN footprint -- expected, not a bug).

Fixed the same substring-matching mistake caught earlier in
device-labeling.spec.ts, this time on "known" being a substring of
"unknown" -- switched to matching .device-badge.known specifically.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-12 23:17:37 -06:00
parent 542a3d8ce0
commit a2067581a5
+47
View File
@@ -0,0 +1,47 @@
import { test, expect } from "@playwright/test";
const USERNAME = process.env.LOCAL_USERNAME ?? "admin";
const PASSWORD = process.env.LOCAL_PASSWORD ?? "";
test("deep check button runs a check and shows results for an unknown device", async ({ page }) => {
test.skip(!PASSWORD, "LOCAL_PASSWORD not set");
await page.goto("/");
await page.getByPlaceholder("Username").fill(USERNAME);
await page.getByPlaceholder("Password").fill(PASSWORD);
await page.getByRole("button", { name: "Sign in" }).click();
await expect(page.locator(".device-table tbody tr").first()).toBeVisible({ timeout: 15_000 });
const unknownRow = page.locator(".device-table tbody tr").filter({ hasText: "unknown" }).first();
await expect(unknownRow).toBeVisible();
const button = unknownRow.getByRole("button", { name: /deep check|checking/i });
await expect(button).toBeVisible();
await button.click();
await expect(button).toHaveText("Checking…");
// Bounded by the script's own timeouts (well under 15s) plus SSH round trip.
await expect(page.locator(".deep-check-row").first()).toBeVisible({ timeout: 20_000 });
await expect(button).toHaveText("Deep check");
// Either real findings (SSDP/mDNS/ports) or the explicit "nothing found"
// message -- either way, a result panel with actual content, not empty.
const resultRow = page.locator(".deep-check-row").first();
await expect(resultRow).not.toBeEmpty();
});
test("known devices have no deep check button", async ({ page }) => {
test.skip(!PASSWORD, "LOCAL_PASSWORD not set");
await page.goto("/");
await page.getByPlaceholder("Username").fill(USERNAME);
await page.getByPlaceholder("Password").fill(PASSWORD);
await page.getByRole("button", { name: "Sign in" }).click();
await expect(page.locator(".device-table tbody tr").first()).toBeVisible({ timeout: 15_000 });
// .device-badge.known specifically -- "known" is a substring of "unknown",
// so a text-based filter would match both (bit me on the labeling test too).
const knownRow = page.locator(".device-table tbody tr").filter({ has: page.locator(".device-badge.known") }).first();
await expect(knownRow).toBeVisible();
await expect(knownRow.getByRole("button", { name: /deep check/i })).toHaveCount(0);
});