summaryrefslogtreecommitdiff
path: root/app/src/androidTest/java/se/leap
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2015-04-22 18:12:49 +0200
committerParménides GV <parmegv@sdf.org>2015-04-22 18:12:49 +0200
commit7b36438c5ce3b2c76a738caff8f540248e62cc20 (patch)
tree74ae05ef102e556927ba9dcbdad251b8ac45528f /app/src/androidTest/java/se/leap
parentacb5e7e33b554b236995926853eb9f1abcb7b6c3 (diff)
Method to see if a view is actually shown.
Thanks to http://stackoverflow.com/questions/3791607/how-can-i-check-if-a-view-is-visible-or-not-in-android/12428208#12428208
Diffstat (limited to 'app/src/androidTest/java/se/leap')
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java6
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java13
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");