diff options
Diffstat (limited to 'app/src')
5 files changed, 229 insertions, 106 deletions
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/BitmaskTest.java b/app/src/androidTest/java/se/leap/bitmaskclient/BitmaskTest.java index 1ca0980a..b984042b 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/BitmaskTest.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/BitmaskTest.java @@ -1,7 +1,11 @@ package se.leap.bitmaskclient; +import static androidx.test.espresso.Espresso.onView; +import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility; +import static androidx.test.espresso.matcher.ViewMatchers.withId; import static org.junit.Assert.assertNotNull; +import static utils.ProviderSetupUtils.isVerboseScreenshots; import android.Manifest; import android.app.Activity; @@ -10,12 +14,12 @@ import android.content.Intent; import android.os.Build; import android.view.Gravity; -import androidx.test.espresso.Espresso; import androidx.test.espresso.ViewInteraction; import androidx.test.espresso.action.ViewActions; import androidx.test.espresso.assertion.ViewAssertions; import androidx.test.espresso.contrib.DrawerActions; import androidx.test.espresso.contrib.DrawerMatchers; +import androidx.test.espresso.contrib.RecyclerViewActions; import androidx.test.espresso.matcher.RootMatchers; import androidx.test.espresso.matcher.ViewMatchers; import androidx.test.ext.junit.runners.AndroidJUnit4; @@ -34,6 +38,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; +import de.blinkt.openvpn.core.VpnStatus; import se.leap.bitmaskclient.base.MainActivity; import se.leap.bitmaskclient.base.StartActivity; import se.leap.bitmaskclient.providersetup.activities.SetupActivity; @@ -66,71 +71,138 @@ public class BitmaskTest { public void test01_vpnStartTest() throws InterruptedException, UiObjectNotFoundException { startMainActivity(); - Screengrab.screenshot("VPN_connecting"); - ViewInteraction mainButtonStop = CustomInteractions.tryResolve( - Espresso.onView(Matchers.allOf( - ViewMatchers.withId(R.id.button), + ViewInteraction mainButton = null; + if (!VpnStatus.isVPNActive()) { + mainButton = CustomInteractions.tryResolve( + onView(Matchers.allOf( + withId(R.id.button)//, + /*ViewMatchers.withTagValue(Matchers.is("button_circle_start"))*/)), + ViewAssertions.matches(ViewMatchers.isDisplayed()), + 20); + // turn VPN on + mainButton.perform(ViewActions.click()); + + // resolve connecting state + CustomInteractions.tryResolve( + onView(Matchers.allOf( + withId(R.id.button), + ViewMatchers.withTagValue(Matchers.is("button_circle_cancel")))), + ViewAssertions.matches(ViewMatchers.isDisplayed()), + 3, "attempt to resolve connecting state"); + } + + mainButton = CustomInteractions.tryResolve( + onView(Matchers.allOf( + withId(R.id.button), ViewMatchers.withTagValue(Matchers.is("button_circle_stop")))), ViewAssertions.matches(ViewMatchers.isDisplayed()), - 20); - Screengrab.screenshot("VPN_connected"); + 20, "attempt to resolve connected state"); + Screengrab.screenshot("01_VPN_connected"); - mainButtonStop.perform(ViewActions.click()); - Screengrab.screenshot("VPN_ask_disconnect"); + // turn VPN off + mainButton.perform(ViewActions.click()); + if (isVerboseScreenshots()) { + Screengrab.screenshot("031_VPN_ask_disconnect"); + } - Espresso.onView(ViewMatchers.withText(android.R.string.yes)) + onView(ViewMatchers.withText(android.R.string.yes)) .inRoot(RootMatchers.isDialog()) .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) .perform(ViewActions.click()); - Screengrab.screenshot("VPN_disconnected"); + Screengrab.screenshot("03_VPN_disconnected"); + } + + @Test + public void test02_vpnConnectingStateTest() throws InterruptedException, UiObjectNotFoundException { + startMainActivity(); + + ViewInteraction mainButton = CustomInteractions.tryResolve( + onView(Matchers.allOf( + withId(R.id.button), + ViewMatchers.withTagValue(Matchers.is("button_circle_start")))), + ViewAssertions.matches(ViewMatchers.isDisplayed()), + 20); + // turn VPN on + mainButton.perform(ViewActions.click()); + + // resolve connecting state + CustomInteractions.tryResolve( + onView(Matchers.allOf( + withId(R.id.button), + ViewMatchers.withTagValue(Matchers.is("button_circle_cancel")))), + ViewAssertions.matches(ViewMatchers.isDisplayed()), + 3, "attempt to resolve connecting state"); + Screengrab.screenshot("02_VPN_connecting"); + + CustomInteractions.tryResolve( + onView(Matchers.allOf( + withId(R.id.button), + ViewMatchers.withTagValue(Matchers.is("button_circle_stop")))), + ViewAssertions.matches(ViewMatchers.isDisplayed()), + 20, "attempt to resolve connected state"); } @Test public void test02_SettingsFragmentScreenshots() { startMainActivity(); - Espresso.onView(ViewMatchers.withId(R.id.drawer_layout)) + onView(withId(R.id.drawer_layout)) .check(ViewAssertions.matches(DrawerMatchers.isClosed(Gravity.LEFT))) // Left Drawer should be closed. .perform(DrawerActions.open()); // Open Drawer - Screengrab.screenshot("navigationDrawer"); + Screengrab.screenshot("05_navigationDrawer"); // Start the screen of your activity. - Espresso.onView(ViewMatchers.withId(R.id.advancedSettings)) + onView(withId(R.id.advancedSettings)) .perform(ViewActions.click()); - Screengrab.screenshot("settingsFragment"); + Screengrab.screenshot("06_settingsFragment"); } @Test public void test03_LocationSelectionFragmentScreenshots() { startMainActivity(); - Espresso.onView(ViewMatchers.withId(R.id.drawer_layout)) + onView(withId(R.id.drawer_layout)) .check(ViewAssertions.matches(DrawerMatchers.isClosed(Gravity.LEFT))) // Left Drawer should be closed. .perform(DrawerActions.open()); // Open Drawer - Espresso.onView(ViewMatchers.withId(R.id.manualGatewaySelection)) + onView(withId(R.id.manualGatewaySelection)) .perform(ViewActions.click()); - Screengrab.screenshot("GatewaySelectionFragment"); + Screengrab.screenshot("07_GatewaySelectionFragment"); } @Test - public void test04_AppExclusionFragmentScreenshots() { + public void test04_LanguageSelectionFragmentScreenshots() { startMainActivity(); - Espresso.onView(ViewMatchers.withId(R.id.drawer_layout)) + onView(withId(R.id.drawer_layout)) .check(ViewAssertions.matches(DrawerMatchers.isClosed(Gravity.LEFT))) // Left Drawer should be closed. .perform(DrawerActions.open()); // Open Drawer - Espresso.onView(ViewMatchers.withId(R.id.advancedSettings)).perform(ViewActions.click()); + onView(withId(R.id.language_switcher)) + .perform(ViewActions.click()); + + Screengrab.screenshot("08_LanguageSelectionFragment"); + } + + @Test + public void test05_AppExclusionFragmentScreenshots() { + startMainActivity(); + onView(withId(R.id.drawer_layout)) + .check(ViewAssertions.matches(DrawerMatchers.isClosed(Gravity.LEFT))) // Left Drawer should be closed. + .perform(DrawerActions.open()); // Open Drawer - Espresso.onView(ViewMatchers.withId(R.id.exclude_apps)).perform(ViewActions.click()); + onView(withId(R.id.advancedSettings)).perform(ViewActions.click()); + onView(withId(R.id.exclude_apps)).perform(ViewActions.click()); CustomInteractions.tryResolve( - Espresso.onData(Matchers.anything()).inAdapterView(ViewMatchers.withId(android.R.id.list)).atPosition(2), + onView(Matchers.allOf( + withId(R.id.list), + withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE) + )).perform(RecyclerViewActions.scrollToPosition(0)), ViewAssertions.matches(ViewMatchers.isDisplayed()), - 5); + 30, "waiting until app list appears"); - Screengrab.screenshot("App_Exclusion_Fragment"); + Screengrab.screenshot("09_App_Exclusion_Fragment"); } private void startMainActivity() { @@ -146,7 +218,7 @@ public class BitmaskTest { if (setupActivity != null) { ProviderSetupUtils.runProviderSetup(device, false, false, InstrumentationRegistry.getInstrumentation().getTargetContext()); } - Activity mainActivity = instrumentation.waitForMonitorWithTimeout(mainActivityMonitor, 1000); + Activity mainActivity = instrumentation.waitForMonitorWithTimeout(mainActivityMonitor, 1000L); assertNotNull(mainActivity); } } diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/ProviderSetupTest.java b/app/src/androidTest/java/se/leap/bitmaskclient/ProviderSetupTest.java index 133b834b..e8b65d3f 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/ProviderSetupTest.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/ProviderSetupTest.java @@ -6,24 +6,33 @@ import static androidx.test.espresso.action.ViewActions.click; import static androidx.test.espresso.action.ViewActions.replaceText; import static androidx.test.espresso.assertion.ViewAssertions.matches; import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; +import static androidx.test.espresso.matcher.ViewMatchers.isEnabled; +import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility; import static androidx.test.espresso.matcher.ViewMatchers.withId; import static androidx.test.espresso.matcher.ViewMatchers.withText; import static org.junit.Assert.assertNotNull; import static se.leap.bitmaskclient.base.models.Constants.SHARED_ENCRYPTED_PREFERENCES; import static utils.CustomInteractions.tryResolve; +import static utils.ProviderSetupUtils.isVerboseScreenshots; +import android.Manifest; import android.app.Activity; import android.app.Instrumentation; import android.content.Context; import android.content.Intent; +import android.os.Build; import androidx.test.espresso.ViewInteraction; -import androidx.test.ext.junit.rules.ActivityScenarioRule; +import androidx.test.espresso.matcher.ViewMatchers; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.filters.LargeTest; import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.rule.GrantPermissionRule; import androidx.test.uiautomator.UiDevice; +import androidx.test.uiautomator.UiObjectNotFoundException; +import org.hamcrest.Matchers; +import org.junit.Assume; import org.junit.Before; import org.junit.ClassRule; import org.junit.FixMethodOrder; @@ -31,13 +40,10 @@ import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; -import org.junit.Assume; -import se.leap.bitmaskclient.base.MainActivity; import se.leap.bitmaskclient.base.StartActivity; import se.leap.bitmaskclient.base.models.Provider; import se.leap.bitmaskclient.base.models.ProviderObservable; -import se.leap.bitmaskclient.base.utils.PreferenceHelper; import se.leap.bitmaskclient.providersetup.activities.SetupActivity; import tools.fastlane.screengrab.Screengrab; import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy; @@ -52,9 +58,8 @@ public class ProviderSetupTest { @ClassRule public static final LocaleTestRule localeTestRule = new LocaleTestRule(); - // @Rule - // public ActivityScenarioRule<SetupActivity> mActivityScenarioRule = - // new ActivityScenarioRule<>(SetupActivity.class); + @Rule + public GrantPermissionRule notificationPermissionRule = (Build.VERSION.SDK_INT >= 33) ? GrantPermissionRule.grant(Manifest.permission.POST_NOTIFICATIONS) : null; UiDevice device; @@ -73,39 +78,58 @@ public class ProviderSetupTest { // Assume the branding is not "custom" to skip this test when it is. Assume.assumeFalse("custom".equals(BuildConfig.FLAVOR_branding)); startSetupActivity(); - ProviderSetupUtils.runProviderSetup(device, true, false, InstrumentationRegistry.getInstrumentation().getTargetContext()); + ProviderSetupUtils.runProviderSelection(true); } @Test public void test02_setupProviderCircumvention() { startSetupActivity(); - ProviderSetupUtils.runProviderSetup(device, true, true, InstrumentationRegistry.getInstrumentation().getTargetContext()); + ProviderSetupUtils.runProviderSelection(false); + ProviderSetupUtils.runCircumventionSelection(isVerboseScreenshots(), true, false, InstrumentationRegistry.getInstrumentation().getTargetContext()); } @Test - public void test03_addManuallyNewProviderScreenshot() { + public void test03_addManuallyNewProviderScreenshot() throws UiObjectNotFoundException { if (!"normal".equals(BuildConfig.FLAVOR_branding)) { System.out.println("skipping custom provider url test"); return; } startSetupActivity(); - Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); ViewInteraction radioButtonSelection = tryResolve(onView(withText(R.string.add_provider)), matches(isDisplayed())); radioButtonSelection.perform(click()); onView(withId(R.id.edit_customProvider)).perform(replaceText("https://leapvpn.myserver.org")); tryResolve(onView(withId(R.id.edit_customProvider)), matches(withText("https://leapvpn.myserver.org"))); - Screengrab.screenshot("setup_custom_provider"); - onView(withId(R.id.setup_next_button)).perform(click()); + Screengrab.screenshot("043_setup_custom_provider"); + Screengrab.screenshot("043_setup_custom_provider"); + + } + + @Test + public void test04_addInviteCode() throws UiObjectNotFoundException { + if (!"normal".equals(BuildConfig.FLAVOR_branding)) { + System.out.println("skipping custom provider url test"); + return; + } + startSetupActivity(); - onView(withText(context.getString(R.string.use_standard_vpn, context.getString(R.string.app_name)))).perform(click()); - onView(withId(R.id.setup_next_button)).perform(click()); + ViewInteraction radioButtonSelection = tryResolve(onView(withText(R.string.enter_invite_code)), matches(isDisplayed())); + radioButtonSelection.perform(click()); + onView(withId(R.id.edit_customProvider)).perform(replaceText("obfsvpnintro://13.12.2.161:443/?cert=faXUc56JJAJP%2B0Gc2zHZX0I2RNXuwR0jz937PrpR%2FNopWkuJFkBQwN%2Bzm4ib%2BXvXxXxXxX&fqdn=mysecret.vpnserver.org&kcp=0&auth=_zYOreyzAh+x79j9Ab0DU3A==")); + + tryResolve(onView( + Matchers.allOf( + withId(R.id.syntax_check_result), + withText(R.string.validation_status_success)) + ), matches(isDisplayed()), 3); + tryResolve(onView( + Matchers.allOf( + withId(R.id.setup_next_button), + isEnabled()) + ), matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)), 3); + Screengrab.screenshot("044_setup_invite_code_provider"); + Screengrab.screenshot("044_setup_invite_code_provider"); - tryResolve( - onView(withText(context.getString(R.string.malformed_url, context.getString(R.string.app_name)))), - matches(isDisplayed()), - 20); - Screengrab.screenshot("setup_provider_error_dialog"); } private void startSetupActivity() { diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/suite/ScreenshotTest.java b/app/src/androidTest/java/se/leap/bitmaskclient/suite/ScreenshotTest.java index f3a8d73c..70e08cff 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/suite/ScreenshotTest.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/suite/ScreenshotTest.java @@ -12,8 +12,8 @@ import se.leap.bitmaskclient.ProviderSetupTest; @LargeTest @RunWith(Suite.class) @Suite.SuiteClasses({ - ProviderSetupTest.class, BitmaskTest.class, + ProviderSetupTest.class, }) public class ScreenshotTest { } diff --git a/app/src/androidTest/java/utils/CustomInteractions.java b/app/src/androidTest/java/utils/CustomInteractions.java index 4890c20c..35f8b48f 100644 --- a/app/src/androidTest/java/utils/CustomInteractions.java +++ b/app/src/androidTest/java/utils/CustomInteractions.java @@ -18,7 +18,11 @@ public class CustomInteractions { return tryResolve(viewInteraction, assertion, 10); } - public static @Nullable ViewInteraction tryResolve(ViewInteraction viewInteraction, ViewAssertion assertion, int maxTries) { + public static @Nullable ViewInteraction tryResolve(ViewInteraction viewInteraction, ViewAssertion assertion, int maxTries) { + return tryResolve(viewInteraction, assertion, maxTries, ""); + } + + public static @Nullable ViewInteraction tryResolve(ViewInteraction viewInteraction, ViewAssertion assertion, int maxTries, String message) { ViewInteraction resolvedViewInteraction = null; int attempt = 0; boolean hasFound = false; @@ -30,7 +34,7 @@ public class CustomInteractions { } hasFound = true; } catch (NoMatchingViewException exception) { - System.out.println("NoMatchingViewException - attempt: " + attempt + ". " + exception.getLocalizedMessage()); + System.out.println("NoMatchingViewException " + message +" - attempt: " + attempt + ". " + exception.getLocalizedMessage()); attempt++; if (attempt == maxTries) { throw exception; diff --git a/app/src/androidTest/java/utils/ProviderSetupUtils.java b/app/src/androidTest/java/utils/ProviderSetupUtils.java index 9b76ffbd..f72d8a50 100644 --- a/app/src/androidTest/java/utils/ProviderSetupUtils.java +++ b/app/src/androidTest/java/utils/ProviderSetupUtils.java @@ -12,10 +12,11 @@ import static utils.CustomInteractions.tryResolve; import android.content.Context; import android.net.VpnService; +import android.os.Bundle; import androidx.test.espresso.NoMatchingViewException; import androidx.test.espresso.ViewInteraction; -import androidx.test.espresso.matcher.ViewMatchers; +import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.uiautomator.UiDevice; import androidx.test.uiautomator.UiObject; import androidx.test.uiautomator.UiObjectNotFoundException; @@ -31,62 +32,11 @@ public class ProviderSetupUtils { public static void runProviderSetup(UiDevice device, boolean takeConfigurationScreenshots, boolean useCircumvention, Context targetContext) { try { - // ------- PROVIDER SELECTION -------------- - if ("normal".equals(BuildConfig.FLAVOR_branding)) { - System.out.println("next: provider selection"); - ViewInteraction radioButtonSelection = tryResolve(onView(withText("Riseup")), matches(isDisplayed())); - if (takeConfigurationScreenshots) Screengrab.screenshot("provider_selection"); - radioButtonSelection.perform(click()); - // next button click - onView(withText(R.string.next)).perform(click()); - } - - // ------- CIRCUMVENTION SELECTION -------------- - System.out.println("next: standard/circumvention selection"); - if (useCircumvention) { - onView(withText(targetContext.getString(R.string.use_circumvention_tech))).perform(click()); - } else { - onView(withText(targetContext.getString(R.string.use_standard_vpn, targetContext.getString(R.string.app_name)))).perform(click()); - } - if (takeConfigurationScreenshots) Screengrab.screenshot("circumvention_selection"); - - // ------- CONFIGURATION PROGRESS -------------- - System.out.println("next: configuring"); - onView(withText(R.string.next)).perform(click()); - tryResolve( - onView( - Matchers.allOf( - withText(R.string.configuring_provider), - withId(R.id.tv_title) - ) - ), - matches(isDisplayed()) - ); - if (takeConfigurationScreenshots) Screengrab.screenshot("configuring_provider"); - - // ------- VPN PERMISSON DIALOG -------------- - boolean showPermissionDialog = false; - if (VpnService.prepare(getApplicationContext()) != null) { - showPermissionDialog = true; - tryResolve(onView(withText(R.string.upcoming_connection_request_description)), matches(isDisplayed()), useCircumvention ? 180 : 20); - System.out.println("next: next permission request"); - if (takeConfigurationScreenshots) Screengrab.screenshot("vpn_permission_rationale"); - onView(withText(R.string.next)).perform(click()); - UiObject okButton = device.findObject(new UiSelector().packageName("com.android.vpndialogs").resourceId("android:id/button1")); - okButton.waitForExists(30000); - okButton.click(); - device.waitForWindowUpdate("com.android.vpndialogs", 1000); - } - - // ------- START VPN -------------- - System.out.println("next: perform click on VPN button"); - ViewInteraction interaction = tryResolve(onView(withTagValue(Matchers.is("button_setup_circle_custom"))), matches(isDisplayed()), useCircumvention && !showPermissionDialog ? 180 : 20); - if (takeConfigurationScreenshots) { - Screengrab.screenshot("all_set_start_vpn"); - } else { - // we only want to start the VPN in case we're not running the ProviderSetupTest - interaction.perform(click()); - } + runProviderSelection(takeConfigurationScreenshots); + runCircumventionSelection(takeConfigurationScreenshots, useCircumvention, true, targetContext); + boolean showPermissionDialog = runVPNPermissionApproval(device, takeConfigurationScreenshots, useCircumvention); + runConfiguration(takeConfigurationScreenshots); + runStartVPN(takeConfigurationScreenshots, useCircumvention, showPermissionDialog); } catch (NoMatchingViewException e) { // it might be that the provider was already configured, so we print the stack // trace here and try to continue @@ -95,4 +45,77 @@ public class ProviderSetupUtils { e.printStackTrace(); } } + + public static void runStartVPN(boolean takeConfigurationScreenshots, boolean useCircumvention, boolean showPermissionDialog) { + // ------- START VPN -------------- + System.out.println("next: perform click on VPN button"); + ViewInteraction interaction = tryResolve(onView(withTagValue(Matchers.is("button_setup_circle_custom"))), matches(isDisplayed()), useCircumvention && !showPermissionDialog ? 180 : 20); + if (takeConfigurationScreenshots) { + Screengrab.screenshot("all_set_start_vpn"); + } else { + // we only want to start the VPN in case we're not running the ProviderSetupTest + interaction.perform(click()); + } + } + + public static boolean runVPNPermissionApproval(UiDevice device, boolean takeConfigurationScreenshots, boolean useCircumvention) throws UiObjectNotFoundException { + // ------- VPN PERMISSON DIALOG -------------- + if (VpnService.prepare(getApplicationContext()) != null) { + tryResolve(onView(withId(R.id.tv_title)), matches(withText(R.string.title_upcoming_connection_request))); + Screengrab.screenshot("permissions_screen"); + onView(withId(R.id.setup_next_button)).perform(click()); + + UiObject okButton = device.findObject(new UiSelector().packageName("com.android.vpndialogs").resourceId("android:id/button1")); + okButton.waitForExists(30000); + okButton.click(); + device.waitForWindowUpdate("com.android.vpndialogs", 1000); + return true; + } + return false; + } + + public static void runConfiguration(boolean takeConfigurationScreenshots) { + // ------- CONFIGURATION PROGRESS -------------- + System.out.println("next: configuring"); + tryResolve( + onView( + Matchers.allOf( + withText(R.string.configuring_provider), + withId(R.id.tv_title) + ) + ), + matches(isDisplayed()) + ); + if (takeConfigurationScreenshots) Screengrab.screenshot("configuring_provider"); + } + + public static void runCircumventionSelection(boolean takeConfigurationScreenshots, boolean useCircumvention, boolean clickNext, Context targetContext) { + // ------- CIRCUMVENTION SELECTION -------------- + if (useCircumvention) { + onView(withText(targetContext.getString(R.string.use_circumvention_tech))).perform(click()); + } else { + onView(withText(targetContext.getString(R.string.use_standard_vpn, targetContext.getString(R.string.app_name)))).perform(click()); + } + if (takeConfigurationScreenshots) Screengrab.screenshot("041_circumvention_selection"); + if (clickNext) onView(withText(R.string.next)).perform(click()); + } + + + public static void runProviderSelection(boolean takeConfigurationScreenshots) { + // ------- PROVIDER SELECTION -------------- + if ("normal".equals(BuildConfig.FLAVOR_branding)) { + System.out.println("next: provider selection"); + ViewInteraction radioButtonSelection = tryResolve(onView(withText("CoopVPN Beta")), matches(isDisplayed())); + radioButtonSelection.perform(click()); + if (takeConfigurationScreenshots) Screengrab.screenshot("040_provider_selection"); + // next button click + onView(withText(R.string.next)).perform(click()); + } + } + + public static boolean isVerboseScreenshots() { + Bundle arguments = InstrumentationRegistry.getArguments(); + String verbose = arguments.getString("verbose_screenshots", "false"); + return "true".equalsIgnoreCase(verbose); + } } |
