forked from flutter/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[e2e] Replaces the check for ActivityTestRule (flutter#2633)
Android: Replaces the check for ActivityTestRule and adds a second test for GrantPermissionRule enabled tests
- Loading branch information
1 parent
9f7fbfb
commit f53a247
Showing
4 changed files
with
40 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...roid/app/src/androidTest/java/com/example/e2e_example/MainActivityWithPermissionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.example.e2e_example; | ||
|
||
import android.Manifest.permission; | ||
import androidx.test.rule.ActivityTestRule; | ||
import androidx.test.rule.GrantPermissionRule; | ||
import dev.flutter.plugins.e2e.FlutterTestRunner; | ||
import org.junit.Rule; | ||
import org.junit.runner.RunWith; | ||
|
||
/** | ||
* Demonstrates how a E2E test on Android can be run with permissions already granted. This is | ||
* helpful if developers want to test native App behavior that depends on certain system service | ||
* results which are guarded with permissions. | ||
*/ | ||
@RunWith(FlutterTestRunner.class) | ||
public class MainActivityWithPermissionTest { | ||
|
||
@Rule | ||
public GrantPermissionRule permissionRule = | ||
GrantPermissionRule.grant(permission.ACCESS_COARSE_LOCATION); | ||
|
||
@Rule | ||
public ActivityTestRule<MainActivity> rule = | ||
new ActivityTestRule<>(MainActivity.class, true, false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters