diff options
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java | 6 | ||||
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java | 13 |
2 files changed, 18 insertions, 1 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 8db755dd..3a6cd754 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java @@ -14,6 +14,7 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co private Solo solo; private static int added_providers; + private boolean executing_from_dashboard = false; public testConfigurationWizard() { super(ConfigurationWizard.class); @@ -22,6 +23,7 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co public testConfigurationWizard(Solo solo) { super(ConfigurationWizard.class); this.solo = solo; + executing_from_dashboard = true; } @Override @@ -33,7 +35,8 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co @Override protected void tearDown() throws Exception { - solo.finishOpenedActivities(); + if(!executing_from_dashboard) + solo.finishOpenedActivities(); super.tearDown(); } @@ -79,6 +82,7 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co private void addProvider(String url) { boolean is_new_provider = !solo.searchText(url); + if (is_new_provider) added_providers = added_providers + 1; solo.clickOnActionBarItem(R.id.new_provider); 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 d2fb9901..ee217e15 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java @@ -1,7 +1,9 @@ package se.leap.bitmaskclient.test; import android.content.*; +import android.graphics.Rect; import android.test.*; +import android.view.View; import android.widget.*; import com.robotium.solo.*; @@ -215,6 +217,17 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D solo.waitForDialogToClose(milliseconds_to_log_in); assertSuccessfulLogin(); } + + public void testVpnIconIsDisplayed() { + View vpn_status_image = solo.getView(R.id.vpn_Status_Image); + assertTrue(isShownWithinConfinesOfVisibleScreen(vpn_status_image)); + } + + private boolean isShownWithinConfinesOfVisibleScreen(View view) { + Rect scrollBounds = new Rect(); + view.getHitRect(scrollBounds); + return view.getLocalVisibleRect(scrollBounds); + } /*public void testReboot() { runAdbCommand("shell am broadcast -a android.intent.action.BOOT_COMPLETED"); |