【发布时间】:2021-06-05 10:25:10
【问题描述】:
使用 Flutter integration_test 包时,由于测试环境无法访问 iOS 权限请求,我遇到了测试不断失败的问题。
我从github.com/wix/AppleSimulatorUtils 尝试了applesimutils,但是尝试在flutter drive 之前设置权限时,应用程序的捆绑标识符尚未注册:
Got error:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
The operation couldn’t be completed. No such file or directory
No such file or directory
也许这可以通过不每次都创建一个新的 Simulator 实例来避免,但我通过在 applesimutils --setPermissions 命令之前运行 flutter drive ... & sleep 10 以允许应用程序首先启动来解决这个问题,但这仍然给了我:
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞═════════════════
The following LocationError object was thrown running a test:
[LocationError code: 0, message: null]
When the exception was thrown, this was the stack:
#2 BackgroundGeolocation.getCurrentPosition.<anonymous closure>
(package:flutter_background_geolocation/models/background_geolocation.dart:497:17)
...
【问题讨论】:
标签: flutter flutter-test location-services ios-permissions flutterdriver