Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Detox: Can't accept location permission from system alert pop up

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

Launch app in code via await device.launchApp({ permissions: { location: 'always', notifications: 'YES' } })

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 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.

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

like image 477
Konstantin Savransky Avatar asked Apr 23 '19 23:04

Konstantin Savransky


2 Answers

The problem is not on detox side. I am using detox version: 17.14.6. The problem was in applesimutils. Please upgrade your applesimutils: brew upgrade applesimutls. My current version is 0.9.2. Plus if your app doesnt provide option to 'always' use location, set it to 'inuse' in e2e/init.js file. beforeAll(async () => { await detox.init(config, { launchApp: false }); await device.launchApp({ permissions: { notifications: 'YES', location: 'inuse' } }); });

like image 96
Yestay Muratov Avatar answered Nov 12 '22 03:11

Yestay Muratov


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

Launch app with required permissions before tests

like image 33
FDisk Avatar answered Nov 12 '22 04:11

FDisk