-
-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing file opening from browser, file manager, and via file piker o…
…n tablet in CI.
- Loading branch information
1 parent
968cbfa
commit 9fadeff
Showing
3 changed files
with
96 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Enable Wi-Fi on the emulator | ||
adb shell svc wifi enable | ||
adb logcat -c | ||
# shellcheck disable=SC2035 | ||
adb logcat *:E -v color & | ||
|
||
PACKAGE_NAME="org.kiwix.kiwixmobile" | ||
TEST_PACKAGE_NAME="${PACKAGE_NAME}.test" | ||
TEST_SERVICES_PACKAGE="androidx.test.services" | ||
TEST_ORCHESTRATOR_PACKAGE="androidx.test.orchestrator" | ||
# Function to check if the application is installed | ||
is_app_installed() { | ||
adb shell pm list packages | grep -q "$1" | ||
} | ||
|
||
if is_app_installed "$PACKAGE_NAME"; then | ||
adb uninstall "${PACKAGE_NAME}" | ||
fi | ||
|
||
if is_app_installed "$TEST_PACKAGE_NAME"; then | ||
adb uninstall "${TEST_PACKAGE_NAME}" | ||
fi | ||
|
||
if is_app_installed "$TEST_SERVICES_PACKAGE"; then | ||
adb uninstall "${TEST_SERVICES_PACKAGE}" | ||
fi | ||
|
||
if is_app_installed "$TEST_ORCHESTRATOR_PACKAGE"; then | ||
adb uninstall "${TEST_ORCHESTRATOR_PACKAGE}" | ||
fi | ||
|
||
retry=0 | ||
while [ $retry -le 3 ]; do | ||
if ./gradlew connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=org.kiwix.kiwixmobile.localLibrary.OpeningFilesFromStorageTest "-Dorg.gradle.jvmargs=-Xmx16G -XX:+UseParallelGC" -Dfile.encoding=UTF-8; then | ||
echo "connectedDebugAndroidTest for file opening in tablet succeeded" >&2 | ||
break | ||
else | ||
adb kill-server | ||
adb start-server | ||
# Enable Wi-Fi on the emulator | ||
adb shell svc wifi enable | ||
adb logcat -c | ||
# shellcheck disable=SC2035 | ||
adb logcat *:E -v color & | ||
|
||
if is_app_installed "$PACKAGE_NAME"; then | ||
adb uninstall "${PACKAGE_NAME}" | ||
fi | ||
if is_app_installed "$TEST_PACKAGE_NAME"; then | ||
adb uninstall "${TEST_PACKAGE_NAME}" | ||
fi | ||
if is_app_installed "$TEST_SERVICES_PACKAGE"; then | ||
adb uninstall "${TEST_SERVICES_PACKAGE}" | ||
fi | ||
|
||
if is_app_installed "$TEST_ORCHESTRATOR_PACKAGE"; then | ||
adb uninstall "${TEST_ORCHESTRATOR_PACKAGE}" | ||
fi | ||
./gradlew clean | ||
retry=$(( retry + 1 )) | ||
if [ $retry -eq 3 ]; then | ||
adb exec-out screencap -p >screencap.png | ||
exit 1 | ||
fi | ||
fi | ||
done |