diff options
author | Parménides GV <parmegv@sdf.org> | 2015-04-27 17:10:20 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2015-04-27 17:10:20 +0200 |
commit | 8707f9e9a07f8c53955df14ef9b26d13a0eb60da (patch) | |
tree | e39f6e0977439de8be63aebac34bc4daeee47fea /app/src/androidTest | |
parent | f349ab1a50d807afd49d8bef912438d64f6f6db8 (diff) |
testEveryProvider also works
Diffstat (limited to 'app/src/androidTest')
-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/testDashboardIntegration.java | 45 |
2 files changed, 23 insertions, 24 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 ff32f5aa..6d267e6e 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java @@ -72,7 +72,7 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co private void waitForProviderDetails() { String text = solo.getString(R.string.provider_details_fragment_title); - assertTrue("Provider details dialog did not appear", solo.waitForText(text)); + assertTrue("Provider details dialog did not appear", solo.waitForText(text, 1, 40*1000)); } 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 68416b4a..06fe0a42 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java @@ -4,6 +4,7 @@ import android.content.*; import android.graphics.*; import android.test.*; import android.view.*; +import android.widget.Toast; import com.robotium.solo.*; @@ -118,18 +119,17 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D private void okToBrowserWarning() { solo.waitForDialogToOpen(); - String yes = solo.getString(R.string.yes); - solo.clickOnText(yes); + clickYes(); } - private void sayOkToDisconnect() { - assertTrue(solo.waitForActivity(DisconnectVPN.class)); + private void clickYes() { String yes = solo.getString(android.R.string.yes); solo.clickOnText(yes); } - private void assertDisconnected() { - assertTrue(iconDisconnected()); + private void sayOkToDisconnect() { + assertTrue(solo.waitForActivity(DisconnectVPN.class)); + clickYes(); } private boolean iconDisconnected() { @@ -201,31 +201,31 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D } public void testEveryProvider() { - changeProvider("demo.bitmask.net"); - clickVpnImage(); - turningEipOn(); - clickVpnImage(); - turningEipOff(); - - changeProvider("riseup.net"); - clickVpnImage(); - turningEipOn(); - clickVpnImage(); - turningEipOff(); + changeAndTestProvider("demo.bitmask.net"); + changeAndTestProvider("riseup.net"); + changeAndTestProvider("calyx.net"); + } - changeProvider("calyx.net"); + private void changeAndTestProvider(String provider) { + changeProvider(provider); + sleep(1); clickVpnImage(); turningEipOn(); clickVpnImage(); turningEipOff(); } + private void sleep(int seconds) { + try { + Thread.sleep(seconds * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } private void changeProvider(String provider) { - tapSwitchProvider(); + tapSwitchProvider(); solo.clickOnText(provider); - useRegistered(); - solo.waitForText(solo.getString(R.string.downloading_certificate_message)); - assertDisconnected(); + useRegistered(); } private void useRegistered() { @@ -245,7 +245,6 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D solo.waitForDialogToClose(milliseconds_to_log_in); assertSuccessfulLogin(); } - public void testVpnIconIsDisplayed() { assertTrue(isShownWithinConfinesOfVisibleScreen(getVpnButton())); } |