diff options
Diffstat (limited to 'app/src/androidTest')
-rw-r--r-- | app/src/androidTest/assets/eip-service-test.json | 69 | ||||
-rw-r--r-- | app/src/androidTest/assets/gateway.json | 1 | ||||
-rw-r--r-- | app/src/androidTest/assets/riseup.net.json | 37 | ||||
-rw-r--r-- | app/src/androidTest/assets/riseup.net.pem | 32 | ||||
-rw-r--r-- | app/src/androidTest/assets/secrets.json | 1 | ||||
-rw-r--r-- | app/src/androidTest/java/se/leap/bitmaskclient/test/StartActivityDrawerTest.java | 181 |
6 files changed, 0 insertions, 321 deletions
diff --git a/app/src/androidTest/assets/eip-service-test.json b/app/src/androidTest/assets/eip-service-test.json deleted file mode 100644 index 78b49bae..00000000 --- a/app/src/androidTest/assets/eip-service-test.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "gateways": [ - { - "capabilities": { - "adblock": false, - "filter_dns": false, - "limited": false, - "ports": [ - "443" - ], - "protocols": [ - "tcp", - "udp" - ], - "transport": [ - "openvpn" - ], - "user_ips": false - }, - "host": "millipede.demo.bitmask.net", - "ip_address": "198.252.153.84", - "location": "seattle__wa" - }, - { - "capabilities": { - "adblock": false, - "filter_dns": false, - "limited": false, - "ports": [ - "443" - ], - "protocols": [ - "tcp", - "udp" - ], - "transport": [ - "openvpn" - ], - "user_ips": false - }, - "host": "otter.demo.bitmask.net", - "ip_address": "46.165.242.169", - "location": "frankfurt" - } - ], - "locations": { - "frankfurt": { - "country_code": "DE", - "hemisphere": "N", - "name": "Frankfurt", - "timezone": "+1" - }, - "seattle__wa": { - "country_code": "US", - "hemisphere": "N", - "name": "Seattle, WA", - "timezone": "-7" - } - }, - "openvpn_configuration": { - "auth": "SHA1", - "cipher": "AES-128-CBC", - "keepalive": "10 30", - "tls-cipher": "DHE-RSA-AES128-SHA", - "tun-ipv6": true - }, - "serial": 1, - "version": 1 -}
\ No newline at end of file diff --git a/app/src/androidTest/assets/gateway.json b/app/src/androidTest/assets/gateway.json deleted file mode 100644 index 51a19ec9..00000000 --- a/app/src/androidTest/assets/gateway.json +++ /dev/null @@ -1 +0,0 @@ -{"location":"seattle__wa","ip_address":"198.252.153.84","capabilities":{"limited":false,"ports":["443"],"adblock":false,"transport":["openvpn"],"filter_dns":false,"protocols":["tcp","udp"],"user_ips":false},"host":"millipede.demo.bitmask.net"} diff --git a/app/src/androidTest/assets/riseup.net.json b/app/src/androidTest/assets/riseup.net.json deleted file mode 100644 index 9a5ec79e..00000000 --- a/app/src/androidTest/assets/riseup.net.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "api_uri": "https://api.black.riseup.net:443", - "api_version": "1", - "ca_cert_fingerprint": "SHA256: a5244308a1374709a9afce95e3ae47c1b44bc2398c0a70ccbf8b3a8a97f29494", - "ca_cert_uri": "https://black.riseup.net/ca.crt", - "default_language": "en", - "description": { - "en": "Riseup is a non-profit collective in Seattle that provides online communication tools for people and groups working toward liberatory social change." - }, - "domain": "riseup.net", - "enrollment_policy": "open", - "languages": [ - "en" - ], - "name": { - "en": "Riseup Networks" - }, - "service": { - "allow_anonymous": false, - "allow_free": true, - "allow_limited_bandwidth": false, - "allow_paid": false, - "allow_registration": true, - "allow_unlimited_bandwidth": true, - "bandwidth_limit": 102400, - "default_service_level": 1, - "levels": { - "1": { - "description": "Please donate.", - "name": "free" - } - } - }, - "services": [ - "openvpn" - ] -}
\ No newline at end of file diff --git a/app/src/androidTest/assets/riseup.net.pem b/app/src/androidTest/assets/riseup.net.pem deleted file mode 100644 index c890aff4..00000000 --- a/app/src/androidTest/assets/riseup.net.pem +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFjTCCA3WgAwIBAgIBATANBgkqhkiG9w0BAQ0FADBZMRgwFgYDVQQKDA9SaXNl -dXAgTmV0d29ya3MxGzAZBgNVBAsMEmh0dHBzOi8vcmlzZXVwLm5ldDEgMB4GA1UE -AwwXUmlzZXVwIE5ldHdvcmtzIFJvb3QgQ0EwHhcNMTQwNDI4MDAwMDAwWhcNMjQw -NDI4MDAwM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YMID9dB3No4Zmf7v -qHjiSXiS8jx1j/6/Luk6PpFbT7QYm4QLs1f4BlfZOti2KE8r7KRDPIecUsUXW6P/ -3GJAVYH/+7OjA39za9AieM7+H5BELGccGrM5wfl7JeEz8in+V2ZWDzHQO4hMkiTQ -4ZckuaL201F68YpiItBNnJ9N5nHr1MRiGyApHmLXY/wvlrOpclh95qn+lG6/2jk7 -3AmihLOKYMlPwPakJg4PYczm3icFLgTpjV5sq2md9bRyAg3oPGfAuWHmKj2Ikqch -Td5CHKGxEEWbGUWEMP0s1A/JHWiCbDigc4Cfxhy56CWG4q0tYtnc2GMw8OAUO6Wf -Xu5pYKNkzKSEtT/MrNJt44tTZWbKV/Pi/N2Fx36my7TgTUj7g3xcE9eF4JV2H/sg -tsK3pwE0FEqGnT4qMFbixQmc8bGyuakr23wjMvfO7eZUxBuWYR2SkcP26sozF9PF -tGhbZHQVGZUTVPyvwahMUEhbPGVerOW0IYpxkm0x/eaWdTc4vPpf/rIlgbAjarnJ -UN9SaWRlWKSdP4haujnzCoJbM7dU9bjvlGZNyXEekgeT0W2qFeGGp+yyUWw8tNsp -0BuC1b7uW/bBn/xKm319wXVDvBgZgcktMolak39V7DVO ------END CERTIFICATE-----
\ No newline at end of file diff --git a/app/src/androidTest/assets/secrets.json b/app/src/androidTest/assets/secrets.json deleted file mode 100644 index 36ba5977..00000000 --- a/app/src/androidTest/assets/secrets.json +++ /dev/null @@ -1 +0,0 @@ -{"ca_cert":"-----BEGIN CERTIFICATE-----\nMIIFbzCCA1egAwIBAgIBATANBgkqhkiG9w0BAQ0FADBKMRgwFgYDVQQDDA9CaXRt\nYXNrIFJvb3QgQ0ExEDAOBgNVBAoMB0JpdG1hc2sxHDAaBgNVBAsME2h0dHBzOi8v\nYml0bWFzay5uZXQwHhcNMTIxMTA2MDAwMDAwWhcNMjIxMTA2MDAwMDAwWjBKMRgw\nFgYDVQQDDA9CaXRtYXNrIFJvb3QgQ0ExEDAOBgNVBAoMB0JpdG1hc2sxH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8Gh\nKSYm8OEDYiUCgYEA489fmbrCcUnXzpTsbswJ5NmSoEXbcX8cLxnQuzE0z9GHhQdrMjOpXR76reTW\n6jcuudarNcwRUYSWWhjCDKHhpx4HhasWPaHgr7jIzcRw8yZSJRSxKr8sl1qh6g7s47JcmfXOMWLt\nyuyE933XrT19Th4ODZHY40Uv35mPjMi9d00CgYEAyRNAQtndBRa7GG\/B4Ls2T+6pl+aNJIo4e+no\nrURlp800wWabEPRocdBRQmyULBLxduBr2LIMzhgwGSz8b2wji\/l9ZA3PFY135bxClVzSzUIjuO3N\nrGUzHl2wAAyuAFDSUshzfkPBJRNt8aVBF5PQ3t93ZYmPAmv8LPZe875yX5ECgYEAsUEcwK\/ZNW7g\ndQPZR4iJNkC4Xu6cBZ6Cnn92swBheEYvLSoNlX0vDZ7aLE3\/jzQqrjzC8NP8sbH5jtbuvgeDXZX3\nAmGRp5j6C6A61ihAPmEVz3ZfN8SSfJ3vl\/\/PAIg6lyz0J+cy4Q7RkwSeuVQ72Hl4M8TEvmmKC3Af\nispy6Y0CgYEAgl1o2lo+ACyk+oVQPaaPqK3d7WOBFp4eR2nXFor\/vsx9igQOlZUgzRDQsR8jo1o9\nefOSBf87igrZGgssys89pWa2dnXnz5PMmzkKr6bw4D9Ez6u6Puc9UZhGw\/8wDYg6fSosdB9utspm\nM698ycef7jBNMDgmhpSvfw5GctoNQ4s=\n-----END RSA PRIVATE KEY-----"} diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/StartActivityDrawerTest.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/StartActivityDrawerTest.java deleted file mode 100644 index 31247e0a..00000000 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/StartActivityDrawerTest.java +++ /dev/null @@ -1,181 +0,0 @@ -package se.leap.bitmaskclient.test; - -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.support.test.InstrumentationRegistry; -import android.support.test.espresso.contrib.DrawerActions; -import android.support.test.rule.ActivityTestRule; -import android.support.test.runner.AndroidJUnit4; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.io.IOException; - -import se.leap.bitmaskclient.BuildConfig; -import se.leap.bitmaskclient.MainActivity; -import se.leap.bitmaskclient.Provider; -import se.leap.bitmaskclient.R; -import se.leap.bitmaskclient.testutils.TestSetupHelper; - -import static android.support.test.InstrumentationRegistry.getInstrumentation; -import static android.support.test.espresso.Espresso.onData; -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.action.ViewActions.click; -import static android.support.test.espresso.assertion.ViewAssertions.matches; -import static android.support.test.espresso.contrib.DrawerMatchers.isClosed; -import static android.support.test.espresso.contrib.DrawerMatchers.isOpen; -import static android.support.test.espresso.matcher.RootMatchers.isDialog; -import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; -import static android.support.test.espresso.matcher.ViewMatchers.withId; -import static android.support.test.espresso.matcher.ViewMatchers.withText; -import static org.hamcrest.Matchers.anything; -import static se.leap.bitmaskclient.Constants.FIRST_TIME_USER_DATE; -import static se.leap.bitmaskclient.Constants.LAST_DONATION_REMINDER_DATE; -import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; -import static se.leap.bitmaskclient.MainActivity.ACTION_SHOW_VPN_FRAGMENT; -import static se.leap.bitmaskclient.R.id.aboutLayout; -import static se.leap.bitmaskclient.R.id.accountList; -import static se.leap.bitmaskclient.R.id.drawer_layout; -import static se.leap.bitmaskclient.R.id.eipServiceFragment; -import static se.leap.bitmaskclient.R.id.log_layout; -import static se.leap.bitmaskclient.R.id.provider_list_layout; -import static se.leap.bitmaskclient.R.id.settingsList; - -/** - * Created by cyberta on 19.01.18. - */ - -@RunWith(AndroidJUnit4.class) -public class StartActivityDrawerTest { - - Intent intent; - SharedPreferences preferences; - SharedPreferences.Editor preferencesEditor; - - @Rule - public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>( - MainActivity.class, - true, - false); // Activity is not launched immediately - - @Before - public void setUp() throws IOException { - intent = new Intent(ACTION_SHOW_VPN_FRAGMENT); - Context context = getInstrumentation().getTargetContext(); - - preferences = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE); - preferencesEditor = preferences.edit(); - preferencesEditor.putString(Provider.KEY, TestSetupHelper.getInputAsString(InstrumentationRegistry.getContext().getAssets().open("riseup.net.json"))) - .putString(Provider.CA_CERT, TestSetupHelper.getInputAsString(InstrumentationRegistry.getContext().getAssets().open("riseup.net.pem"))) - .putString(LAST_DONATION_REMINDER_DATE, null) - .putString(FIRST_TIME_USER_DATE, null).commit(); - - } - - - @Test - public void testDisplayDrawer_isOpenUntilUserManuallyOpendDrawerOnce() { - preferencesEditor.putBoolean("navigation_drawer_learned", false).commit(); - mActivityRule.launchActivity(intent); - onView(withId(drawer_layout)).check(matches(isOpen())); - onView(withId(drawer_layout)).perform(DrawerActions.close()); - mActivityRule.finishActivity(); - - mActivityRule.launchActivity(intent); - onView(withId(drawer_layout)).check(matches(isOpen())); - onView(withId(drawer_layout)).perform(DrawerActions.close()); - onView(withId(drawer_layout)).perform(DrawerActions.open()); - mActivityRule.finishActivity(); - - mActivityRule.launchActivity(intent); - onView(withId(drawer_layout)).check(matches(isClosed())); - } - - @Test - public void testClickProviderName_closeDrawerAndShowEipFragment() throws InterruptedException { - preferencesEditor.putBoolean("navigation_drawer_learned", true).commit(); - mActivityRule.launchActivity(intent); - onView(withId(drawer_layout)).check(matches(isClosed())); - onView(withId(drawer_layout)).perform(DrawerActions.open()); - onView(withId(drawer_layout)).check(matches(isOpen())); - onData(anything()).inAdapterView(withId(accountList)).atPosition(0).perform(click()); - onView(withId(drawer_layout)).check(matches(isClosed())); - onView(withId(eipServiceFragment)).check(matches(isDisplayed())); - } - - @Test - public void testSaveBattery_closeDrawerAndShowSaveBatteryDialog() throws InterruptedException { - preferencesEditor.putBoolean("navigation_drawer_learned", true).commit(); - mActivityRule.launchActivity(intent); - onView(withId(drawer_layout)).check(matches(isClosed())); - onView(withId(drawer_layout)).perform(DrawerActions.open()); - onView(withId(drawer_layout)).check(matches(isOpen())); - onData(anything()).inAdapterView(withId(settingsList)).atPosition(0).perform(click()); - onView(withText(R.string.save_battery_message)) - .inRoot(isDialog()) - .check(matches(isDisplayed())); - } - - @Test - public void testAlwaysOnVPN_closeDrawerAndShowDialog() throws InterruptedException { - preferencesEditor.putBoolean("navigation_drawer_learned", true).commit(); - mActivityRule.launchActivity(intent); - onView(withId(drawer_layout)).check(matches(isClosed())); - onView(withId(drawer_layout)).perform(DrawerActions.open()); - onView(withId(drawer_layout)).check(matches(isOpen())); - onData(anything()).inAdapterView(withId(settingsList)).atPosition(1).perform(click()); - onView(withText(R.string.always_on_vpn_user_message)) - .inRoot(isDialog()) - .check(matches(isDisplayed())); - } - - @Test - public void testClickSwitchProvider_closeDrawerAndShowProviderListView() throws InterruptedException { - if (BuildConfig.FLAVOR_branding.equals("custom")) { - return; - } - preferencesEditor.putBoolean("navigation_drawer_learned", true).commit(); - mActivityRule.launchActivity(intent); - onView(withId(drawer_layout)).check(matches(isClosed())); - onView(withId(drawer_layout)).perform(DrawerActions.open()); - onView(withId(drawer_layout)).check(matches(isOpen())); - - onData(anything()).inAdapterView(withId(settingsList)).atPosition(2).perform(click()); - onView(withId(provider_list_layout)).check(matches(isDisplayed())); - } - - @Test - public void testClickLog_closeDrawerAndShowLogFragment() throws InterruptedException { - preferencesEditor.putBoolean("navigation_drawer_learned", true).commit(); - mActivityRule.launchActivity(intent); - onView(withId(drawer_layout)).check(matches(isClosed())); - onView(withId(drawer_layout)).perform(DrawerActions.open()); - onView(withId(drawer_layout)).check(matches(isOpen())); - - onData(anything()).inAdapterView(withId(settingsList)).atPosition(getPositionBasedOnFlavor(2, 3)).perform(click()); - onView(withId(log_layout)).check(matches(isDisplayed())); - } - - @Test - public void testClickAbout_closeDrawerAndShowAboutFragment() throws InterruptedException { - preferencesEditor.putBoolean("navigation_drawer_learned", true).commit(); - mActivityRule.launchActivity(intent); - onView(withId(drawer_layout)).check(matches(isClosed())); - onView(withId(drawer_layout)).perform(DrawerActions.open()); - onView(withId(drawer_layout)).check(matches(isOpen())); - onData(anything()).inAdapterView(withId(settingsList)).atPosition(getPositionBasedOnFlavor(4,5)).perform(click()); - onView(withId(aboutLayout)).check(matches(isDisplayed())); - } - - private int getPositionBasedOnFlavor(int custom, int defaultNumber) { - if (BuildConfig.FLAVOR_branding.equals("custom")) { - return custom; - } else { - return defaultNumber; - } - } -} |