diff options
Diffstat (limited to 'app/src/androidTest/java')
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java | 25 | ||||
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java | 68 |
2 files changed, 70 insertions, 23 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 c01e21c6..efb843f7 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java @@ -40,7 +40,7 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co @Override protected void tearDown() throws Exception { - solo.finishOpenedActivities(); + } public void testListProviders() { @@ -115,6 +115,11 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co clickAndWaitForDashboard(text); } + private void clickAndWaitForDashboard(String click_text) { + solo.clickOnText(click_text); + assertTrue(solo.waitForActivity(Dashboard.class, 5000)); + } + protected void toDashboardRegistered(String provider) { selectProvider(provider); useRegistered(); @@ -146,23 +151,6 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co assertTrue(solo.waitForText(message)); } - private void clickAndWaitForDashboard(String click_text) { - solo.clickOnText(click_text); - solo.waitForText(solo.getString(R.string.title_activity_dashboard)); - } - - public void testEveryProvider() { - toDashboardAnonymously("demo.bitmask.net"); - connectAndComeBack(); - - toDashboardRegistered("calyx.net"); - connectAndComeBack(); - - toDashboardRegistered("riseup.net"); - connectAndComeBack(); - - } - private void connectAndComeBack() { solo.clickOnView(solo.getView(R.id.eipSwitch)); if(!solo.waitForText(solo.getString(R.string.eip_state_connected))) @@ -173,6 +161,5 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co fail(); solo.clickOnMenuItem(solo.getString(R.string.switch_provider_menu_option)); - } } 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 8af20dea..bcabc46c 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java @@ -2,6 +2,7 @@ package se.leap.bitmaskclient.test; import android.content.*; import android.test.*; +import android.widget.*; import com.robotium.solo.*; @@ -108,6 +109,7 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D public void testLogInAndOut() { long milliseconds_to_log_in = 40 * 1000; + solo.clickOnActionBarItem(R.id.login_button); logIn("parmegvtest1", " S_Zw3'-"); solo.waitForDialogToClose(milliseconds_to_log_in); assertSuccessfulLogin(); @@ -116,7 +118,6 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D } private void logIn(String username, String password) { - solo.clickOnActionBarItem(R.id.login_button); solo.enterText(0, username); solo.enterText(1, password); solo.clickOnText("Log In"); @@ -124,8 +125,7 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D } private void assertSuccessfulLogin() { - String message = solo.getString(R.string.succesful_authentication_message); - assertTrue(solo.waitForText(message)); + assertTrue(solo.waitForText("is logged in")); } private void logOut() { @@ -149,11 +149,71 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D } public void testSwitchProvider() { + tapSwitchProvider(); + solo.goBack(); + } + + private void tapSwitchProvider() { solo.clickOnMenuItem(solo.getString(R.string.switch_provider_menu_option)); solo.waitForActivity(ConfigurationWizard.class); - solo.goBack(); } + public void testEveryProvider() { + changeProvider("demo.bitmask.net"); + connectVpn(); + disconnectVpn(); + + changeProvider("calyx.net"); + connectVpn(); + disconnectVpn(); + + changeProvider("riseup.net"); + connectVpn(); + disconnectVpn(); + } + + private void changeProvider(String provider) { + tapSwitchProvider(); + solo.clickOnText(provider); + useRegistered(); + } + + 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); + login(); + } + + private void clickAndWaitForDashboard(String click_text) { + solo.clickOnText(click_text); + assertTrue(solo.waitForActivity(Dashboard.class, 5000)); + } + + private void login() { + long milliseconds_to_log_in = 40 * 1000; + logIn("parmegvtest10", "holahola2"); + solo.waitForDialogToClose(milliseconds_to_log_in); + assertSuccessfulLogin(); + } + /*public void testReboot() { runAdbCommand("shell am broadcast -a android.intent.action.BOOT_COMPLETED"); }*/ |