I have to write a flutter integration test, which needs to perform a login to my app. The login is an external website (using a chrome tab).
How can I enter the login credentials on the chrome tab? Right now, it looks like the integration test API is not working here. I can't identify any finders, nor can I enter text.
This is my setup:
- Flutter screen with Login Button:
This is my current test code:
Future loginIfPresent(WidgetTester tester) async {
final loginButtonFinder = find.widgetWithText(ElevatedButton, 'LOGIN');
if (tester.widgetList(loginButtonFinder).isEmpty) {
return;
}
await tester.tap(loginButtonFinder);
await tester.pump();
// Entering user name, but this does not work, too
await tester.enterText(<<which_finder_to_use>>, 'service');
// Entering user name, but this does not work, too
await tester.sendKeyEvent(LogicalKeyboardKey.keyS);
await tester.sendKeyEvent(LogicalKeyboardKey.keyE);
await tester.sendKeyEvent(LogicalKeyboardKey.keyR);
await tester.sendKeyEvent(LogicalKeyboardKey.keyV);
await tester.sendKeyEvent(LogicalKeyboardKey.keyI);
await tester.sendKeyEvent(LogicalKeyboardKey.keyC);
await tester.sendKeyEvent(LogicalKeyboardKey.keyE);
}
I am not able to enter the credentials using the integration test. How can I do this?