Patrol: Allow Modify System Settings in Android

112 views Asked by At

I'm using patrol for writing UI tests in flutter, in android version, the app uses "android.permission.WRITE_SETTINGS", which should be allowed by the user, through the following screen: allow writing system settings screen

How to turn on the toggle switch using patrol?

I used:

  await $.native.grantPermissionWhenInUse();

but I got: The following PatrolActionException was thrown running a test: Patrol action failed: NativeAutomatorClientException: grantPermissionWhenInUse() failed with Invalid response: 404 selector button to allow permission while using found nothing

While I was expecting granting writing permission.

1

There are 1 answers

2
thanhbinh84 On
await $.native.tap(Selector(text: 'Allow modifying system settings'));

The details could be found here: https://patrol.leancode.co/tips-and-tricks#granting-sensitive-permission-through-the-settings-app