Flutter 驱动程序与原生元素交互

Hel*_*ior 6 ios flutter flutter-test

我很难使用 Flutter Driver 进行测试,我认为这可能是一个限制,问题是因为我无法与本机元素交互,我的意思是,我正在使用 Google 构建登录,然后在调用函数后iOS 它会显示一个对话框来确认登录

在此输入图像描述

但在集成测试中我不知道如何与之交互

final buttonLoginFinder = find.byValueKey('login_button');
final buttonContinueFinder = find.text('Continue');
// ...

await driver.tap(buttonLoginFinder);
await driver.waitFor(buttonContinueFinder);
await driver.tap(buttonContinueFinder);
Run Code Online (Sandbox Code Playgroud)

小智 -1

从我的角度来看,这不是测试应用程序的正确方法。Google Sign In 应被视为黑匣子。因此,在集成测试期间,应该对其进行模拟,并在尝试登录而无需特定对话框交互时仅返回 true/false。通过这种方式,您可以假设 Google Sign In 作为第三方库正常工作并跳过外部组件的集成测试。