使用Integration_test软件包在Flutter集成测试中设置区域设置

问题描述

我正在尝试使用integration_test软件包对测试进行汇总,该软件包在运行测试之前会设置特定的语言环境。我尝试了以下方法(这与WidgetTests中的方法很接近):

    await tester.binding.setLocale('en','US');
    app.main();
    await tester.idle();
    await tester.pumpAndSettle();

    // The app is still using the default locale of the phone...

是否需要在驱动程序中进行设置?这是我当前在驱动程序中的设置:

  // Some adb commands for granting permissions...
  print('Starting test.');
  final FlutterDriver driver = await FlutterDriver.connect();
  final String data = await driver.requestData(
    null,timeout: const Duration(minutes: 1),);
  await driver.close();
  // Some more adb commands to revoke permissions.

这似乎不起作用。

我找到了this issue here,但是它没有使用integration_test软件包,因此设置完全不同。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)