diff options
author | Parménides GV <parmegv@sdf.org> | 2015-04-27 18:08:59 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2015-04-27 18:08:59 +0200 |
commit | bd68fe662af7734d94a8853b38f418f19879e389 (patch) | |
tree | b64b135dfaa099ba27a8e20fc3835af4d885ba3d /app/src/androidTest/java/se | |
parent | 8707f9e9a07f8c53955df14ef9b26d13a0eb60da (diff) |
Added a button to the UI
Turn on VPN touching that button, and leave the image as a mere indicator.
Diffstat (limited to 'app/src/androidTest/java/se')
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java | 36 |
1 files changed, 21 insertions, 15 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 06fe0a42..18d7b45d 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java @@ -4,7 +4,7 @@ import android.content.*; import android.graphics.*; import android.test.*; import android.view.*; -import android.widget.Toast; +import android.widget.Button; import com.robotium.solo.*; @@ -46,19 +46,19 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D * I cannot automate that dialog. */ public void testOnOffOpenVpn() { - clickVpnImage(); + clickVpnButton(); turningEipOn(); - clickVpnImage(); + clickVpnButton(); turningEipOff(); - clickVpnImage(); + clickVpnButton(); turningEipOn(); - clickVpnImage(); + clickVpnButton(); turningEipOff(); - /*clickVpnImage();; + /*clickVpnButton();; turningEipOn(); turnNetworkOff(); @@ -67,12 +67,15 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D } - private void clickVpnImage() { - View vpn_status_image = getVpnButton(); - solo.clickOnView(vpn_status_image); + private void clickVpnButton() { + solo.clickOnView(getVpnButton()); } - private FabButton getVpnButton() { + private Button getVpnButton() { + return (Button) solo.getView(R.id.vpn_main_button); + } + + private FabButton getVpnImage() { return (FabButton) solo.getView(R.id.vpn_Status_Image); } @@ -91,12 +94,12 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D } private void assertInProgress() { - ProgressRingView a = (ProgressRingView) getVpnButton().findViewById(R.id.fabbutton_ring); + ProgressRingView a = (ProgressRingView) getVpnImage().findViewById(R.id.fabbutton_ring); assertTrue(isShownWithinConfinesOfVisibleScreen(a)); } private boolean iconConnected() { - CircleImageView a = (CircleImageView) getVpnButton().findViewById(R.id.fabbutton_circle); + CircleImageView a = (CircleImageView) getVpnImage().findViewById(R.id.fabbutton_circle); a.setDrawingCacheEnabled(true); return a.getDrawingCache().equals(getActivity().getResources().getDrawable(R.drawable.ic_stat_vpn)); } @@ -133,7 +136,7 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D } private boolean iconDisconnected() { - CircleImageView a = (CircleImageView) getVpnButton().findViewById(R.id.fabbutton_circle); + CircleImageView a = (CircleImageView) getVpnImage().findViewById(R.id.fabbutton_circle); a.setDrawingCacheEnabled(true); return a.getDrawingCache().equals(getActivity().getResources().getDrawable(R.drawable.ic_stat_vpn_offline)); } @@ -209,9 +212,9 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D private void changeAndTestProvider(String provider) { changeProvider(provider); sleep(1); - clickVpnImage(); + clickVpnButton(); turningEipOn(); - clickVpnImage(); + clickVpnButton(); turningEipOff(); } @@ -246,6 +249,9 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D assertSuccessfulLogin(); } public void testVpnIconIsDisplayed() { + assertTrue(isShownWithinConfinesOfVisibleScreen(getVpnImage())); + } + public void testVpnButtonIsDisplayed() { assertTrue(isShownWithinConfinesOfVisibleScreen(getVpnButton())); } |