I am working on automating the flutter app. I have a web breakout where I have to enter the username and password and then have to click the submit button. Then it would be redirected to the Home Page which is build using flutter. While automating the integration tests how to handle this webpage using integration test driver? I am looking for some help using the javascript executor.
Asked
Active
Viewed 267 times
1 Answers
0
Try Patrol - it lets you easily interact with WebViews from within Flutter integration tests.
Here's an example integration test that signs in inside WebView (or even a normal web browser):
import 'package:flutter_test/flutter_test.dart';
import 'package:patrol/patrol.dart';
void main() {
patrolTest(
'signs in',
nativeAutomation: true,
(PatrolTester $) async {
await $.pumpWidgetAndSettle(const YourAwesomeApp());
// your test code
// open webview sign in screen
await $.native.enterText(
Selector(textContains: 'Email'),
text: 'tester@awesomeapp.pl'),
);
await $.native.enterText(
Selector(textContains: 'Password'),
text: 'ny4ncat'),
);
await $.native.tap(Selector(text: 'Submit'));
// if sign in succeeds, you should be back to Flutter world
});
}

Bartek Pacia
- 1,085
- 3
- 15
- 37