diff options
author | Parménides GV <parmegv@sdf.org> | 2015-06-24 19:05:39 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2015-06-24 19:05:39 +0200 |
commit | ffc2a0cbae78aa71e7ca5a64c76b75f1c5bba664 (patch) | |
tree | 26ead8a26a3dee60dc63fc637c6ff9b30e30eccf | |
parent | e533cf6939e3ea4233aa8a82812f8ce5fcb565ca (diff) |
Tuned some times, refactoring tests
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboardFragment.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java) | 6 | ||||
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/Screenshot.java | 3 | ||||
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java | 2 | ||||
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java | 5 | ||||
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java | 12 | ||||
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testUserStatusFragment.java | 5 | ||||
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java | 11 | ||||
-rw-r--r-- | app/src/main/AndroidManifest.xml | 3 | ||||
m--------- | ics-openvpn | 0 |
9 files changed, 19 insertions, 28 deletions
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboardFragment.java index 9a9131fd..aef968b8 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboardFragment.java @@ -9,20 +9,21 @@ import com.robotium.solo.*; import se.leap.bitmaskclient.*; -public abstract class BaseTestDashboard extends ActivityInstrumentationTestCase2<Dashboard> { +public abstract class BaseTestDashboardFragment extends ActivityInstrumentationTestCase2<Dashboard> { Solo solo; Context context; UserStatusTestController user_status_controller; VpnTestController vpn_controller; - public BaseTestDashboard() { super(Dashboard.class); } + public BaseTestDashboardFragment() { super(Dashboard.class); } @Override protected void setUp() throws Exception { super.setUp(); context = getInstrumentation().getContext(); solo = new Solo(getInstrumentation(), getActivity()); + Screenshot.initialize(solo); user_status_controller = new UserStatusTestController(solo); vpn_controller = new VpnTestController(solo); ConnectionManager.setMobileDataEnabled(true, context); @@ -43,6 +44,7 @@ public abstract class BaseTestDashboard extends ActivityInstrumentationTestCase2 } private void useRegistered() { + solo.waitForFragmentById(R.id.provider_detail_fragment); String text = solo.getString(R.string.signup_or_login_button); clickAndWaitForDashboard(text); user_status_controller.logIn("parmegvtest10", "holahola2"); diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/Screenshot.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/Screenshot.java index 91d51402..ade28b73 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/Screenshot.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/Screenshot.java @@ -26,8 +26,7 @@ public class Screenshot { } public static void take() { - sleepBefore(); - solo.takeScreenshot(default_name + "_" + getTimeStamp()); + take(default_name + "_" + getTimeStamp()); } public static void takeWithSleep() { diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java index 25d81da1..39ab37dd 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java @@ -79,7 +79,7 @@ public class VpnTestController { a = whole_icon != null ? (ProgressRingView) getVpnWholeIcon().findViewById(R.id.fabbutton_ring) : new ProgressRingView(solo.getCurrentActivity()); - BaseTestDashboard.isShownWithinConfinesOfVisibleScreen(a); + BaseTestDashboardFragment.isShownWithinConfinesOfVisibleScreen(a); } private boolean iconShowsConnected() { diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java index 931457ee..8b897b96 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java @@ -29,6 +29,7 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co protected void setUp() throws Exception { super.setUp(); solo = new Solo(getInstrumentation(), getActivity()); + Screenshot.initialize(solo); //ConnectionManager.setMobileDataEnabled(true, solo.getCurrentActivity().getApplicationContext()); } @@ -62,17 +63,21 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co } public void testSelectProvider() { + Screenshot.take("Initial CW"); selectProvider("demo.bitmask.net"); } private void selectProvider(String provider) { solo.clickOnText(provider); + Screenshot.setTimeToSleep(1); + Screenshot.take("Configuring provider"); waitForProviderDetails(); } private void waitForProviderDetails() { String text = solo.getString(R.string.provider_details_fragment_title); assertTrue("Provider details dialog did not appear", solo.waitForText(text, 1, 60*1000)); + Screenshot.take("Provider details"); } public void testAddNewProvider() { diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java index fea6bf77..ece70c59 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java @@ -1,20 +1,10 @@ package se.leap.bitmaskclient.test; -import android.graphics.*; -import android.graphics.drawable.Drawable; -import android.widget.Button; - -import com.robotium.solo.*; - import java.io.*; -import de.blinkt.openvpn.activities.*; -import mbanje.kurt.fabbutton.CircleImageView; -import mbanje.kurt.fabbutton.FabButton; -import mbanje.kurt.fabbutton.ProgressRingView; import se.leap.bitmaskclient.*; -public class testDashboardIntegration extends BaseTestDashboard { +public class testDashboardIntegration extends BaseTestDashboardFragment { @Override protected void tearDown() throws Exception { diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testUserStatusFragment.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testUserStatusFragment.java index 7e791d16..2031f365 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testUserStatusFragment.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testUserStatusFragment.java @@ -1,6 +1,6 @@ package se.leap.bitmaskclient.test; -public class testUserStatusFragment extends BaseTestDashboard { +public class testUserStatusFragment extends BaseTestDashboardFragment { public final String TAG = testUserStatusFragment.class.getName(); @@ -18,7 +18,10 @@ public class testUserStatusFragment extends BaseTestDashboard { public void testLogInAndOut() { user_status_controller.clickUserSessionButton(); + Screenshot.take("Login dialog"); user_status_controller.logIn(test_username, test_password); + Screenshot.setTimeToSleep(2); + Screenshot.takeWithSleep("Logging in"); user_status_controller.logOut(); } diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java index d23be601..12cb8c14 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java @@ -1,21 +1,14 @@ package se.leap.bitmaskclient.test; -public class testVpnFragment extends BaseTestDashboard { - - @Override - protected void setUp() throws Exception { - super.setUp(); - Screenshot.initialize(solo); - } +public class testVpnFragment extends BaseTestDashboardFragment { /** * This test will fail if Android does not trust VPN connection. * I cannot automate that dialog. */ public void testOnOffOpenVpn() { - Screenshot.take("Initial UI"); vpn_controller.clickVpnButton(); - Screenshot.setTimeToSleep(5); + Screenshot.setTimeToSleep(8); Screenshot.takeWithSleep("Turning VPN on"); vpn_controller.turningEipOn(); Screenshot.setTimeToSleep(0.5); diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ce89a317..ce6d5ddd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -23,8 +23,7 @@ <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" - android:maxSdkVersion="18"/> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-sdk android:minSdkVersion="14" diff --git a/ics-openvpn b/ics-openvpn -Subproject 23314f5ec13d14c220096f6d7d44932b45e4fc3 +Subproject 0c5ab6b91844319433932b67e97fbb23649ca00 |