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"; 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); test.setTimeout(120_000);
// ChartCanvas lazy-loads Observable Plot; pay the import cost once before the matrix below. // ChartCanvas lazy-loads Observable Plot; pay the import cost once before the matrix below.
await page.goto(`${fixture}?${new URLSearchParams({ href: "#details", inspect: "0" })}`); await page.goto(`${fixture}?${new URLSearchParams({ href: "#details", inspect: "0" })}`);
@ -49,19 +50,18 @@ test("chart links cannot execute script when clicked or expanded", async ({ page
} }
} }
await captureScreenshot(page, testInfo, "chart-with-inert-link"); await captureScreenshot(page, testInfo, "chart-with-inert-link");
}); });
test("chart links retain supported URLs and browser encoding semantics", async ({ page }) => { test("retain supported URLs and browser encoding semantics", async ({ page }) => {
test.setTimeout(240_000); test.setTimeout(120_000);
await page.route("https://example.test/**", (route) => await page.route("https://example.test/**", (route) =>
route.fulfill({ body: "Chart destination" }), route.fulfill({ body: "Chart destination" }),
); );
await page.route("**/e2e/fixtures/java*", (route) => await page.route("**/e2e/fixtures/java*", (route) =>
route.fulfill({ body: "Chart destination" }), 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" })}`);
await page.goto(`${fixture}?${new URLSearchParams({ href: "#details", inspect: "0" })}`); await expect(page.locator("svg circle").first()).toBeVisible({ timeout: 30_000 });
await expect(page.locator("svg circle").first()).toBeVisible({ timeout: 120_000 });
for (const href of [ for (const href of [
"https://example.test/chart?a=1&b=2", "https://example.test/chart?a=1&b=2",
"mailto:chart@example.test", "mailto:chart@example.test",
@ -72,7 +72,7 @@ test("chart links retain supported URLs and browser encoding semantics", async (
"java%73cript:void(0)", "java%73cript:void(0)",
]) { ]) {
await page.goto(`${fixture}?${new URLSearchParams({ href })}`); 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(); const link = page.locator("svg a").first();
await expect(link).toBeAttached(); await expect(link).toBeAttached();
expect( expect(
@ -88,4 +88,5 @@ test("chart links retain supported URLs and browser encoding semantics", async (
await expect(page.locator("body")).not.toHaveAttribute("data-plot-executed"); await expect(page.locator("body")).not.toHaveAttribute("data-plot-executed");
} }
} }
});
}); });