Files
lotteryLaravel/e2e/tests/api/08.draw-publish-settle.spec.ts
kang 6ec9634704
Some checks failed
lotterLaravel CI / test (push) Has been cancelled
feat: 添加E2E测试环境配置支持
添加LOTTERY_E2E环境变量来控制E2E测试相关功能,
包括绕过验证码、登录限制和钱包API URL验证,
同时更新composer.json以包含E2E专用的提供者和服务。
2026-06-18 14:42:22 +08:00

38 lines
1.2 KiB
TypeScript
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.
/**
* 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();
});