diff options
-rw-r--r-- | CHANGELOG | 7 | ||||
-rw-r--r-- | README.md | 15 | ||||
-rw-r--r-- | app/build.gradle | 8 | ||||
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java | 2 | ||||
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboard.java | 76 | ||||
-rw-r--r-- | app/src/main/AndroidManifest.xml | 4 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/EIP.java | 2 |
7 files changed, 84 insertions, 30 deletions
@@ -1,3 +1,10 @@ +0.5.4 July 21 2014 - the "meetup" release +Features +- Renewal of the certificate soon enough +- After signing up, eip restarts to use the new certificate +- EIP profiles are named according to their locations +- Developers: tests run, and network tests are more intensive + 0.5.3 June 27 2014- the "beautiful oak" release Features - Updated ics-openvpn (again). @@ -62,6 +62,21 @@ The resulting apk(s) will be in `app/build/apk`. * `Import project` => select bitmask_android top folder +## Running tests + +To run the automated tests: + 1. Run an emulator + 2. Unlock Android + 3. Issue the command ./gradlew connectedCheck + 4. Pay attention and check the "Trust this app" checkbox, if you don't do so tests won't run. + +Due to the nature of some tests, adb will lose its connectivity and you won't receive any tests results. To look for failed tests, do the following: + 1. adb kill-server + 2. adb logcat | less + 3. Look for: "failed: test" + +We'll polish this process soon, but right now that's what we're doing (well, in fact, we run "adb logcat" in Emacs and then search "failed: test" in the corresponding buffer ;) ). + ## Acknowledgements This project bases its work in [ics-openvpn project](https://code.google.com/p/ics-openvpn/). diff --git a/app/build.gradle b/app/build.gradle index a57a2763..c4fdc44b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,13 +2,12 @@ apply plugin: 'android' android { compileSdkVersion 19 - buildToolsVersion "19.1.0" + buildToolsVersion "20" defaultConfig { minSdkVersion 14 targetSdkVersion 19 - testPackageName "se.leap.bitmaskclient.test" testInstrumentationRunner "android.test.InstrumentationTestRunner" } @@ -47,8 +46,9 @@ android { } dependencies { - androidTestCompile 'com.android.support:support-v4:+' - androidTestCompile 'com.jayway.android.robotium:robotium-solo:4.3.1' + // androidTestCompile 'com.android.support:support-v4:20+' + // androidTestCompile 'com.android.support:appcompat-v7:20.+' + androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.2.1' compile 'com.intellij:annotations:12.0' } 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 8ddfbc57..229c3452 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java @@ -2,7 +2,7 @@ package se.leap.bitmaskclient.test; import android.test.ActivityInstrumentationTestCase2; import android.widget.ListView; -import com.jayway.android.robotium.solo.Solo; +import com.robotium.solo.Solo; import java.io.IOException; import se.leap.bitmaskclient.AboutActivity; import se.leap.bitmaskclient.ConfigurationWizard; diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboard.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboard.java index bbc3e97d..fdf4f135 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboard.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboard.java @@ -7,7 +7,9 @@ import android.content.IntentFilter; import android.provider.Settings; import android.test.ActivityInstrumentationTestCase2; import android.util.Log; -import com.jayway.android.robotium.solo.Solo; +import com.robotium.solo.Solo; + +import de.blinkt.openvpn.activities.DisconnectVPN; import se.leap.bitmaskclient.ConfigurationWizard; import se.leap.bitmaskclient.Dashboard; import se.leap.bitmaskclient.R; @@ -38,28 +40,58 @@ public class testDashboard extends ActivityInstrumentationTestCase2<Dashboard> { * I cannot automate that dialog. */ public void testOnOffOpenVpn() { - solo.clickOnView(solo.getView(R.id.eipSwitch)); - if(!solo.waitForText(getActivity().getString(R.string.eip_status_start_pending))) - fail(); - if(!solo.waitForText(getActivity().getString(R.string.state_auth))) - fail(); - if(!solo.waitForText(getActivity().getString(R.string.eip_state_connected), 1, 30*1000)) - fail(); - - solo.clickOnView(solo.getView(R.id.eipSwitch)); - if(!solo.waitForText(getActivity().getString(R.string.eip_state_not_connected))) - fail(); - - /*ConnectionManager.setMobileDataEnabled(false, solo.getCurrentActivity().getApplicationContext()); - - solo.clickOnView(solo.getView(R.id.eipSwitch)); - if(!solo.waitForText(getActivity().getString(R.string.eip_status_start_pending))) - fail(); - if(!solo.waitForText(getActivity().getString(R.string.state_nonetwork))) - fail(); - */ + solo.clickOnView(solo.getView(R.id.eipSwitch)); + testEipTurningOn(); + + solo.clickOnView(solo.getView(R.id.eipSwitch)); + testEipTurningOff(); + + solo.clickOnView(solo.getView(R.id.eipSwitch)); + testEipTurningOn(); + + solo.clickOnView(solo.getView(R.id.eipSwitch)); + testEipTurningOff(); + + solo.clickOnView(solo.getView(R.id.eipSwitch)); + testEipTurningOn(); + + solo.clickOnView(solo.getView(R.id.eipSwitch)); + testEipTurningOff(); + + solo.clickOnView(solo.getView(R.id.eipSwitch)); + testEipTurningOn(); + + testEipIsOnNoNetwork(); + } - + + private void testEipTurningOn() { + if(!solo.waitForText(getActivity().getString(R.string.state_auth))) + fail(); + if(!solo.waitForText(getActivity().getString(R.string.eip_state_connected), 1, 30*1000)) + fail(); + solo.sleep(2*1000); + } + + private void testEipTurningOff() { + sayOkToDisconnect(); + if(!solo.waitForText(getActivity().getString(R.string.eip_state_not_connected))) + fail(); + solo.sleep(2*1000); + } + + private void sayOkToDisconnect() { + if(!solo.waitForActivity(DisconnectVPN.class)) + fail(); + solo.clickOnText(getActivity().getString(android.R.string.yes)); + } + + private void testEipIsOnNoNetwork() { + ConnectionManager.setMobileDataEnabled(false, solo.getCurrentActivity().getApplicationContext()); + if(!solo.waitForText(getActivity().getString(R.string.eip_state_not_connected), 1, 15*1000)) + fail(); + } + public void testLogInAndOut() { long miliseconds_to_log_in = 40 * 1000; solo.clickOnActionBarItem(R.id.login_button); diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f73d59cb..a90d6396 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -17,8 +17,8 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="se.leap.bitmaskclient" - android:versionCode="84" - android:versionName="0.5.3" > + android:versionCode="86" + android:versionName="0.5.4" > <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> diff --git a/app/src/main/java/se/leap/bitmaskclient/EIP.java b/app/src/main/java/se/leap/bitmaskclient/EIP.java index 0b43f9e1..7374d5ed 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EIP.java +++ b/app/src/main/java/se/leap/bitmaskclient/EIP.java @@ -445,7 +445,7 @@ public final class EIP extends IntentService { } catch (JSONException e) { Log.v(TAG,"Couldn't read gateway name for profile creation! Returning original name = " + mName); e.printStackTrace(); - return mName; + return (mName != null) ? mName : ""; } } |