summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/TestUserStatusFragment.java6
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/UserStatusTestController.java24
2 files changed, 21 insertions, 9 deletions
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 2031f365..d77b9796 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestUserStatusFragment.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestUserStatusFragment.java
@@ -1,8 +1,8 @@
package se.leap.bitmaskclient.test;
-public class testUserStatusFragment extends BaseTestDashboardFragment {
+public class TestUserStatusFragment extends BaseTestDashboardFragment {
- public final String TAG = testUserStatusFragment.class.getName();
+ public final String TAG = TestUserStatusFragment.class.getName();
private final String provider = "demo.bitmask.net";
private final String test_username = "parmegvtest1";
@@ -27,7 +27,7 @@ public class testUserStatusFragment extends BaseTestDashboardFragment {
public void testFailedLogIn() {
user_status_controller.clickUserSessionButton();
- user_status_controller.logIn(test_username, TAG);
+ user_status_controller.logIn(test_username, TAG, false);
if(!user_status_controller.assertErrorLogInDialogAppears())
throw new IllegalStateException();
}
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 138dfa71..821a23fd 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/UserStatusTestController.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/UserStatusTestController.java
@@ -6,6 +6,8 @@ import com.robotium.solo.*;
import se.leap.bitmaskclient.*;
+import static junit.framework.Assert.assertTrue;
+
public class UserStatusTestController {
private final Solo solo;
@@ -25,22 +27,32 @@ public class UserStatusTestController {
return view;
}
- void logIn(String username, String password) {
+ void logIn(String username, String password, boolean expectSuccess) {
solo.enterText(0, username);
solo.enterText(1, password);
solo.clickOnText(solo.getString(R.string.login_button));
- solo.waitForDialogToClose();
- assertLoggedIn();
+ assertTrue(solo.waitForDialogToClose());
+
+ if (expectSuccess) {
+ assertLoggedIn();
+ } else {
+ solo.waitForText(solo.getString(R.string.cancel));
+ assertTrue(solo.waitForText(solo.getString(R.string.login_button)));
+ }
+ }
+
+ void logIn(String username, String password) {
+ logIn(username, password, true);
}
private void assertLoggedIn() {
String log_out = solo.getString(R.string.logout_button);
- solo.waitForText(log_out);
+ assertTrue(solo.waitForText(log_out));
}
void assertLoggedOut() {
String log_in = solo.getString(R.string.login_button);
- solo.waitForText(log_in);
+ assertTrue(solo.waitForText(log_in));
}
void logOut() {
@@ -53,7 +65,7 @@ public class UserStatusTestController {
}
boolean assertErrorLogInDialogAppears() {
- solo.waitForDialogToOpen();
+ assertTrue(solo.waitForDialogToOpen());
String username_hint = solo.getEditText(0).getHint().toString();
String correct_username_hint = solo.getString(R.string.username_hint);