summaryrefslogtreecommitdiff
path: root/app/src/androidTest/java/se/leap
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2015-06-24 19:05:39 +0200
committerParménides GV <parmegv@sdf.org>2015-06-24 19:05:39 +0200
commitffc2a0cbae78aa71e7ca5a64c76b75f1c5bba664 (patch)
tree26ead8a26a3dee60dc63fc637c6ff9b30e30eccf /app/src/androidTest/java/se/leap
parente533cf6939e3ea4233aa8a82812f8ce5fcb565ca (diff)
Tuned some times, refactoring tests
Diffstat (limited to 'app/src/androidTest/java/se/leap')
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboardFragment.java (renamed from app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java)6
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/Screenshot.java3
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java2
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java5
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java12
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/testUserStatusFragment.java5
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java11
7 files changed, 18 insertions, 26 deletions
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboardFragment.java
index 9a9131fd..aef968b8 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboardFragment.java
@@ -9,20 +9,21 @@ import com.robotium.solo.*;
import se.leap.bitmaskclient.*;
-public abstract class BaseTestDashboard extends ActivityInstrumentationTestCase2<Dashboard> {
+public abstract class BaseTestDashboardFragment extends ActivityInstrumentationTestCase2<Dashboard> {
Solo solo;
Context context;
UserStatusTestController user_status_controller;
VpnTestController vpn_controller;
- public BaseTestDashboard() { super(Dashboard.class); }
+ public BaseTestDashboardFragment() { super(Dashboard.class); }
@Override
protected void setUp() throws Exception {
super.setUp();
context = getInstrumentation().getContext();
solo = new Solo(getInstrumentation(), getActivity());
+ Screenshot.initialize(solo);
user_status_controller = new UserStatusTestController(solo);
vpn_controller = new VpnTestController(solo);
ConnectionManager.setMobileDataEnabled(true, context);
@@ -43,6 +44,7 @@ public abstract class BaseTestDashboard extends ActivityInstrumentationTestCase2
}
private void useRegistered() {
+ solo.waitForFragmentById(R.id.provider_detail_fragment);
String text = solo.getString(R.string.signup_or_login_button);
clickAndWaitForDashboard(text);
user_status_controller.logIn("parmegvtest10", "holahola2");
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/Screenshot.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/Screenshot.java
index 91d51402..ade28b73 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/Screenshot.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/Screenshot.java
@@ -26,8 +26,7 @@ public class Screenshot {
}
public static void take() {
- sleepBefore();
- solo.takeScreenshot(default_name + "_" + getTimeStamp());
+ take(default_name + "_" + getTimeStamp());
}
public static void takeWithSleep() {
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java
index 25d81da1..39ab37dd 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java
@@ -79,7 +79,7 @@ public class VpnTestController {
a = whole_icon != null ?
(ProgressRingView) getVpnWholeIcon().findViewById(R.id.fabbutton_ring) :
new ProgressRingView(solo.getCurrentActivity());
- BaseTestDashboard.isShownWithinConfinesOfVisibleScreen(a);
+ BaseTestDashboardFragment.isShownWithinConfinesOfVisibleScreen(a);
}
private boolean iconShowsConnected() {
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 931457ee..8b897b96 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testConfigurationWizard.java
@@ -29,6 +29,7 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co
protected void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation(), getActivity());
+ Screenshot.initialize(solo);
//ConnectionManager.setMobileDataEnabled(true, solo.getCurrentActivity().getApplicationContext());
}
@@ -62,17 +63,21 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co
}
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_fragment_title);
assertTrue("Provider details dialog did not appear", solo.waitForText(text, 1, 60*1000));
+ Screenshot.take("Provider details");
}
public void testAddNewProvider() {
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 fea6bf77..ece70c59 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java
@@ -1,20 +1,10 @@
package se.leap.bitmaskclient.test;
-import android.graphics.*;
-import android.graphics.drawable.Drawable;
-import android.widget.Button;
-
-import com.robotium.solo.*;
-
import java.io.*;
-import de.blinkt.openvpn.activities.*;
-import mbanje.kurt.fabbutton.CircleImageView;
-import mbanje.kurt.fabbutton.FabButton;
-import mbanje.kurt.fabbutton.ProgressRingView;
import se.leap.bitmaskclient.*;
-public class testDashboardIntegration extends BaseTestDashboard {
+public class testDashboardIntegration extends BaseTestDashboardFragment {
@Override
protected void tearDown() throws Exception {
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testUserStatusFragment.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testUserStatusFragment.java
index 7e791d16..2031f365 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testUserStatusFragment.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testUserStatusFragment.java
@@ -1,6 +1,6 @@
package se.leap.bitmaskclient.test;
-public class testUserStatusFragment extends BaseTestDashboard {
+public class testUserStatusFragment extends BaseTestDashboardFragment {
public final String TAG = testUserStatusFragment.class.getName();
@@ -18,7 +18,10 @@ public class testUserStatusFragment extends BaseTestDashboard {
public void testLogInAndOut() {
user_status_controller.clickUserSessionButton();
+ Screenshot.take("Login dialog");
user_status_controller.logIn(test_username, test_password);
+ Screenshot.setTimeToSleep(2);
+ Screenshot.takeWithSleep("Logging in");
user_status_controller.logOut();
}
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java
index d23be601..12cb8c14 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java
@@ -1,21 +1,14 @@
package se.leap.bitmaskclient.test;
-public class testVpnFragment extends BaseTestDashboard {
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- Screenshot.initialize(solo);
- }
+public class testVpnFragment extends BaseTestDashboardFragment {
/**
* This test will fail if Android does not trust VPN connection.
* I cannot automate that dialog.
*/
public void testOnOffOpenVpn() {
- Screenshot.take("Initial UI");
vpn_controller.clickVpnButton();
- Screenshot.setTimeToSleep(5);
+ Screenshot.setTimeToSleep(8);
Screenshot.takeWithSleep("Turning VPN on");
vpn_controller.turningEipOn();
Screenshot.setTimeToSleep(0.5);