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

Simplify PermissionGranterTest #360

Merged
merged 3 commits into from
Aug 4, 2020
Merged

Conversation

Sloy
Copy link
Member

@Sloy Sloy commented Aug 4, 2020

While writing tests for #356 I realized that this test class needed some improvements.

Here's what I did:

  • Added test ignores_already_granted_permission. This behavior already existed but wasn't covered.
  • Added test grants_location_permission, because in Android Q the Location permission has different buttons. This test is broken in Q, and fixed by PermissionGranter should click *foreground* grant button for location #356
  • Deleted fails_when_using_permission because wasn't really testing the PermissionGranter
  • Replaced RuntimePermissionActivity with EmptyActivity. By using ActivityScenario instead of BaristaRule we can request permissions from the test without having an intermediate activity with a few buttons. Now we can request any permission from the test. Almost looks like a unit test.
  • Used different permission for each test, to avoid issues with the test execution order.
  • Deleted unused code.

@Sloy
Copy link
Member Author

Sloy commented Aug 4, 2020

@alorma I made some additional changes to extract some verbosity out of the tests. Do you mind checking again?

@Sloy Sloy merged commit 6411a87 into master Aug 4, 2020
@Sloy Sloy deleted the improve-permissiongranter-test branch August 4, 2020 11:54
@Sloy Sloy mentioned this pull request Aug 18, 2020
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

Successfully merging this pull request may close these issues.

2 participants