summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java2
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/UserStatusTestController.java16
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/testUserStatusFragment.java24
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java2
4 files changed, 39 insertions, 5 deletions
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java
index a6519175..fae44d1c 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/BaseTestDashboard.java
@@ -31,7 +31,7 @@ public abstract class BaseTestDashboard extends ActivityInstrumentationTestCase2
new testConfigurationWizard(solo).toDashboardAnonymously("demo.bitmask.net");
}
- void changeProvider(String provider) {
+ void changeProviderAndLogIn(String provider) {
tapSwitchProvider();
solo.clickOnText(provider);
useRegistered();
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/UserStatusTestController.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/UserStatusTestController.java
index dea81d73..138dfa71 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/UserStatusTestController.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/UserStatusTestController.java
@@ -51,4 +51,20 @@ public class UserStatusTestController {
solo.waitForDialogToClose();
assertLoggedOut();
}
+
+ boolean assertErrorLogInDialogAppears() {
+ solo.waitForDialogToOpen();
+
+ String username_hint = solo.getEditText(0).getHint().toString();
+ String correct_username_hint = solo.getString(R.string.username_hint);
+ String password_hint = solo.getEditText(1).getHint().toString();
+ String correct_password_hint = solo.getString(R.string.password_hint);
+ String user_message = solo.getText(0).toString();
+ String riseup_user_message = solo.getString(R.string.login_riseup_warning);
+
+ return username_hint.equalsIgnoreCase(correct_username_hint)
+ && password_hint.equalsIgnoreCase(correct_password_hint)
+ && !user_message.equalsIgnoreCase(riseup_user_message)
+ && !user_message.isEmpty();
+ }
}
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 d4c69337..7e791d16 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testUserStatusFragment.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testUserStatusFragment.java
@@ -2,12 +2,30 @@ package se.leap.bitmaskclient.test;
public class testUserStatusFragment extends BaseTestDashboard {
- public void testLogInAndOut() {
- changeProvider("demo.bitmask.net");
+ public final String TAG = testUserStatusFragment.class.getName();
+
+ private final String provider = "demo.bitmask.net";
+ private final String test_username = "parmegvtest1";
+ private final String test_password = " S_Zw3'-";
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ changeProviderAndLogIn(provider);
user_status_controller.clickUserSessionButton();
user_status_controller.assertLoggedOut();
+ }
+
+ public void testLogInAndOut() {
user_status_controller.clickUserSessionButton();
- user_status_controller.logIn("parmegvtest1", " S_Zw3'-");
+ user_status_controller.logIn(test_username, test_password);
user_status_controller.logOut();
}
+
+ public void testFailedLogIn() {
+ user_status_controller.clickUserSessionButton();
+ user_status_controller.logIn(test_username, TAG);
+ if(!user_status_controller.assertErrorLogInDialogAppears())
+ throw new IllegalStateException();
+ }
}
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 9926dbef..a777d454 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testVpnFragment.java
@@ -43,7 +43,7 @@ public class testVpnFragment extends BaseTestDashboard {
public void testVpnEveryProvider() {
String[] providers = {"demo.bitmask.net", "riseup.net", "calyx.net"};
for(String provider : providers) {
- changeProvider(provider);
+ changeProviderAndLogIn(provider);
vpn_controller.sleepSeconds(1);
vpn_controller.turnVpnOndAndOff(provider);
vpn_controller.sleepSeconds(1);