I tried to migrate my old flutter driver tests to the new integration_test package. I copied nearly everything from the example project and executed the integration tests of the example project locally. That worked as expected, I was able to see the app UI. But my own app just shows "Test starting..." in a purple color after the splash screen was shown.
example_test.dart:
void main() {
group('My-App', () {
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized() as IntegrationTestWidgetsFlutterBinding;
testWidgets('Tap on SkipAuthentication', (tester) async {
app.main();
await binding.traceAction(() async {
await tester.pumpAndSettle();
await Future.delayed(Duration(seconds: 5));
final fab = find.byKey(ValueKey(WidgetKeys.authenticationScreenKeys.skipAuthenticationButton));
await tester.tap(fab);
await tester.pumpAndSettle();
});
});
integration_driver.dart:
Future<void> main() async {
integrationDriver();
}
I figured out, that if I don't start the tester.pumpWidget() shows the Widget, that I pass to the method, but thats a WidgetTest and not an integration Test.
My guess is, that it's due to the fact that my main function is an async function. I also needed this workaround in my old flutter driver tests to wait for the first frame. But I couldn't figure out how to implement that with the new integration_test package.
Hope you can help me.
pumpAndSettle()
has a Duration property though so you should use that oversleep()
– Moonwort