test(testing): add golden screenshot harness with real font loading - #8
Conversation
Adds loadAppFonts() so golden PNGs render Inter and Outfit glyphs instead of the placeholder font's filled rectangles, making screenshots usable as acceptance evidence for text, currency formats, and on-screen numbers. Font bytes are read synchronously: testWidgets bodies run in a fake-async zone where real file I/O never completes, so an awaited readAsBytes() makes FontLoader.load() hang indefinitely rather than fail. The companion test pins both golden failure modes in the suite - unreadable text without font loading, and a crashed widget still producing a PNG of Flutter's red error screen that --update-goldens will happily save as the baseline. Also asserts the helper's asset list matches pubspec.yaml so it cannot drift from what the app ships. Negates *.log for docs/verification/** so acceptance evidence can actually be committed; the blanket rule silently dropped it at git add time. Refs #6
The committed goldens fail on the Linux CI runner: pixel output depends on the host renderer, and PNGs generated on macOS differ by roughly 0.2 percent of pixels in text antialiasing (10143px on the text golden, 11331px on the error screen). Measured on the first CI run of this branch. Rather than loosening the pixel comparison - which would make the goldens prove nothing - the golden tests are tagged and CI excludes the tag. They are verified locally, which is also where acceptance evidence is produced. The asset-drift tests in the same file stay untagged and keep running in CI. Documents the consequence in CLAUDE.md: CI will not catch a stale golden, so regenerate and open the PNG whenever the widget it covers changes. Refs #6
|
CI on the first push failed, and the fix is in Golden output depends on the host renderer, so PNGs generated on macOS do not Stated plainly because it is a real reduction in coverage: CI will not catch a Refs #6 |
📊 Test Coverage ReportCoverage: 32.6% Coverage report is available in the workflow artifacts. Coverage by Layer
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Makes golden screenshots usable as acceptance evidence in this repo.
test/helpers/golden_helpers.dart—loadAppFonts()registers the real Interand Outfit families from
assets/fonts/, so text renders as glyphs instead ofthe placeholder font's filled rectangles.
test/helpers/golden_helpers_test.dart— worked example plus both failuremodes pinned in the suite: a crashed widget still produces a golden PNG (of
Flutter's red error screen, which
--update-goldenswill save as thebaseline), and the helper's asset list is checked against
pubspec.yamlso itcannot drift.
.gitignore— negates the blanket*.logrule fordocs/verification/**soacceptance evidence can be committed at all. Without it, evidence logs were
silently dropped at
git addtime.CLAUDE.md— documents the helper, the mandatoryloadAppFonts()call, thefake-async constraint on font loading, and that a PNG's existence is not
evidence.
Verification evidence is committed under
docs/verification/issue-6/.Local:
dart formatclean,flutter analyze0 issues, full suite 1312 passed /572 skipped / 0 failed (baseline was 1308 passed, so +4 and no new skips).
Refs #6