React Native Detox:无法接受来自系统警报弹出的位置许可 [英] React Native Detox: Can't accept location permission from system alert pop up

查看:99
本文介绍了React Native Detox:无法接受来自系统警报弹出的位置许可的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用命令行启动应用程序detox test --configuration ios.sim.debug

Launch app from command line using detox test --configuration ios.sim.debug

通过代码启动应用程序await device.launchApp({ permissions: { location: 'always', notification: 'YES' } })

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

Go through login flow until app asks for location via react-native-permissions Permissions.request('location', { type: 'always' }) (with prior check to see if location permission check already set to'always' (in which case app doesn't ask) )

看到系统提示弹出要求确认位置权限

See system alert pop up asking to confirm location permission

Detox 无法看到弹出的系统警报,因此无法点击按钮来选择位置的权限

Detox cannot see system alert pop up and thus can't click on button to choose permission always for location

应该能够点击位置许可系统按钮中的始终允许"按钮.但不能.

Should be able to tap on 'Always Allow' button in location permission system button. But can't.

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

See my code at: github.com/wix/Detox/issues/1330 .

推荐答案

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

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

Launch app with required permissions before tests

这篇关于React Native Detox:无法接受来自系统警报弹出的位置许可的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