feat: 添加E2E测试环境配置支持
Some checks failed
lotterLaravel CI / test (push) Has been cancelled

添加LOTTERY_E2E环境变量来控制E2E测试相关功能,
包括绕过验证码、登录限制和钱包API URL验证,
同时更新composer.json以包含E2E专用的提供者和服务。
This commit is contained in:
2026-06-18 14:42:22 +08:00
parent 6b2ea39ea1
commit 6ec9634704
45 changed files with 3702 additions and 6 deletions

55
e2e/docker-compose.yml Normal file
View File

@@ -0,0 +1,55 @@
name: lotterlaravel-e2e
# e2e 测试专用只起后端依赖Postgres + Redis
# Laravel 应用本身由 `e2e/scripts/run.sh` 在宿主机上以 `php artisan serve` 拉起,
# 这样保留与生产一致的 PHP-FPM / OPCache / .env 加载路径,也避免在容器里
# 重新装一遍 vendor。容器只在需要数据库与缓存时使用。
#
# 使用方法(在仓库根):
# docker compose -f e2e/docker-compose.yml up -d
# ./e2e/scripts/run.sh
# docker compose -f e2e/docker-compose.yml down -v
#
# macOS 用户OrbStack / Colima / Docker Desktop 任一即可。
# Apple Silicon 警告postgis/postgis 镜像仅支持 amd64用 postgres:16-alpine 即可。
services:
postgres:
image: postgres:16-alpine
container_name: lotterlaravel-e2e-pg
restart: unless-stopped
environment:
POSTGRES_USER: lottery
POSTGRES_PASSWORD: lottery
POSTGRES_DB: lottery_e2e
ports:
- "15432:5432"
volumes:
- lotterlaravel-e2e-pg:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U lottery -d lottery_e2e"]
interval: 2s
timeout: 3s
retries: 30
redis:
image: redis:7-alpine
container_name: lotterlaravel-e2e-redis
restart: unless-stopped
ports:
- "16379:6379"
command:
- redis-server
- --save
- ""
- --appendonly
- "no"
# e2e 跑完即清,不做持久化(启动更快,状态可重现)
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 2s
timeout: 3s
retries: 30
volumes:
lotterlaravel-e2e-pg: