20260623 optimize rpki explorer ui interactions

This commit is contained in:
2026-06-23 15:47:50 +08:00
parent 4f41fbe04e
commit 574e40a4d4
16 changed files with 1483 additions and 297 deletions

View File

@@ -1,6 +1,8 @@
import { expect, test } from "@playwright/test";
test("opens the RPKI Explorer overview prototype", async ({ page }) => {
const screenshotRoot = "../../../../specs/develop/20260623_2/m6_full_e2e";
function collectConsoleErrors(page: import("@playwright/test").Page) {
const consoleErrors: string[] = [];
page.on("console", (message) => {
if (message.type() === "error") {
@@ -10,47 +12,72 @@ test("opens the RPKI Explorer overview prototype", async ({ page }) => {
}
}
});
return consoleErrors;
}
test("opens the RPKI Explorer overview", async ({ page }) => {
const consoleErrors = collectConsoleErrors(page);
await page.goto("/");
await expect(page.getByRole("heading", { name: "RPKI Explorer" })).toBeVisible();
await expect(page.getByRole("heading", { name: "Global RPKI validation health" })).toBeVisible();
await expect(page.getByRole("button", { name: /Overview/i })).toBeVisible();
await expect(page.getByLabel("Current run")).toContainText("latest indexed run");
await expect(page.getByPlaceholder("Exact URI lookup planned in M2")).toBeDisabled();
await expect(page.getByText("Top repositories by workload")).toBeVisible();
await expect(page.getByText("Recent validation issues")).toBeVisible();
await expect(page.getByRole("cell", { name: /RRDP|RSYNC/i }).first()).toBeVisible();
await page.screenshot({
path: "../../../../specs/develop/20260617/m2_playwright/rpki-explorer-overview.png",
fullPage: true
});
await page.screenshot({ path: `${screenshotRoot}/rpki-explorer-overview.png`, fullPage: true });
expect(consoleErrors).toEqual([]);
});
test("opens the RPKI Explorer object detail prototype", async ({ page }) => {
test.setTimeout(90_000);
const consoleErrors: string[] = [];
page.on("console", (message) => {
if (message.type() === "error") {
const text = message.text();
if (!text.includes("Failed to load resource")) {
consoleErrors.push(text);
}
}
});
test("collapses sidebar to icon-only navigation on desktop", async ({ page }) => {
const consoleErrors = collectConsoleErrors(page);
await page.goto("/");
await expect(page.getByRole("heading", { name: "RPKI Explorer" })).toBeVisible();
await page.getByRole("button", { name: "Collapse navigation" }).click();
await expect(page.locator(".app-shell")).toHaveClass(/sidebar-collapsed/);
await expect(page.getByRole("button", { name: "Expand navigation" })).toBeVisible();
await expect(page.locator(".brand-copy")).toHaveCSS("position", "absolute");
await expect(page.locator(".nav-item").first().locator("span")).toHaveCSS("position", "absolute");
await expect(page.getByRole("button", { name: "Repositories" })).toBeVisible();
await page.screenshot({ path: `${screenshotRoot}/rpki-explorer-sidebar-collapsed.png`, fullPage: true });
await page.getByRole("button", { name: "Repositories" }).click();
await expect(page.getByRole("heading", { name: "Repository / publication point / object browser" })).toBeVisible();
await page.getByRole("button", { name: "Expand navigation" }).click();
await expect(page.locator(".app-shell")).not.toHaveClass(/sidebar-collapsed/);
await expect(page.getByRole("heading", { name: "RPKI Explorer" })).toBeVisible();
expect(consoleErrors).toEqual([]);
});
test("opens truthful placeholders for unfinished navigation", async ({ page }) => {
const consoleErrors = collectConsoleErrors(page);
await page.goto("/");
for (const name of ["Publication Points", "Validation", "Exports", "Runs", "API"]) {
await page.getByRole("button", { name }).click();
await expect(page.locator("#coming-soon-heading")).toHaveText(name);
await expect(page.getByText("Coming soon", { exact: true })).toBeVisible();
await expect(page.getByRole("heading", { name: "Global RPKI validation health" })).toHaveCount(0);
}
await page.screenshot({ path: `${screenshotRoot}/rpki-explorer-coming-soon.png`, fullPage: true });
expect(consoleErrors).toEqual([]);
});
test("objects page starts from explicit empty state", async ({ page }) => {
const consoleErrors = collectConsoleErrors(page);
await page.goto("/");
await page.getByRole("button", { name: /Objects/i }).click();
await expect(page.getByRole("heading", { name: "MFT object" })).toBeVisible({ timeout: 70_000 });
await expect(page.getByText("Object detail · live query service")).toBeVisible();
await expect(page.getByText("File and chain checks")).toBeVisible();
await expect(page.getByRole("tab", { name: "Validation" })).toBeVisible();
await page.getByRole("tab", { name: "Validation" }).click();
await expect(page.getByText("Final status: valid")).toBeVisible();
await page.screenshot({
path: "../../../../specs/develop/20260617/m2_playwright/rpki-explorer-object-detail.png",
fullPage: true
});
await expect(page.getByRole("heading", { name: "Object object" })).toBeVisible();
await expect(page.getByText("Search an exact URI or open an object from Repository Browser.")).toBeVisible();
await expect(page.locator("body")).not.toContainText("sample PP");
await page.screenshot({ path: `${screenshotRoot}/rpki-explorer-objects-empty.png`, fullPage: true });
expect(consoleErrors).toEqual([]);
});