diff options
author | cyBerta <cyberta@riseup.net> | 2017-09-14 17:43:27 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2017-09-14 17:43:27 +0200 |
commit | 9e38bf54cc03fdd0839a194f0ecdd1838234e4e2 (patch) | |
tree | f01a3c4cc6b3ce8f7f475c440321f9283015d613 /app/src | |
parent | 15a093d0f4df45bf8e80e09d14f5a1f57f0fa1ff (diff) |
fixes tests that fail to login & some more assertions for showing causes of failure earlier
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/TestUserStatusFragment.java | 6 | ||||
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/UserStatusTestController.java | 24 |
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); |