template-monorepo/test/e2e/journey_registration_test.go

29 lines
1.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//go:build e2e
package e2e
import "testing"
// TestJourney_FullRegistration 模擬使用者第一次接觸系統的完整 onboarding
//
// POST /register # 建 ZITADEL human user + member draft + 發 OTP 信
// → POST /register/confirm # 驗 OTPmember 從 unverified 轉 active
// → POST /login # ZITADEL ROPG 拿 id_tokengateway 簽 CloudEP JWT
// → GET /members/me # 用新 JWT 看自己
//
// 這條 journey 需要真實 ZITADEL目前 e2e env 只有 mock故整段標記 skip 並
// 列出步驟。等 docker-compose 接上 ZITADEL container或指向 staging
// SkipStep 換成 Step + 真的 HTTP call 即可。
func TestJourney_FullRegistration(t *testing.T) {
j := NewJourney(t, "J-4", "完整註冊 → 登入 → 看自己(需 ZITADEL目前 stub")
defer j.Summary()
const reason = "目前 e2e env 未接 ZITADEL接上後改成 Step() 即可"
j.SkipStep("1", "POST /auth/register — 建 ZITADEL human user + member draft + 寄 OTP", reason)
j.SkipStep("2", "GET MailHog API 取 OTP 信件內容(或 mock 直接抓 Redis", reason)
j.SkipStep("3", "POST /auth/register/confirm — 驗 OTPmember status 由 unverified → active", reason)
j.SkipStep("4", "POST /auth/login — ZITADEL ROPG 拿 id_tokengateway 簽 CloudEP JWT", reason)
j.SkipStep("5", "GET /members/me — 用新 JWT 看自己", reason)
}