diff options
author | fupduck <fupduck@riseup.net> | 2018-02-06 05:53:09 -0800 |
---|---|---|
committer | fupduck <fupduck@riseup.net> | 2018-02-06 05:53:09 -0800 |
commit | edd34192484f4eb618fdcc2a68b18168c155d63c (patch) | |
tree | d884f63e74911d2ea2cf7bc864414a623e15a2b3 /app/src/androidTest/java/se/leap/bitmaskclient/test/TestProviderListActivity.java | |
parent | c0848bac7ac44f4b09f9e5d66ab71f079cb0f514 (diff) | |
parent | d2d61a16fd2a3ea0fd42073de98d1311b184444d (diff) |
Merge branch '#8832_update_ics-openvpn' into '0.9.8'
#8832 update ics openvpn
See merge request leap/bitmask_android!33
Diffstat (limited to 'app/src/androidTest/java/se/leap/bitmaskclient/test/TestProviderListActivity.java')
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/TestProviderListActivity.java | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestProviderListActivity.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestProviderListActivity.java deleted file mode 100644 index 4ab705e7..00000000 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestProviderListActivity.java +++ /dev/null @@ -1,114 +0,0 @@ -package se.leap.bitmaskclient.test; - -import android.test.ActivityInstrumentationTestCase2; -import android.widget.ListView; - -import com.robotium.solo.Solo; - -import java.io.IOException; - -import se.leap.bitmaskclient.ProviderListActivity; -import se.leap.bitmaskclient.R; - -public class TestProviderListActivity extends ActivityInstrumentationTestCase2<ProviderListActivity> { - - private Solo solo; - - public TestProviderListActivity() { - super(ProviderListActivity.class); - } - - - @Override - protected void setUp() throws Exception { - super.setUp(); - solo = new Solo(getInstrumentation(), getActivity()); - Screenshot.initialize(solo); - } - - @Override - protected void tearDown() throws Exception { - solo.finishOpenedActivities(); - super.tearDown(); - } - - /** - * 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(); - } - - private int predefinedProviders() { - int predefined_providers = 0; - try { - predefined_providers = solo.getCurrentActivity().getAssets().list("urls").length; - } catch (IOException e) { - e.printStackTrace(); - return predefined_providers; - } - - return predefined_providers; - } - - public void testSelectProvider() { - Screenshot.take("Initial CW"); - selectProvider("demo.bitmask.net"); - } - - private void selectProvider(String provider) { - solo.clickOnText(provider); - Screenshot.setTimeToSleep(1); - Screenshot.take("Configuring provider"); - waitForProviderDetails(); - } - - private void waitForProviderDetails() { - String text = solo.getString(R.string.provider_details_title); - assertTrue("Provider details dialog did not appear", solo.waitForText(text, 1, 60*1000)); - Screenshot.take("Provider details"); - } - - public void testAddNewProvider() { - //addProvider("calyx.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 expectSuccess) { - - 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)); - 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)); - } - -} |