summaryrefslogtreecommitdiff
path: root/app/src/androidTest/java/se
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2015-05-01 10:34:33 +0200
committerParménides GV <parmegv@sdf.org>2015-05-01 10:34:33 +0200
commite2e90dab0fcad09b342630617dd9da8be3d23f8c (patch)
tree18671f6716133ca2dc2a059b82ad86d45d555fa5 /app/src/androidTest/java/se
parent834fe99739264d498e3e8c87002b0e92cf8160a0 (diff)
parent436de7afeea2cd234db8a4b70ace396101126e88 (diff)
Merge branch 'feature/Move-log-in-button-to-the-Dashboard-6911' into feature/Look-for-a-better-solution-to-the-VPN-slider-#6863
Diffstat (limited to 'app/src/androidTest/java/se')
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java56
1 files changed, 34 insertions, 22 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 13ca4431..a41a1acf 100644
--- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java
+++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java
@@ -97,7 +97,7 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D
}
};
solo.waitForCondition(condition, max_seconds_until_connected * 1000);
- solo.sleep(2 * 1000);
+ sleepSeconds(2);
}
private void assertInProgress() {
@@ -124,7 +124,7 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D
}
};
solo.waitForCondition(condition, max_seconds_until_connected * 1000);
- solo.sleep(2 * 1000);
+ sleepSeconds(2);
}
private void okToBrowserWarning() {
@@ -160,15 +160,26 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D
}
public void testLogInAndOut() {
- long milliseconds_to_log_in = 40 * 1000;
- solo.clickOnActionBarItem(R.id.login_button);
+ changeProvider("demo.bitmask.net");
+ clickUserSessionButton();
+ assertLoggedOut();
+ clickUserSessionButton();
logIn("parmegvtest1", " S_Zw3'-");
- solo.waitForDialogToClose(milliseconds_to_log_in);
- assertSuccessfulLogin();
+ assertLoggedIn();
logOut();
}
+ private void clickUserSessionButton() {
+ solo.clickOnView(getUserSessionButton());
+ }
+
+ 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);
@@ -176,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());
}
@@ -218,20 +238,17 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D
private void changeAndTestProvider(String provider) {
changeProvider(provider);
- sleep(1);
+ sleepSeconds(1);
clickVpnButton();
turningEipOn();
clickVpnButton();
turningEipOff();
}
- private void sleep(int seconds) {
- try {
- Thread.sleep(seconds * 1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+ private void sleepSeconds(int seconds) {
+ solo.sleep(seconds * 1000);
}
+
private void changeProvider(String provider) {
tapSwitchProvider();
solo.clickOnText(provider);
@@ -241,7 +258,8 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D
private void useRegistered() {
String text = solo.getString(R.string.signup_or_login_button);
clickAndWaitForDashboard(text);
- login();
+ logIn("parmegvtest10", "holahola2");
+ assertLoggedIn();
}
private void clickAndWaitForDashboard(String click_text) {
@@ -249,12 +267,6 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D
assertTrue(solo.waitForActivity(Dashboard.class, 5000));
}
- private void login() {
- long milliseconds_to_log_in = 40 * 1000;
- logIn("parmegvtest10", "holahola2");
- solo.waitForDialogToClose(milliseconds_to_log_in);
- assertSuccessfulLogin();
- }
public void testVpnIconIsDisplayed() {
assertTrue(isShownWithinConfinesOfVisibleScreen(getVpnImage()));
}