Some checks failed
lotterLaravel CI / test (push) Has been cancelled
添加LOTTERY_E2E环境变量来控制E2E测试相关功能, 包括绕过验证码、登录限制和钱包API URL验证, 同时更新composer.json以包含E2E专用的提供者和服务。
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
/**
|
||
* 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();
|
||
});
|