I have the following sign-in test set up for my app:
testWidgets('sign in with email and password', (WidgetTester tester) async {
app.main();
await tester.pumpAndSettle(Duration(seconds: 3));
final emailInputFinder = find.byKey(Key('type-email'));
final passwordInputFinder = find.byKey(Key('type-password'));
final emailButtonFinder = find.byKey(Key('enter-email'));
final passwordButtonFinder = find.byKey(Key('enter-password'));
final dashboardFinder = find.byKey(Key('dashboard'));
await tester.enterText(emailInputFinder, 'test.lab.user.01@...');
await tester.pumpAndSettle(Duration(seconds: 3));
await tester.tap(emailButtonFinder);
await tester.pumpAndSettle(Duration(seconds: 3));
await tester.enterText(passwordInputFinder, '...');
await tester.pumpAndSettle(Duration(seconds: 3));
await tester.tap(passwordButtonFinder);
await tester.pumpAndSettle(Duration(seconds: 3));
expect(dashboardFinder, findsOneWidget);
});
The hardcoded 3 second delay isn't ideal, but without it I can't run the tests using the driver.
Running on my local machine with the driver is fine. I use the command
flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart
But when I upload the Espresso test to Firebase Test Lab and review the video, the sign-in screen loads up, but the first enterText()
command seems to have no effect. Nothing is added to the text field, and the test just times out.
I have tried various combinations of tester.tap()
and tester.showKeyboard()
, but so far, nothing is coming up.
How can I get enterText()
to work correctly in the Espresso environment supported by TestLab?