Add e2e coverage for the known/unknown device ratio
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { test, expect } from "@playwright/test";
|
||||
|
||||
const USERNAME = process.env.LOCAL_USERNAME ?? "admin";
|
||||
const PASSWORD = process.env.LOCAL_PASSWORD ?? "";
|
||||
|
||||
test("known/unknown ratio matches the actual badge counts", 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 knownCount = await page.locator(".device-badge.known").count();
|
||||
const unknownCount = await page.locator(".device-badge.unknown").count();
|
||||
|
||||
const ratioText = await page.locator(".device-ratio").textContent();
|
||||
expect(ratioText).toBe(`${knownCount} known / ${unknownCount} unknown`);
|
||||
|
||||
const countText = await page.locator(".device-count").textContent();
|
||||
expect(countText).toBe(`(${knownCount + unknownCount})`);
|
||||
});
|
||||
Reference in New Issue
Block a user