summaryrefslogtreecommitdiff
path: root/app/src/androidTest/java/se
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2017-11-09 10:32:45 -0800
committercyberta <cyberta@riseup.net>2017-11-09 10:32:45 -0800
commitf6e7474c37bd2ee65b290474f5ea601082ca7eb4 (patch)
tree91a8b79da9aa1ed5bf84d1890721e346609f1048 /app/src/androidTest/java/se
parentbd49ce4456af6b71ef8aea96d58aae5baaab069a (diff)
parent859c2b4496618c8142c70610ebba395e9aa4d5dc (diff)
Merge branch '8778_invalid_provider_error_handling' into 'master'
#8778 fixes invalid provider error handling See merge request leap/bitmask_android!15
Diffstat (limited to 'app/src/androidTest/java/se')
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/TestConfigurationWizard.java36
1 files changed, 27 insertions, 9 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();
}