public class EspPermissionDialog
extends java.lang.Object
Actions and assertions for a permission request dialog.
You must provide the expected permissions. It is necessary to avoid test crashes when you accedentely remove a granted permission. This type of error is not easy to detect when it occurs.
For pre marshmallow version mostly all functions are disabled to avoid errors.
| Modifier and Type | Field and Description |
|---|---|
static int |
DELAY_FOR_UPDATE_PERMISSION_STATE
Delay after clicking any permissions dialog button.
|
| Constructor and Description |
|---|
EspPermissionDialog(java.lang.String[] permissions)
Create new element instance for given permissions.
|
| Modifier and Type | Method and Description |
|---|---|
void |
allow()
Perform click on allow permission button.
|
static EspPermissionDialog |
build(java.lang.String... permissions)
Create new element instance for given permissions.
|
protected void |
click(java.lang.String targetId) |
void |
deny()
Perform click on deny permission button.
|
public static int DELAY_FOR_UPDATE_PERMISSION_STATE
Delay after clicking any permissions dialog button.
Less than 1000ms was sometimes not enough for permissions update on circle ci emulator
public EspPermissionDialog(java.lang.String[] permissions)
Create new element instance for given permissions.
permissions - List of requested permissions.public static EspPermissionDialog build(java.lang.String... permissions)
Create new element instance for given permissions.
permissions - List of requested permissions.public void allow()
Perform click on allow permission button.
This will fail if no permission dialog is shown except on pre Android M version.
public void deny()
Perform click on deny permission button.
This will fail if no permission dialog is shown except on pre Android M version..
Warning: Revoking an already granted permission would force your app to restart (test fail). You can workaround with @FixMethodOrder(MethodSorters.NAME_ASCENDING) or use
EspPermissionsTool.resetAllPermission()which does not restart your app.
protected void click(java.lang.String targetId)