summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAlbin <albin@mullvad.net>2022-11-01 10:57:10 +0100
committerAlbin <albin@mullvad.net>2022-11-01 14:53:02 +0100
commitb425725952a3610f37f9331ed04787a1bd44ad91 (patch)
tree7247bb5e96dbb621043cf731407109355ba48410
parentffbb2b5f6a7dd26f737e99379f60e8cf839b9517 (diff)
downloadmullvadvpn-b425725952a3610f37f9331ed04787a1bd44ad91.tar.xz
mullvadvpn-b425725952a3610f37f9331ed04787a1bd44ad91.zip
Ensure android app is re-installed in gh actions
This makes the instrumentation more robust as it avoids any potential signature mismatch (which is acceptable in a ci environment). It also makes sure that no app data/cache is left from previous runs.
-rwxr-xr-xci/run-android-instrumented-tests.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/ci/run-android-instrumented-tests.sh b/ci/run-android-instrumented-tests.sh
index a69cd29d69..cf29289c3d 100755
--- a/ci/run-android-instrumented-tests.sh
+++ b/ci/run-android-instrumented-tests.sh
@@ -5,11 +5,25 @@ LOG_FILE_NAME="mullvad.instrumentation_data_proto"
LOG_FILE_PATH="/sdcard/$LOG_FILE_NAME"
LOG_FAILURE_MESSAGE="FAILURES\!\!\!"
-adb install -r -t "$APK_BASE_DIR/debug/app-debug.apk"
+echo "Running instrumented tests..."
+echo ""
+
+echo "### Ensure uninstalled ###"
+adb uninstall net.mullvad.mullvadvpn || echo "App package not installed"
+adb uninstall net.mullvad.mullvadvpn.test || echo "Test package not installed"
+echo ""
+
+echo "### Install ###"
+adb install -t "$APK_BASE_DIR/debug/app-debug.apk"
adb install "$APK_BASE_DIR/androidTest/debug/app-debug-androidTest.apk"
+echo ""
+
+echo "### Start tests ###"
adb shell am instrument -w -f "$LOG_FILE_NAME" net.mullvad.mullvadvpn.test/androidx.test.runner.AndroidJUnitRunner
+echo ""
# Print log so that it shows as part of GitHub Actions logs etc
+echo "### Logs ###"
adb shell cat "$LOG_FILE_PATH"
if adb shell grep -q "$LOG_FAILURE_MESSAGE" "$LOG_FILE_PATH"; then