Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The incorrect behavior is in case of granting permissions with AllureAndroidJUnitRunner for app with targetSDK 30 and ran on sdk 29 #50

Closed
SergKhram opened this issue Feb 15, 2021 · 0 comments

Comments

@SergKhram
Copy link
Contributor

SergKhram commented Feb 15, 2021

I'm submitting a ...

[ ✓] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

The error is on granting :
Security exception: Package ...android.debug has not requested permission android.permission.WRITE_EXTERNAL_STORAGE

java.lang.SecurityException: Package ....android.debug has not requested permission android.permission.WRITE_EXTERNAL_STORAGE
at com.android.server.pm.permission.BasePermission.enforceDeclaredUsedAndRuntimeOrDevelopment(BasePermission.java:425)
at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermission(PermissionManagerService.java:2096)
at com.android.server.pm.permission.PermissionManagerService.access$900(PermissionManagerService.java:120)
at com.android.server.pm.permission.PermissionManagerService$PermissionManagerServiceInternalImpl.grantRuntimePermission(PermissionManagerService.java:2999)
at com.android.server.pm.PackageManagerService.grantRuntimePermission(PackageManagerService.java:5734)
at com.android.server.pm.PackageManagerShellCommand.runGrantRevokePermission(PackageManagerShellCommand.java:1955)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:230)
at android.os.ShellCommand.exec(ShellCommand.java:104)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21729)
at android.os.Binder.shellCommand(Binder.java:881)
at android.os.Binder.onTransact(Binder.java:765)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4860)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4014)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)

and as the result :

  1. Fatal exception when running tests
    junit.framework.AssertionFailedError: Failed to grant permissions, see logcat for details
    at junit.framework.Assert.fail(Assert.java:50)
    at androidx.test.runner.permission.PermissionRequester.requestPermissions(PermissionRequester.java:111)
    at io.qameta.allure.android.internal.TestUtilsKt.requestExternalStoragePermissions(TestUtils.kt:28)
    at io.qameta.allure.android.listeners.ExternalStoragePermissionsListener.testRunStarted(ExternalStoragePermissionsListener.kt:9)
    at org.junit.runner.notification.SynchronizedRunListener.testRunStarted(SynchronizedRunListener.java:35)
    at org.junit.runner.notification.RunNotifier$1.notifyListener(RunNotifier.java:91)
    at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:72)
    at org.junit.runner.notification.RunNotifier.fireTestRunStarted(RunNotifier.java:88)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
    at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
    at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

build_versions = [
target_sdk: 30,
build_tools: "30",
min_sdk: 21
]
emulator with sdk 29
Espresso/Kaspresso test without debug/AndroidManifest granting permissions

What is the expected behavior?

There are no errors

What is the motivation / use case for changing the behavior?

The motivation is to have a possibility to grant permissions in runtime

Please tell us about your environment:

io.qameta.allure:allure-kotlin-model:2.2.0
io.qameta.allure:allure-kotlin-commons:2.2.0
io.qameta.allure:allure-kotlin-junit4:2.2.0
io.qameta.allure:allure-kotlin-android:2.2.0
| Allure version | 2.2.0 |
| Test framework | junit@4.13.1 |
| Allure integration | allure-kotlin-android@2.2.0 |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant