summaryrefslogtreecommitdiff
path: root/app/src/androidTest/legacy/TestDashboardIntegration.java
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2018-02-01 17:48:50 +0100
committercyBerta <cyberta@riseup.net>2018-02-01 17:48:50 +0100
commit0161973d77ead085f99dc64d8a6dfb2ff3d192c0 (patch)
treee9f517c5794dac172b7cdaa468259d27a9219bf8 /app/src/androidTest/legacy/TestDashboardIntegration.java
parent6c9a6fae70ef35d2e04466f4118e1572b38bccfc (diff)
parenta43778e930041ab26e4d70348553fb98c3f6872d (diff)
Merge branch '#8818_tests_for_drawer' into #8832_update_ics-openvpn
Diffstat (limited to 'app/src/androidTest/legacy/TestDashboardIntegration.java')
-rw-r--r--app/src/androidTest/legacy/TestDashboardIntegration.java60
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();
+ }
+ }
+}