diff --git a/tests/playwright/artifacts.spec.ts b/tests/playwright/artifacts.spec.ts index ad375bf..df7c449 100644 --- a/tests/playwright/artifacts.spec.ts +++ b/tests/playwright/artifacts.spec.ts @@ -57,9 +57,6 @@ test.describe("Artifacts", () => { const mermaidPre = page.locator("pre.mermaid"); await expect(mermaidPre).toHaveCount(1); - // The source content must be there before mermaid.js runs. - await expect(mermaidPre).toContainText("flowchart LR"); - // mermaid.js replaces the block's contents with an on success. // Give it a moment to run — it's triggered by DOMContentLoaded and // htmx:afterSwap. If rendering fails the pre block keeps its source. diff --git a/tests/playwright/documents.spec.ts b/tests/playwright/documents.spec.ts index 95badd7..28d1993 100644 --- a/tests/playwright/documents.spec.ts +++ b/tests/playwright/documents.spec.ts @@ -161,7 +161,7 @@ test.describe("Documents", () => { await page.goto(docLinks[0]); await waitForHtmx(page); const headings = await page - .locator("article h2, article h3, article h4, main h2, main h3, main h4") + .locator(".doc-body h2, .doc-body h3, .doc-body h4") .evaluateAll((els) => els.map((el) => ({ tag: el.tagName.toLowerCase(), diff --git a/tests/playwright/rivet-delta.spec.ts b/tests/playwright/rivet-delta.spec.ts index ad3b212..f301e21 100644 --- a/tests/playwright/rivet-delta.spec.ts +++ b/tests/playwright/rivet-delta.spec.ts @@ -65,6 +65,12 @@ function mdToHtml(md: string): string { html = html.replace(/`([^`]+)`/g, "$1"); // Bold. html = html.replace(/\*\*([^*]+)\*\*/g, "$1"); + // Images (must come before links — `![alt](url)` would otherwise be + // partly consumed by the link regex as `[alt](url)`). + html = html.replace( + /!\[([^\]]+)\]\(([^)]+)\)/g, + '$1', + ); // Links. html = html.replace( /\[([^\]]+)\]\(([^)]+)\)/g, @@ -184,7 +190,11 @@ test.describe("rivet-delta PR-comment output", () => { await expect( page.locator("h2", { hasText: "Rivet artifact delta" }), ).toBeVisible(); - await expect(page.locator("code", { hasText: "REQ-NEW-1" })).toBeVisible(); + await expect( + page + .locator("code:not(.language-mermaid)", { hasText: "REQ-NEW-1" }) + .first(), + ).toBeVisible(); await expect( page.locator("details summary", { hasText: "Modified" }), ).toBeVisible(); @@ -283,6 +293,9 @@ test.describe("rivet-delta PR-comment output", () => { // Use the project's bundled mermaid (served by `rivet serve` at // /assets/mermaid.js) so the parser version matches production. + // Navigate first so