diff options
author | cyBerta <cyberta@riseup.net> | 2018-02-06 16:28:34 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2018-02-06 16:28:34 +0100 |
commit | 3d827e7295d37ecb25332b39057338496f6f970d (patch) | |
tree | f8c5272e125ed9abae72fb3598d25b1c09f06f89 /app/src/androidTest/legacy/TestDashboardIntegration.java | |
parent | 646e2ec7b868920f71c29243d2bbeb13deb811e3 (diff) | |
parent | edd34192484f4eb618fdcc2a68b18168c155d63c (diff) |
Merge branch 'origin_0.9.8' into 8823_cw_tablet_layout
Diffstat (limited to 'app/src/androidTest/legacy/TestDashboardIntegration.java')
-rw-r--r-- | app/src/androidTest/legacy/TestDashboardIntegration.java | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/app/src/androidTest/legacy/TestDashboardIntegration.java b/app/src/androidTest/legacy/TestDashboardIntegration.java new file mode 100644 index 00000000..ad2b4a00 --- /dev/null +++ b/app/src/androidTest/legacy/TestDashboardIntegration.java @@ -0,0 +1,60 @@ +package se.leap.bitmaskclient.test; + +import java.io.*; + +import se.leap.bitmaskclient.R; + +public class TestDashboardIntegration extends BaseTestDashboardFragment { + + @Override + protected void tearDown() throws Exception { + solo.finishOpenedActivities(); + } + + public void testSwitchProvider() { + tapSwitchProvider(); + solo.goBack(); + } + + public void testShowAbout() { + showAbout(); + solo.goBack(); + showAbout(); + solo.goBack(); + } + + private void showAbout() { + clickAbout(); + String text_unique_to_about = solo.getString(R.string.repository_url_text); + solo.waitForText(text_unique_to_about); + } + + private void clickAbout() { + String menu_item = solo.getString(R.string.about); + solo.clickOnMenuItem(menu_item); + } + + private void turnNetworkOff() { + ConnectionManager.setMobileDataEnabled(false, context); + if (!solo.waitForText(getActivity().getString(R.string.eip_state_not_connected), 1, 15 * 1000)) + fail(); + } + + private void restartAdbServer() { + runAdbCommand("kill-server"); + runAdbCommand("start-server"); + } + + /*public void testReboot() { + runAdbCommand("shell am broadcast -a android.intent.action.BOOT_COMPLETED"); + }*/ + + private void runAdbCommand(String adb_command) { + try { + String command = "adb " + adb_command; + Runtime.getRuntime().exec(command).waitFor(); + } catch (IOException | InterruptedException e) { + e.printStackTrace(); + } + } +} |