summaryrefslogtreecommitdiff
path: root/app/src/androidTest
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/androidTest')
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/TestConfigurationWizard.java36
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java2
2 files changed, 28 insertions, 10 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 90b8b839..12e88af8 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestConfigurationWizard.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestConfigurationWizard.java
@@ -14,7 +14,6 @@ import se.leap.bitmaskclient.R;
public class TestConfigurationWizard extends ActivityInstrumentationTestCase2<ConfigurationWizard> {
private Solo solo;
- private static int added_providers;
public TestConfigurationWizard() {
super(ConfigurationWizard.class);
@@ -34,11 +33,14 @@ public class TestConfigurationWizard extends ActivityInstrumentationTestCase2<Co
super.tearDown();
}
- public void testListProviders() {
+ /**
+ * Tests should run independently from each other. We need a better approach to test the amount of providers added
+ */
+ /*public void testListProviders() {
assertEquals(solo.getCurrentViews(ListView.class).size(), 1);
assertEquals("Number of available providers differ", predefinedProviders() + added_providers, shownProviders());
- }
+ }*/
private int shownProviders() {
return solo.getCurrentViews(ListView.class).get(0).getCount();
@@ -76,24 +78,40 @@ public class TestConfigurationWizard extends ActivityInstrumentationTestCase2<Co
public void testAddNewProvider() {
//addProvider("calyx.net");
- addProvider("riseup.net");
+ addProvider("riseup.net", true);
+ }
+
+ public void testAddFalseProviderReturning404() {
+ //addProvider("calyx.net");
+ addProvider("startpage.com", false);
+ }
+
+ public void testAddFalseProviderReturning200() {
+ //addProvider("calyx.net");
+ addProvider("test.com", false);
}
- private void addProvider(String url) {
- boolean is_new_provider = !solo.searchText(url);
+ private void addProvider(String url, boolean expectSuccess) {
- if (is_new_provider)
- added_providers = added_providers + 1;
solo.clickOnActionBarItem(R.id.new_provider);
solo.enterText(0, url);
if ( BuildConfig.FLAVOR.equals("insecure")) {
solo.clickOnCheckBox(0);
}
solo.clickOnText(solo.getString(R.string.save));
- waitForProviderDetails();
+ if (expectSuccess) {
+ waitForProviderDetails();
+ } else {
+ waitForNoValidProviderError();
+ }
solo.goBack();
}
+ private void waitForNoValidProviderError() {
+ String text = solo.getString(R.string.malformed_url);
+ assertTrue("Provider details dialog did not appear", solo.waitForText(text, 1, 60*1000));
+ }
+
public void testShowAbout() {
showAbout();
}
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java
index f76ba93b..4c6a6370 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java
@@ -7,10 +7,10 @@ import com.robotium.solo.Condition;
import com.robotium.solo.Solo;
import de.blinkt.openvpn.activities.DisconnectVPN;
-import mbanje.kurt.fabbutton.FabButton;
import mbanje.kurt.fabbutton.ProgressRingView;
import se.leap.bitmaskclient.Dashboard;
import se.leap.bitmaskclient.R;
+import se.leap.bitmaskclient.userstatus.FabButton;
import static junit.framework.Assert.assertTrue;