React Native Detox:无法从系统警报弹出窗口中接受位置权限

时间:2019-04-23 23:22:07

标签: ios react-native detox

使用以下命令从命令行启动应用 detox test --configuration ios.sim.debug

通过以下代码启动应用 await device.launchApp({ permissions: { location: 'always', notifications: 'YES' } })

进入登录流程,直到应用通过“ react-native-permissions”询问位置 Permissions.request('location', { type: 'always' }) (需要事先检查以查看位置权限检查是否已经设置为“始终”(在这种情况下应用程序不会询问))

看到弹出的系统警报,要求确认位置权限

排毒无法看到系统警报弹出,因此无法单击按钮来始终选择位置许可

应该能够在位置许可系统按钮中点击“始终允许”按钮。但是不能。

请参阅我的代码:github.com/wix/Detox/issues/1330。

2 个答案:

答案 0 :(得分:0)

before(async () => {
    await device.launchApp({
        permissions: {
            location: 'YES',
        },
    });
});

在测试前启动具有所需权限的应用

答案 1 :(得分:0)

问题不在排毒方面。我正在使用排毒版本:17.14.6。问题出在 applesimutils 中。请升级您的 applesimutils: brew upgrade applesimutls。我当前的版本是 0.9.2。 另外,如果您的应用程序没有提供“始终”使用位置的选项,请在 e2e/init.js 文件中将其设置为“inuse”。 beforeAll(async () => { await detox.init(config, { launchApp: false }); await device.launchApp({ permissions: { notifications: 'YES', location: 'inuse' } }); });