jaumard / flare_splash_screen

Facilitator for having a Splash Screen with a Flare animation
MIT License
95 stars 20 forks source link

Testing with flare_splash_screen requires FlareTesting.setup() #27

Open rubenvereecken opened 4 years ago

rubenvereecken commented 4 years ago

I just wanted to share something, perhaps for the docs? It wasn't super hard to find out why but I couldn't manage to get flutter test driver to work with the splash screen, it just wouldn't show up and the tests would eventually time out. A bit of sleuthing turned up that I had to manually rely on the underlying flare_flutter package and set it up for testing. The resulting test_driver/main.dart is as follows.

import 'package:flare_flutter/flare_testing.dart';
import 'package:flutter_driver/driver_extension.dart';
import 'package:my_package/main_test.dart' as app;

void main() {
  enableFlutterDriverExtension();
  FlareTesting.setup(); // <-- This here line
  app.main();
}

Just sharing in case anyone else has the same problem or in case it needs to make it into the docs.

jaumard commented 4 years ago

Might be interesting indeed to have that in the Readme ! Thanks for that !