Skip to content

Fix flaky math equation visual regression test#357

Merged
mmcky merged 6 commits intomainfrom
fix/math-equation-visual-test
Feb 6, 2026
Merged

Fix flaky math equation visual regression test#357
mmcky merged 6 commits intomainfrom
fix/math-equation-visual-test

Conversation

@mmcky
Copy link
Contributor

@mmcky mmcky commented Feb 6, 2026

Summary

Fixes the flaky math equation rendering visual regression test that fails intermittently due to MathJax rendering size variations between environments.

Problem

The test captures a screenshot of the .MathJax element 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 of maxDiffPixels, 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 by maxDiffPixels: 300 rather than triggering a dimension mismatch.

After Merging

Run /update-new-snapshots on this PR to generate new Ubuntu baselines before merging, since the captured element has changed (old baselines are removed in this PR).

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.
@mmcky
Copy link
Contributor Author

mmcky commented Feb 6, 2026

/update-new-snapshots

@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@2046ebc). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #357   +/-   ##
=======================================
  Coverage        ?   45.21%           
=======================================
  Files           ?        2           
  Lines           ?      387           
  Branches        ?        0           
=======================================
  Hits            ?      175           
  Misses          ?      212           
  Partials        ?        0           
Flag Coverage Δ
pytests 45.21% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

🎭 Visual Regression Test Results

passed  37 passed
skipped  1 skipped

Details

stats  38 tests across 1 suite
duration  49.2 seconds
commit  b7adeb0

Skipped tests

mobile-chrome › theme.spec.ts › Theme Features › f-string interpolation styling

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

✅ Visual snapshots have been updated and committed to this PR.

@mmcky mmcky closed this Feb 6, 2026
@mmcky mmcky reopened this Feb 6, 2026
mmcky added 2 commits February 6, 2026 14:35
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.
@mmcky
Copy link
Contributor Author

mmcky commented Feb 6, 2026

/update-new-snapshots

1 similar comment
@mmcky
Copy link
Contributor Author

mmcky commented Feb 6, 2026

/update-new-snapshots

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

✅ Visual snapshots have been updated and committed to this PR.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

@github-actions github-actions bot temporarily deployed to pull request February 6, 2026 04:06 Inactive
@mmcky mmcky merged commit c25b251 into main Feb 6, 2026
10 checks passed
@mmcky mmcky deleted the fix/math-equation-visual-test branch February 6, 2026 04: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