diff options
author | cyBerta <cyberta@riseup.net> | 2017-11-03 15:17:45 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2017-11-03 15:17:45 +0100 |
commit | 859c2b4496618c8142c70610ebba395e9aa4d5dc (patch) | |
tree | 137fd4af0292e8b8a8abb26307f82c580f485a0f /app/src/androidTest/java/se | |
parent | 719c63ee33a88b239e96efead8da14cf985ca9aa (diff) |
#8778 fixes invalid provider error handling
Diffstat (limited to 'app/src/androidTest/java/se')
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/TestConfigurationWizard.java | 36 |
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(); } |