Files
GameTime/tool/qa_device_health_connect.sh
Blomios d4df3822b7 docs(qa-261): ajoute documents conformité et scripts QA pour release Android
- Ajoute privacy-policy-v1.md et release-compliance-checklist.md
- Ajoute documents QA gates #238-#243
- Ajoute scripts de validation repo-only et device runbooks
- Prépare checklists exécutables avant upload Play fermé

Ticket #261
2026-08-28 23:11:16 +02:00

139 lines
3.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
PROJECT_ROOT="/home/anthony/Documents/Projects/GameTime"
ARTIFACT_BASE="${ARTIFACT_BASE:-$PROJECT_ROOT/.ideai/artifacts/qa-device}"
PHONE_SERIAL="${PHONE_SERIAL:-}"
PACKAGE_NAME="${PACKAGE_NAME:-com.idea.gametime}"
usage() {
cat <<'EOF'
Usage:
./tool/qa_device_health_connect.sh start
./tool/qa_device_health_connect.sh stop <artifact_dir>
Environment:
PHONE_SERIAL Optional adb serial for the phone under test
ARTIFACT_BASE Optional artifact root
PACKAGE_NAME Optional Android package name (default: com.idea.gametime)
EOF
}
adb_cmd() {
if [[ -n "$PHONE_SERIAL" ]]; then
adb -s "$PHONE_SERIAL" "$@"
else
adb "$@"
fi
}
require_adb() {
command -v adb >/dev/null 2>&1 || {
echo "adb not found in PATH." >&2
exit 1
}
adb start-server >/dev/null
adb_cmd get-state >/dev/null 2>&1 || {
echo "No adb device available. Connect the phone or set PHONE_SERIAL." >&2
exit 1
}
}
timestamp() {
date -u +"%Y%m%dT%H%M%SZ"
}
start_capture() {
require_adb
local dir="$ARTIFACT_BASE/health-connect-$(timestamp)"
mkdir -p "$dir"
adb devices -l >"$dir/adb-devices.txt"
adb_cmd shell getprop ro.build.fingerprint >"$dir/phone-build-fingerprint.txt"
adb_cmd shell dumpsys package "$PACKAGE_NAME" >"$dir/package-dumpsys-before.txt" || true
adb_cmd logcat -c
adb_cmd logcat -v threadtime >"$dir/logcat.txt" 2>&1 &
local pid=$!
echo "$pid" >"$dir/logcat.pid"
cat >"$dir/steps.md" <<EOF
# Health Connect manual QA
Date: $(date -u +"%Y-%m-%d %H:%M:%SZ")
Package: $PACKAGE_NAME
## Preconditions
- Fresh GameTime phone build installed on the connected Android device.
- Health Connect available on device.
- Device unlocked.
## Manual flow
1. Open GameTime.
2. Go to Paramètres > Intégrations > Health Connect.
3. Validate the visible initial status.
4. Tap "Autoriser l'accès" or "Gérer les autorisations".
5. Validate the expected path:
- permission sheet opens, or
- settings fallback opens cleanly.
6. Grant or deny permissions according to the scenario under test.
7. Return to GameTime and validate the refreshed status.
8. Start and finish a workout if export-after-workout must be checked.
9. Confirm the final Health Connect export outcome shown by the app.
## Evidence to collect
- Screenshot(s) of the visible status before and after permission handling.
- Screenshot(s) of Health Connect permission/settings UI if opened.
- Notes on whether the path used the permission contract or settings fallback.
- Result of export-after-workout if exercised.
EOF
echo "$dir"
}
stop_capture() {
local dir="${1:-}"
[[ -n "$dir" ]] || {
usage >&2
exit 2
}
require_adb
[[ -d "$dir" ]] || {
echo "Artifact directory not found: $dir" >&2
exit 1
}
if [[ -f "$dir/logcat.pid" ]]; then
kill "$(cat "$dir/logcat.pid")" >/dev/null 2>&1 || true
fi
adb_cmd shell dumpsys package "$PACKAGE_NAME" >"$dir/package-dumpsys-after.txt" || true
adb_cmd shell settings list secure >"$dir/settings-secure.txt" || true
cat <<EOF
Health Connect manual QA artifacts finalized in:
$dir
Archive expected:
- adb-devices.txt
- phone-build-fingerprint.txt
- package-dumpsys-before.txt
- package-dumpsys-after.txt
- logcat.txt
- steps.md
EOF
}
case "${1:-}" in
start)
start_capture
;;
stop)
shift
stop_capture "${1:-}"
;;
*)
usage
exit 2
;;
esac