summaryrefslogtreecommitdiff
path: root/app/src/androidTest/java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2015-04-29 12:25:24 +0200
committerParménides GV <parmegv@sdf.org>2015-04-29 12:26:23 +0200
commitf008b5ec8e1c74968e4a605d2de5423edf91b854 (patch)
treea6e8906aa5d09c24a48f533f6a057a84ee16265e /app/src/androidTest/java
parent6cc1443a27a4be762e4b53deb464d15a99d698ac (diff)
Creating a user session fragment.
I've separated the user session management to it, and encapsulated ProviderAPICommand into its own class. Putting the fragment statically in dashboard.xml isn't working, Android complains about it being duplicated, so I'm going to add it dynamically.
Diffstat (limited to 'app/src/androidTest/java')
-rw-r--r--app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java32
1 files changed, 13 insertions, 19 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..262310bd 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,17 @@ 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");
+ clickLogIn();
logIn("parmegvtest1", " S_Zw3'-");
- solo.waitForDialogToClose(milliseconds_to_log_in);
assertSuccessfulLogin();
logOut();
}
+ private void clickLogIn() {
+ solo.clickOnActionBarItem(R.id.user_session_button);
+ }
private void logIn(String username, String password) {
solo.enterText(0, username);
solo.enterText(1, password);
@@ -218,20 +220,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 +240,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");
+ assertSuccessfulLogin();
}
private void clickAndWaitForDashboard(String click_text) {
@@ -249,12 +249,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()));
}