test(web): run chart-links E2E serially to reuse warmed Plot module

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-10-07 12:35:34 +00:00
parent 7f75dfc2bc
commit 51b456409d
No known key found for this signature in database

View File

@ -3,7 +3,8 @@ import { captureScreenshot } from "./helpers";
const fixture = "/e2e/fixtures/chart-links.html";
test("chart links cannot execute script when clicked or expanded", async ({ page }, testInfo) => {
test.describe.serial("chart links", () => {
test("cannot execute script when clicked or expanded", async ({ page }, testInfo) => {
test.setTimeout(120_000);
// ChartCanvas lazy-loads Observable Plot; pay the import cost once before the matrix below.
await page.goto(`${fixture}?${new URLSearchParams({ href: "#details", inspect: "0" })}`);
@ -51,17 +52,16 @@ test("chart links cannot execute script when clicked or expanded", async ({ page
await captureScreenshot(page, testInfo, "chart-with-inert-link");
});
test("chart links retain supported URLs and browser encoding semantics", async ({ page }) => {
test.setTimeout(240_000);
test("retain supported URLs and browser encoding semantics", async ({ page }) => {
test.setTimeout(120_000);
await page.route("https://example.test/**", (route) =>
route.fulfill({ body: "Chart destination" }),
);
await page.route("**/e2e/fixtures/java*", (route) =>
route.fulfill({ body: "Chart destination" }),
);
// Each test gets a fresh browser context, so this one pays the cold Plot import too.
await page.goto(`${fixture}?${new URLSearchParams({ href: "#details", inspect: "0" })}`);
await expect(page.locator("svg circle").first()).toBeVisible({ timeout: 120_000 });
await page.goto(`${fixture}?${new URLSearchParams({ href: "#details" })}`);
await expect(page.locator("svg circle").first()).toBeVisible({ timeout: 30_000 });
for (const href of [
"https://example.test/chart?a=1&b=2",
"mailto:chart@example.test",
@ -72,7 +72,7 @@ test("chart links retain supported URLs and browser encoding semantics", async (
"java%73cript:void(0)",
]) {
await page.goto(`${fixture}?${new URLSearchParams({ href })}`);
await expect(page.locator("svg circle").first()).toBeVisible({ timeout: 90_000 });
await expect(page.locator("svg circle").first()).toBeVisible({ timeout: 30_000 });
const link = page.locator("svg a").first();
await expect(link).toBeAttached();
expect(
@ -89,3 +89,4 @@ test("chart links retain supported URLs and browser encoding semantics", async (
}
}
});
});