Legg til F-Droid-skjermbilete og Maestro-automatisering

Automatiserte skjermbilete for alle tre språk (en-US, nb-NO, nn-NO)
med Maestro-flyt. Fire bilete per språk: kartvisning, valt tilfluktsrom,
kompassvisning og sivilforsvarsinfo. GPS-posisjon er sett til Bergen
sentrum (Torgallmenningen).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2026-03-10 19:17:16 +01:00
commit 093de8487b
18 changed files with 253 additions and 0 deletions

View file

@ -0,0 +1,72 @@
# Maestro flow: Capture F-Droid screenshots for nn-NO (Nynorsk)
#
# Nynorsk is not supported as a system locale on stock Android.
# This flow uses per-app locale (API 33+) which requires NOT clearing app state,
# since clearState wipes per-app locale settings.
#
# Run the main screenshots.yaml first (any locale) so that map tiles are cached.
# Then set the per-app locale and run this flow:
#
# adb shell "cmd locale set-app-locales no.naiv.tilfluktsrom --locales nn"
# maestro test .maestro/screenshots-nn.yaml
appId: no.naiv.tilfluktsrom
env:
OUTPUT_DIR: "fastlane/metadata/android"
---
# Mock GPS: Bergen centrum (Torgallmenningen)
- setLocation:
latitude: 60.3913
longitude: 5.3221
# Launch WITHOUT clearing state (preserves per-app locale and cached tiles)
- launchApp:
appId: no.naiv.tilfluktsrom
clearState: false
permissions:
android.permission.ACCESS_FINE_LOCATION: allow
android.permission.ACCESS_COARSE_LOCATION: allow
# Wait for shelter data to load
- extendedWaitUntil:
visible:
id: "statusText"
timeout: 15000
# Wait for shelter list to populate
- extendedWaitUntil:
visible:
id: "shelterList"
timeout: 15000
- waitForAnimationToEnd
# Screenshot 1: Map view
- takeScreenshot:
path: "${OUTPUT_DIR}/nn-NO/images/phoneScreenshots/1_map_view"
# Screenshot 2: Tap second shelter
- tapOn: "Håkonsgaten 5"
- waitForAnimationToEnd
- takeScreenshot:
path: "${OUTPUT_DIR}/nn-NO/images/phoneScreenshots/2_shelter_selected"
# Screenshot 3: Compass view
- tapOn:
id: "toggleViewFab"
- waitForAnimationToEnd
- takeScreenshot:
path: "${OUTPUT_DIR}/nn-NO/images/phoneScreenshots/3_compass_view"
# Screenshot 4: Civil defense dialog
- tapOn:
id: "toggleViewFab"
- waitForAnimationToEnd
- tapOn:
id: "infoButton"
- waitForAnimationToEnd
- takeScreenshot:
path: "${OUTPUT_DIR}/nn-NO/images/phoneScreenshots/4_civil_defense_info"

95
.maestro/screenshots.yaml Normal file
View file

@ -0,0 +1,95 @@
# Maestro flow: Capture F-Droid screenshots for Tilfluktsrom
#
# Usage (from project root):
# maestro test .maestro/screenshots.yaml
#
# With a specific locale:
# LOCALE=nb-NO maestro test .maestro/screenshots.yaml
#
# Prerequisites:
# - Android emulator (API 31+) or device running
# - App installed: ./gradlew installDebug
# - Internet connection (needed for map tile caching)
# - Install Maestro: curl -Ls https://get.maestro.mobile.dev | bash
#
# GPS is mocked to Bergen centrum (Torgallmenningen area),
# which has several shelters within walking distance.
appId: no.naiv.tilfluktsrom
env:
LOCALE: "en-US"
OUTPUT_DIR: "fastlane/metadata/android"
---
# Mock GPS: Bergen centrum (Torgallmenningen)
- setLocation:
latitude: 60.3913
longitude: 5.3221
# Grant location permission and launch with fresh state
- launchApp:
appId: no.naiv.tilfluktsrom
clearState: true
permissions:
android.permission.ACCESS_FINE_LOCATION: allow
android.permission.ACCESS_COARSE_LOCATION: allow
# Wait for shelter data to load from bundled asset.
- extendedWaitUntil:
visible:
id: "statusText"
timeout: 15000
# The app shows a map caching prompt on first GPS fix when no cache exists.
# Tap "Cache map" and wait for caching to complete (~15s).
# This prevents the overlay from re-appearing on subsequent GPS updates.
- extendedWaitUntil:
visible:
id: "loadingOkButton"
timeout: 15000
- tapOn:
id: "loadingOkButton"
# Wait for caching to finish (4 zoom levels x 9 grid points x 300ms ≈ 11s + network)
- extendedWaitUntil:
notVisible:
id: "loadingOverlay"
timeout: 30000
# Let the map settle and shelter list populate after caching
- waitForAnimationToEnd
- extendedWaitUntil:
visible:
id: "shelterList"
timeout: 10000
# Screenshot 1: Map view with shelter markers and bottom sheet
- takeScreenshot:
path: "${OUTPUT_DIR}/${LOCALE}/images/phoneScreenshots/1_map_view"
# Screenshot 2: Tap the second shelter (Håkonsgaten 5) to show a different selection.
# Shelter addresses are locale-independent, so this works in all languages.
- tapOn: "Håkonsgaten 5"
- waitForAnimationToEnd
- takeScreenshot:
path: "${OUTPUT_DIR}/${LOCALE}/images/phoneScreenshots/2_shelter_selected"
# Screenshot 3: Switch to compass view
- tapOn:
id: "toggleViewFab"
- waitForAnimationToEnd
- takeScreenshot:
path: "${OUTPUT_DIR}/${LOCALE}/images/phoneScreenshots/3_compass_view"
# Screenshot 4: Switch back to map, open civil defense info dialog
- tapOn:
id: "toggleViewFab"
- waitForAnimationToEnd
- tapOn:
id: "infoButton"
- waitForAnimationToEnd
- takeScreenshot:
path: "${OUTPUT_DIR}/${LOCALE}/images/phoneScreenshots/4_civil_defense_info"

