From 9508fa767cc570fba8b7a1d321f3cab3cbb5640b Mon Sep 17 00:00:00 2001 From: Ralf Anton Beier Date: Sun, 26 Apr 2026 17:41:31 +0200 Subject: [PATCH] test(playwright): flip description-mermaid pin to expect .svg-viewer wrap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #215 (rendering-invariants.spec.ts) was authored before PR #217 (remaining Playwright fixes) and pinned the asymmetry: "description-mermaid is NOT wrapped in .svg-viewer (only diagram: field is)". PR #217 then closed that asymmetry — render/artifacts.rs now wraps description-mermaid in the same .svg-viewer container as the diagram: field. After both PRs landed on main, rendering-invariants.spec.ts:150 fails because main now wraps the mermaid that the test asserted is unwrapped. Flip the assertion to pin the new wrapped behavior (parity between description and diagram-field rendering). If a future change un-wraps, this assertion forces the change to be intentional. Trace: skip --- tests/playwright/rendering-invariants.spec.ts | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/playwright/rendering-invariants.spec.ts b/tests/playwright/rendering-invariants.spec.ts index 17cd47b..b05119a 100644 --- a/tests/playwright/rendering-invariants.spec.ts +++ b/tests/playwright/rendering-invariants.spec.ts @@ -147,7 +147,7 @@ test.describe("Rendering invariants — embed layout", () => { }); test.describe("Rendering invariants — render-shape contracts", () => { - test("mermaid in artifact `description` renders as
", async ({
+  test("mermaid in artifact `description` renders as 
 wrapped in .svg-viewer", async ({
     page,
   }) => {
     // ARCH-CORE-001 has a fenced ```mermaid block in its `description` (see
@@ -155,12 +155,16 @@ test.describe("Rendering invariants — render-shape contracts", () => {
     // rivet-core/src/markdown.rs converts these to 
     // so the dashboard's mermaid.js loader picks them up.
     //
-    // We pin TWO things at once:
+    // PR #217 closed the description-mermaid asymmetry: render/artifacts.rs
+    // now post-processes render_markdown output to wrap any 
+    // in the same .svg-viewer container with toolbar that the dedicated
+    // `diagram:` field uses (see render/artifacts.rs:489 area).
+    //
+    // We pin BOTH:
     //   1. The fenced block IS recognised and emitted as .
-    //   2. Description-mermaid is currently NOT wrapped in .svg-viewer
-    //      (only the dedicated `diagram:` field is). This asymmetry is a
-    //      known UX gap; if it changes, this assertion forces the change
-    //      to be intentional.
+    //   2. Description-mermaid IS now wrapped in .svg-viewer (parity with
+    //      diagram-field rendering). If a future change un-wraps it, this
+    //      assertion forces the change to be intentional.
     await page.goto("/artifacts/ARCH-CORE-001");
     await waitForHtmx(page);
 
@@ -174,13 +178,11 @@ test.describe("Rendering invariants — render-shape contracts", () => {
     // Body should contain the diagram source so mermaid.js can render it.
     await expect(mermaidPre).toContainText("flowchart");
 
-    // Pinning the current asymmetry: the description-embedded mermaid is
-    // NOT inside an .svg-viewer wrapper. (Only the top-level `diagram:`
-    // field gets one — see render/artifacts.rs:489.)
+    // Description-embedded mermaid is now wrapped in .svg-viewer (PR #217).
     const wrappedInViewer = await desc
       .locator(".svg-viewer pre.mermaid")
       .count();
-    expect(wrappedInViewer).toBe(0);
+    expect(wrappedInViewer).toBeGreaterThan(0);
   });
 });