52 lines
2.3 KiB
TypeScript
52 lines
2.3 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
test.setTimeout(120_000);
|
|
|
|
test("loads repository, publication point, and object data on demand", async ({ page }) => {
|
|
const apiRequests: string[] = [];
|
|
const consoleErrors: string[] = [];
|
|
|
|
page.on("request", (request) => {
|
|
const url = new URL(request.url());
|
|
if (url.pathname.startsWith("/api/v1")) {
|
|
apiRequests.push(`${url.pathname}${url.search}`);
|
|
}
|
|
});
|
|
page.on("console", (message) => {
|
|
if (message.type() === "error") {
|
|
consoleErrors.push(message.text());
|
|
}
|
|
});
|
|
|
|
await page.goto("/");
|
|
await page.getByRole("button", { name: /Repositories/i }).click();
|
|
|
|
await expect(page.getByRole("heading", { name: "Repository / publication point / object browser" })).toBeVisible();
|
|
await expect(page.getByText("Select a repository to load its publication points.")).toBeVisible();
|
|
expect(apiRequests.some((request) => request.includes("/publication-points"))).toBe(false);
|
|
expect(apiRequests.some((request) => request.includes("/objects"))).toBe(false);
|
|
|
|
await page.getByRole("button", { name: /sakuya\.nat\.moe/i }).click();
|
|
await expect(page.getByRole("button", { name: /5A179648B3EF2369DCE7BDB58140FF7DC7060ABF\.mft/i })).toBeVisible({ timeout: 30_000 });
|
|
expect(apiRequests.some((request) => request.includes("/repos/0490c1fe6e4d4ae5cc354948/publication-points"))).toBe(true);
|
|
expect(apiRequests.some((request) => request.includes("/objects"))).toBe(false);
|
|
|
|
await page.getByRole("button", { name: /5A179648B3EF2369DCE7BDB58140FF7DC7060ABF\.mft/i }).click();
|
|
await expect.poll(
|
|
() => apiRequests.some((request) => request.includes("/publication-points/node_10342/objects")),
|
|
{ timeout: 70_000 }
|
|
).toBe(true);
|
|
const objectsPanel = page.getByRole("region", { name: "Objects for publication point" });
|
|
await expect(
|
|
objectsPanel.getByText(/rsync:\/\/sakuya\.nat\.moe\/repo\/NATOCA\/1\/5A179648B3EF2369DCE7BDB58140FF7DC7060ABF\.mft/)
|
|
).toBeVisible({ timeout: 70_000 });
|
|
await expect(objectsPanel.getByText("manifest").first()).toBeVisible();
|
|
await expect(page.getByText("limit=50")).toBeVisible();
|
|
expect(consoleErrors).toEqual([]);
|
|
|
|
await page.screenshot({
|
|
path: "../../../../specs/develop/20260617/m4_playwright/rpki-explorer-repository-browser.png",
|
|
fullPage: true
|
|
});
|
|
});
|