summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--app/build.gradle19
-rw-r--r--app/src/androidTest/java/base/ProviderSetupTest.java68
-rw-r--r--app/src/debug/AndroidManifest.xml43
-rw-r--r--fastlane/Fastfile6
-rw-r--r--fastlane/README.md8
-rw-r--r--fastlane/Screengrabfile20
-rw-r--r--fastlane/report.xml20
8 files changed, 160 insertions, 27 deletions
diff --git a/.gitignore b/.gitignore
index fb10e3e2..3997ee6d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -106,3 +106,6 @@ lib-bitmask-core-x86_64/bitmaskcore_x86_64-sources.jar
lib-bitmask-core-x86_64/bitmaskcore_x86_64.aar
lib-bitmask-core/bitmaskcore-sources.jar
lib-bitmask-core/bitmaskcore.aar
+
+
+fastlane/report.xml
diff --git a/app/build.gradle b/app/build.gradle
index 92120f88..359597a4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -276,12 +276,13 @@ android {
applicationIdSuffix ".beta"
appSuffix = " Beta"
buildConfigField "Boolean", "DEBUG_MODE", "true"
+ testCoverageEnabled = false
// tor-android doesn't know this build-type, fallback to release in that case
matchingFallbacks = ['release']
}
debug {
- testCoverageEnabled = true
+ testCoverageEnabled = false
buildConfigField "Boolean", "DEBUG_MODE", "true"
}
}
@@ -410,13 +411,17 @@ dependencies {
testImplementation 'org.powermock:powermock-module-junit4-rule:2.0.9'
testImplementation group: 'com.tngtech.java', name: 'junit-dataprovider', version: '1.10.0'
- androidTestImplementation 'org.mockito:mockito-core:3.6.0'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
- androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'
- androidTestImplementation 'androidx.test.espresso:espresso-intents:3.4.0'
- //TODO: remove that library
- androidTestImplementation 'com.jayway.android.robotium:robotium-solo:5.6.3'
+ androidTestImplementation 'org.mockito:mockito-core:3.9.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.5.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-intents:3.5.0'
+
+ androidTestImplementation 'tools.fastlane:screengrab:2.1.1'
+ testImplementation 'tools.fastlane:screengrab:2.1.1'
+
+
testImplementation 'org.json:json:20180813'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.4'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'
annotationProcessor 'com.squareup.dagger:dagger-compiler:1.2.2'
diff --git a/app/src/androidTest/java/base/ProviderSetupTest.java b/app/src/androidTest/java/base/ProviderSetupTest.java
new file mode 100644
index 00000000..fd46a093
--- /dev/null
+++ b/app/src/androidTest/java/base/ProviderSetupTest.java
@@ -0,0 +1,68 @@
+package base;
+
+
+import static android.content.Context.MODE_PRIVATE;
+import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
+import static androidx.test.espresso.Espresso.onData;
+import static androidx.test.espresso.action.ViewActions.click;
+import static androidx.test.espresso.matcher.ViewMatchers.withId;
+import static org.hamcrest.Matchers.anything;
+
+import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES;
+
+import android.content.SharedPreferences;
+
+import androidx.test.ext.junit.rules.ActivityScenarioRule;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.LargeTest;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Locale;
+
+import se.leap.bitmaskclient.R;
+import se.leap.bitmaskclient.base.StartActivity;
+import se.leap.bitmaskclient.base.utils.PreferenceHelper;
+import se.leap.bitmaskclient.providersetup.ProviderListActivity;
+import se.leap.bitmaskclient.providersetup.activities.ProviderSetupBaseActivity;
+import se.leap.bitmaskclient.testutils.ForceLocaleRule;
+import tools.fastlane.screengrab.Screengrab;
+import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy;
+import tools.fastlane.screengrab.locale.LocaleTestRule;
+
+@LargeTest
+@RunWith(AndroidJUnit4.class)
+public class ProviderSetupTest {
+
+ @ClassRule
+ public static final LocaleTestRule localeTestRule = new LocaleTestRule();
+
+ @Rule
+ public ActivityScenarioRule<ProviderListActivity> mActivityScenarioRule =
+ new ActivityScenarioRule<>(ProviderListActivity.class);
+
+ @Before
+ public void setup() {
+ Screengrab.setDefaultScreenshotStrategy(new UiAutomatorScreenshotStrategy());
+ SharedPreferences preferences = getApplicationContext().getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE);
+ preferences.edit().clear().commit();
+ }
+
+ @Test
+ public void testConfigureRiseupVPNScreenshot() {
+ Screengrab.screenshot("configureRiseupVPN_before_button_click");
+ onData(anything()).inAdapterView(withId(R.id.provider_list)).atPosition(2).perform(click());
+ Screengrab.screenshot("configureRiseupVPN_after_button_click");
+ }
+
+ @Test
+ public void testaddManuallyNewProviderScreenshot() {
+ Screengrab.screenshot("addManuallyNewProvider_before_button_click");
+ onData(anything()).inAdapterView(withId(R.id.provider_list)).atPosition(3).perform(click());
+ Screengrab.screenshot("addManuallyNewProvider_after_button_click");
+ }
+}
diff --git a/app/src/debug/AndroidManifest.xml b/app/src/debug/AndroidManifest.xml
new file mode 100644
index 00000000..51e17015
--- /dev/null
+++ b/app/src/debug/AndroidManifest.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ package="se.leap.bitmaskclient"
+ android:requestLegacyExternalStorage="true"
+ >
+ <!-- package is overwritten in build.gradle -->
+
+ <!-- The following permissions are required by fastlane / espresso -->
+ <!-- _____________________________________________________________ -->
+ <!-- Allows unlocking your device and activating its screen so UI tests can succeed -->
+ <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
+ <uses-permission android:name="android.permission.WAKE_LOCK"/>
+
+ <!-- Allows for storing and retrieving screenshots -->
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
+ tools:ignore="ScopedStorage" />
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+
+ <!-- Allows changing locales -->
+ <uses-permission android:name="android.permission.CHANGE_CONFIGURATION"
+ tools:ignore="ProtectedPermissions" />
+
+ <uses-permission android:name="android.permission.DUMP"
+ tools:ignore="ProtectedPermissions" />
+ <!-- _____________________________________________________________ -->
+
+</manifest>
diff --git a/fastlane/Fastfile b/fastlane/Fastfile
index 19c557cc..d985984d 100644
--- a/fastlane/Fastfile
+++ b/fastlane/Fastfile
@@ -21,6 +21,12 @@ platform :android do
gradle(task: "test")
end
+ lane :screenshots do
+ capture_android_screenshots
+ frameit(white: true)
+ # deliver
+ end
+
desc "Submit a new Beta Build to Crashlytics Beta"
lane :beta do
gradle(task: "clean assembleRelease")
diff --git a/fastlane/README.md b/fastlane/README.md
index 7ec1207f..96002ac1 100644
--- a/fastlane/README.md
+++ b/fastlane/README.md
@@ -23,6 +23,14 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do
Runs all the tests
+### android screenshots
+
+```sh
+[bundle exec] fastlane android screenshots
+```
+
+
+
### android beta
```sh
diff --git a/fastlane/Screengrabfile b/fastlane/Screengrabfile
new file mode 100644
index 00000000..4c46de1a
--- /dev/null
+++ b/fastlane/Screengrabfile
@@ -0,0 +1,20 @@
+# remove the leading '#' to uncomment lines
+
+# app_package_name('your.app.package')
+# use_tests_in_packages(['your.screenshot.tests.package'])
+
+app_apk_path('app/build/outputs/apk/normalProductionFat/debug/Bitmask_debug.apk')
+# tests_apk_path('app/build/intermediates/apk/androidTest/normalProductionFat/debug/app-normal-production-fat-debug-androidTest.apk')
+
+# all locales
+# locales(['ar', 'az', 'bg', 'bn', 'br', 'ca', 'cs', 'de', 'el', 'es', 'es-AR', 'et', 'eu', 'fa-IR', 'fi', 'fr', 'gl', 'he', 'hr', 'hu', 'id', 'it', 'ja', 'my', 'nl', 'no', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru', 'tr', 'ug', 'uk', 'vi', 'zh-CN', 'zh-TW'])
+# prioritized locales
+# locales(['ar', 'bn', 'de', 'es', 'fa-IR', 'fr', 'he', 'hu', 'id', 'it', 'ja', 'my', 'nl', 'pt-BR', 'pt-PT', 'ru', 'tr', 'ug', 'uk', 'zh-CN', 'zh-TW'])
+# development locales
+locales(['ar', 'de', 'ru'])
+
+# clear all previously generated screenshots in your local output directory before creating new ones
+clear_previous_screenshots(true)
+
+# For more information about all available options run
+# fastlane screengrab --help
diff --git a/fastlane/report.xml b/fastlane/report.xml
deleted file mode 100644
index 071e9c62..00000000
--- a/fastlane/report.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<testsuites>
- <testsuite name="fastlane.lanes">
-
-
-
-
- <testcase classname="fastlane.lanes" name="0: default_platform" time="0.000435">
-
- </testcase>
-
-
- <testcase classname="fastlane.lanes" name="1: test" time="0.000588">
-
- <failure message="/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/actions/actions_helper.rb:67:in `execute_action'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/runner.rb:229:in `chdir'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/runner.rb:229:in `execute_action'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'&#10;Fastfile:21:in `block (2 levels) in parsing_binding'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/lane.rb:33:in `call'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/runner.rb:45:in `execute'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/lane_manager.rb:47:in `cruise_lane'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/commands_generator.rb:110:in `block (2 levels) in run'&#10;/Library/Ruby/Gems/2.6.0/gems/commander-4.6.0/lib/commander/command.rb:187:in `call'&#10;/Library/Ruby/Gems/2.6.0/gems/commander-4.6.0/lib/commander/command.rb:157:in `run'&#10;/Library/Ruby/Gems/2.6.0/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:124:in `run!'&#10;/Library/Ruby/Gems/2.6.0/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/commands_generator.rb:354:in `run'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/commands_generator.rb:43:in `start'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/fastlane/lib/fastlane/cli_tools_distributor.rb:123:in `take_off'&#10;/Library/Ruby/Gems/2.6.0/gems/fastlane-2.211.0/bin/fastlane:23:in `&lt;top (required)&gt;'&#10;/usr/local/bin/fastlane:23:in `load'&#10;/usr/local/bin/fastlane:23:in `&lt;main&gt;'&#10;&#10;Couldn't find gradlew at path '/Users/cyberta/workspace/bitmask_android/app/gradlew'" />
-
- </testcase>
-
- </testsuite>
-</testsuites>