Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions tests/playwright/artifacts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <svg> 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.
Expand Down
2 changes: 1 addition & 1 deletion tests/playwright/documents.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
15 changes: 14 additions & 1 deletion tests/playwright/rivet-delta.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ function mdToHtml(md: string): string {
html = html.replace(/`([^`]+)`/g, "<code>$1</code>");
// Bold.
html = html.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>");
// Images (must come before links — `![alt](url)` would otherwise be
// partly consumed by the link regex as `[alt](url)`).
html = html.replace(
/!\[([^\]]+)\]\(([^)]+)\)/g,
'<img alt="$1" src="$2">',
);
// Links.
html = html.replace(
/\[([^\]]+)\]\(([^)]+)\)/g,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 <script src="/assets/mermaid.js"> resolves
// against the dev server instead of about:blank.
await page.goto("/");
await page.setContent(`
<!doctype html><html><body>
<pre class="mermaid">${mermaidSrc
Expand Down
Loading