diff options
author | Parménides GV <parmegv@sdf.org> | 2015-04-23 16:41:03 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2015-04-23 16:41:03 +0200 |
commit | 3f824156982a152ddbabb40000e584ffe92293b7 (patch) | |
tree | 64491df01dc0627f5b9fcd12691ddfb665e01389 /app/src/androidTest/java | |
parent | 6d8c46a683f4061730256815dfb9ab635e0729b2 (diff) |
Test to check that the vpn button is shown
Fixed more tests, broken due to previous pullreqs...
Diffstat (limited to 'app/src/androidTest/java')
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java | 1 | ||||
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java | 69 |
2 files changed, 31 insertions, 39 deletions
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 3a6cd754..ff32f5aa 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java @@ -1,6 +1,5 @@ package se.leap.bitmaskclient.test; -import android.app.Instrumentation; import android.test.*; import android.widget.*; 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 ee217e15..42cabea9 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java @@ -1,9 +1,9 @@ package se.leap.bitmaskclient.test; import android.content.*; -import android.graphics.Rect; +import android.graphics.*; import android.test.*; -import android.view.View; +import android.view.*; import android.widget.*; import com.robotium.solo.*; @@ -11,6 +11,7 @@ import com.robotium.solo.*; import java.io.*; import de.blinkt.openvpn.activities.*; +import mbanje.kurt.fabbutton.FabButton; import se.leap.bitmaskclient.*; public class testDashboardIntegration extends ActivityInstrumentationTestCase2<Dashboard> { @@ -43,19 +44,19 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D * I cannot automate that dialog. */ public void testOnOffOpenVpn() { - solo.clickOnView(solo.getView(R.id.eipSwitch)); + clickVpnImage(); turningEipOn(); - solo.clickOnView(solo.getView(R.id.eipSwitch)); + clickVpnImage(); turningEipOff(); - solo.clickOnView(solo.getView(R.id.eipSwitch)); + clickVpnImage(); turningEipOn(); - solo.clickOnView(solo.getView(R.id.eipSwitch)); + clickVpnImage(); turningEipOff(); - /*solo.clickOnView(solo.getView(R.id.eipSwitch)); + /*clickVpnImage();; turningEipOn(); turnNetworkOff(); @@ -64,6 +65,10 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D } + private void clickVpnImage() { + solo.clickOnView(solo.getView(R.id.vpn_Status_Image)); + } + private void turningEipOn() { assertAuthenticating(); int max_seconds_until_connected = 30; @@ -122,12 +127,12 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D private void logIn(String username, String password) { solo.enterText(0, username); solo.enterText(1, password); - solo.clickOnText("Log In"); + solo.clickOnText(solo.getString(R.string.login_button)); solo.waitForDialogToClose(); } private void assertSuccessfulLogin() { - assertTrue(solo.waitForText("is logged in")); + assertTrue(solo.waitForText(solo.getString(R.string.logged_in_user_status))); } private void logOut() { @@ -161,45 +166,33 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D } public void testEveryProvider() { - changeProvider("demo.bitmask.net"); - connectVpn(); - disconnectVpn(); - - changeProvider("riseup.net"); - connectVpn(); - disconnectVpn(); + changeProvider("demo.bitmask.net"); + clickVpnImage(); + turningEipOn(); + clickVpnImage(); + turningEipOff(); - changeProvider("calyx.net"); - connectVpn(); - disconnectVpn(); + changeProvider("riseup.net"); + clickVpnImage(); + turningEipOn(); + clickVpnImage(); + turningEipOff(); + + changeProvider("calyx.net"); + clickVpnImage(); + turningEipOn(); + clickVpnImage(); + turningEipOff(); } private void changeProvider(String provider) { tapSwitchProvider(); solo.clickOnText(provider); useRegistered(); - solo.waitForText("Downloading VPN certificate"); + solo.waitForText(solo.getString(R.string.downloading_certificate_message)); assertDisconnected(); } - private void connectVpn() { - Switch vpn_switch = (Switch)solo.getView(R.id.eipSwitch); - assertFalse(vpn_switch.isChecked()); - - solo.clickOnView(vpn_switch); - turningEipOn(); - } - - private void disconnectVpn() { - Switch vpn_switch = (Switch)solo.getView(R.id.eipSwitch); - assertTrue(vpn_switch.isChecked()); - - solo.clickOnView(vpn_switch); - solo.clickOnText("Yes"); - turningEipOff(); - - } - private void useRegistered() { String text = solo.getString(R.string.signup_or_login_button); clickAndWaitForDashboard(text); |