diff options
Diffstat (limited to 'app/src/androidTestCustom')
-rw-r--r-- | app/src/androidTestCustom/java/se/leap/bitmaskclient/base/CustomProviderTest.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/src/androidTestCustom/java/se/leap/bitmaskclient/base/CustomProviderTest.java b/app/src/androidTestCustom/java/se/leap/bitmaskclient/base/CustomProviderTest.java index 1a0814b6..92416af4 100644 --- a/app/src/androidTestCustom/java/se/leap/bitmaskclient/base/CustomProviderTest.java +++ b/app/src/androidTestCustom/java/se/leap/bitmaskclient/base/CustomProviderTest.java @@ -1,5 +1,6 @@ package se.leap.bitmaskclient.base; +import static androidx.test.core.app.ApplicationProvider.getApplicationContext; import static androidx.test.espresso.Espresso.onView; import static androidx.test.espresso.action.ViewActions.click; import static androidx.test.espresso.assertion.ViewAssertions.matches; @@ -9,7 +10,12 @@ import static androidx.test.espresso.matcher.ViewMatchers.withId; import static androidx.test.espresso.matcher.ViewMatchers.withText; import static utils.CustomInteractions.tryResolve; +import android.net.VpnService; + import androidx.test.espresso.ViewInteraction; +import androidx.test.uiautomator.UiObject; +import androidx.test.uiautomator.UiObjectNotFoundException; +import androidx.test.uiautomator.UiSelector; import org.junit.Test; @@ -20,7 +26,14 @@ public class CustomProviderTest extends ProviderBaseTest { @Test @Override - public void test01_vpnStartTest() throws InterruptedException { + public void test01_vpnStartTest() throws InterruptedException, UiObjectNotFoundException { + // handle VPN permission dialog + if (VpnService.prepare(getApplicationContext()) != null) { + UiObject okButton = device.findObject(new UiSelector().packageName("com.android.vpndialogs").resourceId("android:id/button1")); + okButton.waitForExists(30000); + okButton.click(); + } + ViewInteraction mainButtonStop; mainButtonStop = tryResolve( onView(withId(R.id.main_button)), |