Skip to content

fix(tests/playwright): batch stale-test cleanups (5 of 10)#211

Merged
avrabe merged 1 commit intomainfrom
fix/playwright-stale-tests
Apr 25, 2026
Merged

fix(tests/playwright): batch stale-test cleanups (5 of 10)#211
avrabe merged 1 commit intomainfrom
fix/playwright-stale-tests

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 25, 2026

Summary

Five Playwright tests had stale assertions that diverged from the rendered output. None require a code change in rivet-cli or rivet-core — these are pure test-code fixes.

  • artifacts.spec.ts:49 — mermaid race. The test asserted toContainText("flowchart LR") on <pre class=\"mermaid\"> after mermaid.js had already replaced the source with rendered SVG. Drop the source-text assertion; keep only the SVG-presence check.
  • documents.spec.ts:145 — heading IDs selector too broad. article h2, article h3, article h4, main h2, main h3, main h4 matched the page-chrome <h2>{title}</h2> (rendered by rivet-cli/src/render/documents.rs:122 with no id by design). Tighten to .doc-body h2-h4 so only body headings (which correctly emit id=\"{slug}\" via rivet-core/src/document.rs:541) are checked.
  • rivet-delta.spec.ts:136 — strict-mode locator violation. page.locator(\"code\", { hasText: \"REQ-NEW-1\" }) matched both <code class=\"language-mermaid\"> (mermaid source contains REQ_NEW_1) and the standalone <code>REQ-NEW-1</code> row. Tighten to code:not(.language-mermaid) plus .first().
  • rivet-delta.spec.ts:258setContent has no base URL. <script src=\"/assets/mermaid.js\"> resolved to about:blank/... and never loaded → window.mermaid undefined → 30s timeout. page.goto(\"/\") before setContent so the script resolves against the dev server.
  • rivet-delta.spec.ts:367 — missing image regex in mdToHtml helper. The local mdToHtml only had a [link](url) regex, which matched the inner [alt](url) of ![alt](url) and produced !<a href=\"url\">…</a> instead of <img>. Add a ![alt](url) regex BEFORE the link regex.

The other 5 Playwright failures (artifacts.spec.ts:73, filter-sort.spec.ts:225/253, serve-variant.spec.ts:25/67) are addressed in separate PRs (serve middleware fix, decision-pending, js.rs reload restoration).

Test plan

  • CI Playwright job: the five tests at artifacts.spec.ts:49, documents.spec.ts:145, rivet-delta.spec.ts:136, rivet-delta.spec.ts:258, rivet-delta.spec.ts:367 pass.
  • No file outside tests/playwright/ is touched (verify via git diff --stat).
  • The other 5 known-failing tests still fail (out of scope for this PR; tracked elsewhere).

🤖 Generated with Claude Code

Five Playwright tests had stale assertions that diverged from the
rendered output. None require a code change in rivet-cli or
rivet-core — these are pure test-code fixes.

- artifacts.spec.ts:49 — drop toContainText("flowchart LR") that
  raced mermaid.js's pre→SVG swap; keep only the SVG-presence check.
- documents.spec.ts:145 — tighten heading-IDs selector from
  article/main h2-h4 to .doc-body h2-h4 so it doesn't match the
  page-chrome <h2>{title}</h2> that has no id by design.
- rivet-delta.spec.ts:136 — tighten code-locator to
  :not(.language-mermaid) so it doesn't strict-mode-match both the
  mermaid source block and the standalone <code> row.
- rivet-delta.spec.ts:258 — page.goto("/") before setContent so
  <script src="/assets/mermaid.js"> resolves against the dev server
  instead of about:blank.
- rivet-delta.spec.ts:367 — add the missing
  ![alt](url) → <img> regex to mdToHtml so the svg-url image case
  isn't matched by the link regex.

The other 5 Playwright failures (artifacts.spec.ts:73,
filter-sort.spec.ts:225/253, serve-variant.spec.ts:25/67) are
addressed in separate PRs (serve middleware fix, decision-pending,
js.rs reload restoration) — see Mythos research agent triage.

Trace: skip

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@avrabe avrabe merged commit f39dbc2 into main Apr 25, 2026
20 of 24 checks passed
@avrabe avrabe deleted the fix/playwright-stale-tests branch April 25, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant