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

View File

@@ -0,0 +1,37 @@
/**
* E2E开奖 + 结算 + 派彩(确定性流水线,无 skip
*/
import { test, expect, request as pwRequest } from '@playwright/test';
import {
playerLoginViaBypass,
resetE2EPlayer,
fetchCurrentDrawNo,
} from './_helper';
import { runWalletDrawSettlement } from './helpers/draw-settlement';
test('下注 → 关盘 → 录号 → publish → 结算 → 派彩 → 余额涨 + 公开结果可查', async () => {
test.setTimeout(180_000);
await resetE2EPlayer();
const draw = await fetchCurrentDrawNo();
expect(draw?.draw_no, '当前没有 open 期号').toBeTruthy();
const session = await playerLoginViaBypass();
const adminSession = await (await import('./_helper')).adminLoginViaBypass();
const result = await runWalletDrawSettlement({
adminToken: adminSession.accessToken,
playerToken: session.access_token,
drawNo: draw!.draw_no,
});
expect(result.balanceAfter).toBeGreaterThan(result.balanceBefore);
const publicCtx = await pwRequest.newContext();
const pub2 = await publicCtx.get(`/api/v1/draw/results/${draw!.draw_no}`);
expect(pub2.ok()).toBeTruthy();
const pb2 = (await pub2.json()) as any;
expect(pb2.code).toBe(0);
await publicCtx.dispose();
});