fluttersvggolden-test

Flutter golden tests hanging when running tester.waitForAssets()


When upgrading Flutter from 3.13.9 to 3.16.9, some of our golden tests started launching timeout errors. We're using golden_toolkit 0.15.0, the latest version available. So latest Flutter version + latest golden_toolkit version.

After checking what was happening, we saw our call to await tester.multiScreenGoldenMatcher() lasted forever. Going deeper, we found the call that hanged the whole test was tester.waitForAssets().


Solution

  • Fixed it!

    The issue was related to using flutter_svg_provider 1.0.4. I wasn't able to update to 1.0.7 because I had a dependency that used http 0.13.6 while flutter_svg_provider 1.0.7 used http 1.1.2.

    What I had to do is to use flutter_svg_provider 1.0.7 and override the version of http to 0.13.6.

    To do that, I set in my pubspec.yaml:

    dependency_overrides:
      http: ^0.13.6