Mol*_*0ko 11 webview flutter flutter-test
我使用integration_test包在Dart上为iOS和Android平台编写UI测试。我的应用程序中还有一个网络视图,显示带有文本字段的登录页面。我使用webview_flutter来实现。
有谁知道如果tester
可以在集成测试中与我的 webview 交互?我可以在网页上找到一个文本字段并在其中输入文本吗?
我想编写这样的测试代码,但是对于 webview:
testWidgets('Authorization test', (tester) async {
...
await tester.enterText(find.byKey(Key('login_text_field')), 'login');
await tester.enterText(find.byKey(Key('password_text_field')), 'password');
await tester.tap(find.byKey(Key('sign_in_button')));
await tester.pumpAndSettle();
}
Run Code Online (Sandbox Code Playgroud)
以下是网页内容:
现在通过Patrol可以实现这一点!
你可以这样编写你的测试:
patrolTest(
'Authorization test',
nativeAutomation: true,
($) async {
// ...
await $.native.enterTextByIndex('login', index: 0);
await $.native.enterTextByIndex('password', index: 1);
await $.native.tap(Selector(text: 'Sign in'));
// ...
},
);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3052 次 |
最近记录: |