fix(tests/playwright): batch stale-test cleanups (5 of 10)#211
Merged
Conversation
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
 → <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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Five Playwright tests had stale assertions that diverged from the rendered output. None require a code change in
rivet-cliorrivet-core— these are pure test-code fixes.artifacts.spec.ts:49— mermaid race. The test assertedtoContainText("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 h4matched the page-chrome<h2>{title}</h2>(rendered byrivet-cli/src/render/documents.rs:122with no id by design). Tighten to.doc-body h2-h4so only body headings (which correctly emitid=\"{slug}\"viarivet-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 containsREQ_NEW_1) and the standalone<code>REQ-NEW-1</code>row. Tighten tocode:not(.language-mermaid)plus.first().rivet-delta.spec.ts:258—setContenthas no base URL.<script src=\"/assets/mermaid.js\">resolved toabout:blank/...and never loaded →window.mermaidundefined → 30s timeout.page.goto(\"/\")beforesetContentso the script resolves against the dev server.rivet-delta.spec.ts:367— missing image regex inmdToHtmlhelper. The localmdToHtmlonly had a[link](url)regex, which matched the inner[alt](url)ofand produced!<a href=\"url\">…</a>instead of<img>. Add aregex 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.rsreload restoration).Test plan
artifacts.spec.ts:49,documents.spec.ts:145,rivet-delta.spec.ts:136,rivet-delta.spec.ts:258,rivet-delta.spec.ts:367pass.tests/playwright/is touched (verify viagit diff --stat).🤖 Generated with Claude Code