diff options
author | Parménides GV <parmegv@sdf.org> | 2015-04-30 13:51:43 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2015-04-30 13:52:04 +0200 |
commit | 237e51e09ea7ae13c4cdf7fd9247447f6d75fb9a (patch) | |
tree | 955df579d3589ca6a74a7b86fea1ade0e10b2781 /app/src/androidTest/java | |
parent | 9a54c425f6d96e1872899eabf78fb60082a8d234 (diff) |
Works smoothly, correct texts.
Next step: beautify.
Diffstat (limited to 'app/src/androidTest/java')
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java | 32 |
1 files changed, 23 insertions, 9 deletions
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 7551091b..a41a1acf 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java @@ -161,20 +161,25 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D public void testLogInAndOut() { changeProvider("demo.bitmask.net"); - clickLogIn(); + clickUserSessionButton(); + assertLoggedOut(); + clickUserSessionButton(); logIn("parmegvtest1", " S_Zw3'-"); - assertSuccessfulLogin(); + assertLoggedIn(); logOut(); } - private void clickLogIn() { - solo.clickOnView(getLogInButton()); + private void clickUserSessionButton() { + solo.clickOnView(getUserSessionButton()); } - private View getLogInButton() { - return solo.getView(R.id.user_session_button); + private View getUserSessionButton() { + View view = solo.getView(R.id.user_status_button); + assertTrue(view != null); + return view; } + private void logIn(String username, String password) { solo.enterText(0, username); solo.enterText(1, password); @@ -182,11 +187,20 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D solo.waitForDialogToClose(); } - private void assertSuccessfulLogin() { - assertTrue(solo.waitForText(solo.getString(R.string.logged_in_user_status))); + private void assertLoggedIn() { + String log_out = solo.getString(R.string.logout_button); + solo.waitForText(log_out); + } + + private void assertLoggedOut() { + String log_in = solo.getString(R.string.login_button); + solo.waitForText(log_in); } private void logOut() { + assertLoggedIn(); + clickUserSessionButton(); + solo.clickOnActionBarItem(R.string.logout_button); assertTrue(solo.waitForDialogToClose()); } @@ -245,7 +259,7 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D String text = solo.getString(R.string.signup_or_login_button); clickAndWaitForDashboard(text); logIn("parmegvtest10", "holahola2"); - assertSuccessfulLogin(); + assertLoggedIn(); } private void clickAndWaitForDashboard(String click_text) { |