86
.maestro/take-screenshots.sh Executable file
View file

@ -0,0 +1,86 @@
#!/usr/bin/env bash
# Generate F-Droid screenshots for all locales using Maestro.
#
# Prerequisites:
# 1. Install Maestro: curl -Ls https://get.maestro.mobile.dev | bash
# 2. Start an Android emulator (API 33+): emulator -avd <avd_name>
# 3. Build and install the app: ./gradlew installDebug
# 4. Run this script: .maestro/take-screenshots.sh
#
# Screenshots are saved directly into fastlane/metadata/android/<locale>/images/
#
# Locale handling:
# - en-US and nb-NO use system locale (settings put system system_locales)
# - nn-NO (Nynorsk) requires per-app locale since Android doesn't support
# Nynorsk as a system locale — it falls back to Bokmål
set -euo pipefail
cd "$(dirname "$0")/.."
FLOW=".maestro/screenshots.yaml"
FLOW_NN=".maestro/screenshots-nn.yaml"
restart_framework() {
adb shell stop 2>/dev/null
sleep 2
adb shell start 2>/dev/null
sleep 8
}
ensure_root() {
adb root 2>/dev/null || true
sleep 1
}
echo "=== Ensuring root access ==="
ensure_root
# --- en-US ---
echo "=== Capturing screenshots for en-US ==="
mkdir -p "fastlane/metadata/android/en-US/images/phoneScreenshots"
rm -f "fastlane/metadata/android/en-US/images/.gitkeep"
adb shell "settings put system system_locales en-US"
restart_framework
sed -i 's/LOCALE: ".*"/LOCALE: "en-US"/' "$FLOW"
maestro test "$FLOW"
echo "=== Done: en-US ==="
echo ""
# --- nb-NO ---
echo "=== Capturing screenshots for nb-NO ==="
mkdir -p "fastlane/metadata/android/nb-NO/images/phoneScreenshots"
rm -f "fastlane/metadata/android/nb-NO/images/.gitkeep"
adb shell "settings put system system_locales nb-NO"
restart_framework
sed -i 's/LOCALE: ".*"/LOCALE: "nb-NO"/' "$FLOW"
maestro test "$FLOW"
sed -i 's/LOCALE: "nb-NO"/LOCALE: "en-US"/' "$FLOW"
echo "=== Done: nb-NO ==="
echo ""
# --- nn-NO (Nynorsk) ---
# Android doesn't support nn as a system locale, so we use per-app locale.
# The main flow must have run first to cache map tiles (nn flow uses clearState: false).
echo "=== Capturing screenshots for nn-NO ==="
mkdir -p "fastlane/metadata/android/nn-NO/images/phoneScreenshots"
rm -f "fastlane/metadata/android/nn-NO/images/.gitkeep"
adb shell "am force-stop no.naiv.tilfluktsrom"
adb shell "cmd locale set-app-locales no.naiv.tilfluktsrom --locales nn"
sleep 2
maestro test "$FLOW_NN"
echo "=== Done: nn-NO ==="
echo ""
# Restore en-US
adb shell "settings put system system_locales en-US"
adb shell "cmd locale set-app-locales no.naiv.tilfluktsrom --locales en"
restart_framework
echo "All screenshots captured."
echo "Check: fastlane/metadata/android/*/images/phoneScreenshots/"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB