Commit 4a5e0a0
committed
fix(ci): align environment variables with local .env.test to fix 50% E2E failure rate
Root Cause Analysis:
- Local tests: 100% pass rate with USE_MOCK_PURCHASE=true
- CI tests: 50% pass rate WITHOUT USE_MOCK_PURCHASE
- Missing env var caused CI to use REAL database/Stripe instead of mocks
Changes:
- Added USE_MOCK_PURCHASE=true (critical - enables mock purchase service)
- Added NEXT_PUBLIC_USE_MOCK_PURCHASE=true (client-side flag)
- Added PORT=3333 (server port)
- Added BYPASS_UTM_VALIDATION=false (middleware behavior)
- Added NEXT_PUBLIC_FF_PURCHASE_ENABLED=true (feature flag)
- Added NEXT_PUBLIC_ENABLE_TEST_HARNESS=true (test utilities)
- Added NEXT_PUBLIC_TEST_HARNESS_KEY (test auth)
- Added EDGE_CONFIG vars (empty, for AB testing graceful fallback)
Expected Impact:
- 50% → ~100% pass rate in CI
- Aligns CI environment exactly with local .env.test
- Tests will use mock services consistently
Ref: 100% local vs 50% CI = environment mismatch (not test code issue)
Ref: lib/purchase/purchase-service.ts:16-19 (USE_MOCK_PURCHASE check)1 parent e4cecd4 commit 4a5e0a0
1 file changed
+13
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
40 | 53 | | |
41 | 54 | | |
42 | 55 | | |
| |||
0 commit comments