diff options
author | Parménides GV <parmegv@sdf.org> | 2015-03-30 17:53:50 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2015-03-30 17:53:50 +0200 |
commit | 76396cda955c3681db9aa86224f465e3fd2ebf4b (patch) | |
tree | ee2bfff66ed35f3df5eb546209d549aae4afd271 | |
parent | 5734bbe4e7e509b81c6670c8a40225997593ddef (diff) |
testEveryProvider() coded and working.
Calyx fails.
3 files changed, 71 insertions, 24 deletions
diff --git a/app/build.gradle b/app/build.gradle index 4d3c5b9c..4441cafa 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -39,7 +39,7 @@ android { } dependencies { - androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.2.1' + androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.3.1' compile 'com.jakewharton:butterknife:6.0.0+' provided 'com.squareup.dagger:dagger-compiler:1.2.2+' compile 'com.github.pedrovgs:renderers:1.3+' 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"); }*/ |