Fix flaky math equation visual regression test#357
Merged
Conversation
Capture a paragraph containing MathJax instead of the tiny MathJax element directly. MathJax rendering dimensions vary slightly between environments (font loading, rendering engine, timing), causing size-mismatch rejections on small elements (e.g. 45x16 vs 48x17). A paragraph-level capture provides a stable container where small MathJax variations are absorbed by maxDiffPixels. Old snapshots are removed since the captured element has changed and new baselines need to be generated by CI via /update-new-snapshots.
Contributor
Author
|
/update-new-snapshots |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #357 +/- ##
=======================================
Coverage ? 45.21%
=======================================
Files ? 2
Lines ? 387
Branches ? 0
=======================================
Hits ? 175
Misses ? 212
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
🎭 Visual Regression Test ResultsDetails
Skipped testsmobile-chrome › theme.spec.ts › Theme Features › f-string interpolation styling |
Contributor
|
✅ Visual snapshots have been updated and committed to this PR. |
The math equation test was flaky because the 1000ms fixed timeout was insufficient for MathJax to complete typesetting. Now properly waits for MathJax.startup.promise to resolve (up to 10s), ensuring all math is fully rendered before taking the screenshot. Also captures a paragraph container instead of the tiny MathJax element to avoid dimension mismatches. Old snapshots removed — new baselines needed via /update-new-snapshots.
Contributor
Author
|
/update-new-snapshots |
1 similar comment
Contributor
Author
|
/update-new-snapshots |
Contributor
|
✅ Visual snapshots have been updated and committed to this PR. |
Contributor
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
Fixes the flaky
math equation renderingvisual regression test that fails intermittently due to MathJax rendering size variations between environments.Problem
The test captures a screenshot of the
.MathJaxelement directly — a tiny inline element (~45x16px). MathJax rendering dimensions vary slightly between runs due to font loading, rendering engine differences, and timing (e.g. 45x16 vs 48x17). Playwright rejects screenshots with different dimensions regardless ofmaxDiffPixels, causing false failures.Fix
Capture a paragraph containing MathJax (
p:has(.MathJax)) instead of the MathJax element directly. The paragraph provides a stable, larger container where small MathJax size variations are absorbed bymaxDiffPixels: 300rather than triggering a dimension mismatch.After Merging
Run
/update-new-snapshotson this PR to generate new Ubuntu baselines before merging, since the captured element has changed (old baselines are removed in this PR).