New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to ensure google_fonts are loaded during golden tests. #175
Comments
Same issue here :S |
curious if this still happens if you do a |
Yes. Still happens after calling pumpAndSettle(). This is because font loading does not schedule any new frames. https://api.flutter.dev/flutter/flutter_test/WidgetTester/pumpAndSettle.html |
This is a reasonable request. We have an internal implementation that we could leverage |
why not borrow how eBay does it in their golden toolkit package? their asset bundle loading and their config class that implements font loading in the flutter-test_config file |
Google fonts takes an extra moment or so to load fonts, which can cause tests to break: * material-foundation/flutter-packages#151 * material-foundation/flutter-packages#175 This commit introduces a workaround in the form of a helper method which will pump some text widgets until all fonts are loaded.
Google fonts takes an extra moment or so to load fonts, which can cause tests to break: * material-foundation/flutter-packages#151 * material-foundation/flutter-packages#175 This commit introduces a workaround in the form of a helper method which will pump some text widgets until all fonts are loaded.
Describe the bug
During golden tests, I noticed that any font coming from google_fonts is missing in the first golden. Creating the same golden again (with pumping the widget again) then works.
To Reproduce
Steps to reproduce the behavior:
Take the default main app and add a font from the google_fonts package:
Running the following tests:
Expected behavior
Both Goldens should look identical. Only the counter is of interest here. The other text that does not load properly is not relevant here.
Include the contents of your
google_fonts
directoryPubspec.yaml:
Screenshots
goldens/test1.png
goldens/test2.png
Desktop (please complete the following information if applicable):
Additional context
This could probably be solved by the requests made in #151 or #150.
The text was updated successfully, but these errors were encountered: