앱 공통 계층 — 데이터 저장소 · 서버 시계 · 푸시 · 결제·광고 · 다국어 5종 · 행성 표현 · 공통 UI · 화면 자산
This commit is contained in:
Executable
+54
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
# 퀘스트 참여 실왕복 — 에뮬레이터 세 개를 물고 기기에서 한 바퀴 돈다.
|
||||
#
|
||||
# `firebase emulators:exec` 가 이 스크립트를 실행한다. 먼저 시드를 넣고(보안 규칙이
|
||||
# `quests` 쓰기를 마스터로 막아 앱이 만들 수 없다) 통합 테스트를 돌린다.
|
||||
#
|
||||
# cd firebase
|
||||
# JAVA_HOME=... test/node_modules/.bin/firebase emulators:exec \
|
||||
# --only auth,firestore,functions --project demo-fanuzu \
|
||||
# "bash ../tool/emulator_quest_roundtrip.sh"
|
||||
set -euo pipefail
|
||||
|
||||
DEVICE="${DEVICE:-emulator-5554}"
|
||||
HOST="${FANUZU_EMULATOR_HOST:-127.0.0.1}"
|
||||
# 앱이 쓰는 프로젝트 ID. 설정 파일이 들어간 빌드는 `[DEFAULT]` 앱을 그대로 쓰므로
|
||||
# 실 프로젝트 ID 로 붙는다. 에뮬레이터는 프로젝트별로 칸이 나뉘어 시드도 같은 ID 에 넣는다.
|
||||
PROJECT="${FANUZU_EMULATOR_PROJECT:-fanuzu-dev-b020d}"
|
||||
BASE="http://127.0.0.1:8080/v1/projects/${PROJECT}/databases/(default)/documents"
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
|
||||
echo "▸ 시드 — 퀘스트 정의와 운영값 (${PROJECT})"
|
||||
# 에뮬레이터는 `Bearer owner` 토큰을 관리자로 본다. 이 헤더가 없으면 보안 규칙이
|
||||
# 그대로 적용돼 `quests` 쓰기가 막히고(마스터 전용) 시드가 조용히 사라진다.
|
||||
AUTH=(-H 'Authorization: Bearer owner' -H 'Content-Type: application/json')
|
||||
curl -sf -X PATCH "${BASE}/quests/daily-checkin" "${AUTH[@]}" -d '{
|
||||
"fields": {
|
||||
"type": {"stringValue": "attend"},
|
||||
"title": {"stringValue": "출석 체크"},
|
||||
"rewardPop": {"integerValue": "10"},
|
||||
"dailyLimit": {"integerValue": "1"},
|
||||
"active": {"booleanValue": true}
|
||||
}
|
||||
}' > /dev/null
|
||||
curl -sf -X PATCH "${BASE}/config/policy" "${AUTH[@]}" -d '{
|
||||
"fields": {
|
||||
"attendPop": {"integerValue": "10"},
|
||||
"stepTiers": {"arrayValue": {"values": [
|
||||
{"mapValue": {"fields": {"steps": {"integerValue": "1000"}, "pop": {"integerValue": "5"}}}},
|
||||
{"mapValue": {"fields": {"steps": {"integerValue": "5000"}, "pop": {"integerValue": "6"}}}},
|
||||
{"mapValue": {"fields": {"steps": {"integerValue": "10000"}, "pop": {"integerValue": "7"}}}},
|
||||
{"mapValue": {"fields": {"steps": {"integerValue": "15000"}, "pop": {"integerValue": "8"}}}}
|
||||
]}}
|
||||
}
|
||||
}' > /dev/null
|
||||
# 시드가 실제로 섰는지 본다. 없으면 여기서 끊는다 — 목록이 빈 채로 테스트가 돌면
|
||||
# 「참여 버튼이 없다」로만 보여 원인을 찾는 데 시간이 든다.
|
||||
curl -sf "${BASE}/quests/daily-checkin" "${AUTH[@]}" | grep -q '"attend"' \
|
||||
|| { echo "✗ 시드 실패 — quests/daily-checkin 이 없습니다"; exit 1; }
|
||||
echo "✓ 시드 확인"
|
||||
|
||||
echo "▸ 기기에서 왕복 (${DEVICE} · host ${HOST})"
|
||||
cd "$ROOT"
|
||||
exec fvm flutter test integration_test/quest_callable_emulator_test.dart \
|
||||
-d "$DEVICE" --dart-define="FANUZU_EMULATOR_HOST=${HOST}"
|
||||
Reference in New Issue
Block a user