fix: 部分收付累计释额并扩展结算 E2E 与 CI
账期收付改为按累计已付同步 credit_ledger,修复多笔 partial_paid 与坏账核销重复释额;新增 API E2E(占成、权限、部分收付/坏账)与 GitHub Actions e2e-api job。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
28
e2e/tests/ui/admin-settlement-center.spec.ts
Normal file
28
e2e/tests/ui/admin-settlement-center.spec.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
const ADMIN_URL = process.env.PLAYWRIGHT_ADMIN_URL ?? 'http://localhost:3801';
|
||||
const ADMIN_ACCOUNT = process.env.E2E_ADMIN_USERNAME ?? 'admin';
|
||||
const ADMIN_PASSWORD = process.env.E2E_ADMIN_PASSWORD ?? '12345678';
|
||||
|
||||
test('超管进入结算中心 → 账期管理页可见', async ({ page }) => {
|
||||
test.setTimeout(120_000);
|
||||
|
||||
await page.goto(`${ADMIN_URL}/admin/login`);
|
||||
const account = page.locator('#admin-account');
|
||||
await account.waitFor({ state: 'visible', timeout: 60_000 });
|
||||
await account.fill(ADMIN_ACCOUNT);
|
||||
await page.locator('#admin-password').fill(ADMIN_PASSWORD);
|
||||
await page.locator('img[src^="data:image"]').waitFor({ state: 'visible', timeout: 30_000 });
|
||||
await page.locator('#admin-captcha').fill('LOTTERY_E2E_BYPASS');
|
||||
await page.getByRole('button', { name: /^登录$|Sign in|submit/i }).click();
|
||||
await page.waitForURL(/\/admin(?!\/login)/, { timeout: 45_000 });
|
||||
|
||||
await page.goto(`${ADMIN_URL}/admin/settlement-center`);
|
||||
await expect(page.getByText(/结算中心|Settlement center/i).first()).toBeVisible({
|
||||
timeout: 60_000,
|
||||
});
|
||||
await expect(page.getByText(/账期管理|Period/i).first()).toBeVisible({ timeout: 30_000 });
|
||||
await expect(page.getByRole('button', { name: /开账|Open period/i }).first()).toBeVisible({
|
||||
timeout: 30_000,
|
||||
});
|
||||
});
|
||||
49
e2e/tests/ui/front-place-bet.spec.ts
Normal file
49
e2e/tests/ui/front-place-bet.spec.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { fetchOpenDrawNo, tickDraws } from '../api/_helper';
|
||||
|
||||
const FRONT_URL = process.env.PLAYWRIGHT_FRONT_URL ?? 'http://localhost:3800';
|
||||
const USER = process.env.E2E_PLAYER_USERNAME ?? 'demo_player';
|
||||
const PASS = process.env.E2E_PLAYER_PASSWORD ?? '12345678';
|
||||
|
||||
async function loginToHall(page: import('@playwright/test').Page): Promise<void> {
|
||||
await page.goto(`${FRONT_URL}/login`);
|
||||
const userInput = page.locator('#login-user');
|
||||
await userInput.waitFor({ state: 'visible', timeout: 60_000 });
|
||||
await userInput.fill(USER);
|
||||
await page.locator('#login-pass').fill(PASS);
|
||||
await page.locator('img[src^="data:image"]').waitFor({ state: 'visible', timeout: 30_000 });
|
||||
await page.locator('#login-captcha').fill('LOTTERY_E2E_BYPASS');
|
||||
await page.getByRole('button', { name: /^登录$|Sign in|submit/i }).click();
|
||||
await page.waitForURL(/\/hall/, { timeout: 45_000 });
|
||||
}
|
||||
|
||||
test('玩家端大厅 → 填写号码金额 → 预览并提交下注', async ({ page }) => {
|
||||
test.setTimeout(180_000);
|
||||
|
||||
await fetchOpenDrawNo();
|
||||
await tickDraws();
|
||||
|
||||
await loginToHall(page);
|
||||
|
||||
const grid = page.getByRole('section', { name: /下注表格|Betting/i });
|
||||
await grid.waitFor({ state: 'visible', timeout: 60_000 });
|
||||
|
||||
const numberInput = grid.locator('input[inputmode="text"]').first();
|
||||
await numberInput.waitFor({ state: 'visible', timeout: 30_000 });
|
||||
await numberInput.fill('12');
|
||||
|
||||
const amountInput = grid.locator('input[inputmode="decimal"]').first();
|
||||
await amountInput.fill('10');
|
||||
|
||||
const submitBtn = page.getByRole('button', { name: /提交下注|Submit bet/i });
|
||||
await expect(submitBtn).toBeEnabled({ timeout: 60_000 });
|
||||
await submitBtn.click();
|
||||
|
||||
const confirmBtn = page.getByRole('button', { name: /确认提交|Confirm/i });
|
||||
await confirmBtn.waitFor({ state: 'visible', timeout: 30_000 });
|
||||
await confirmBtn.click();
|
||||
|
||||
await expect(page.getByText(/下注成功|Bet placed|订单号|Order/i)).toBeVisible({
|
||||
timeout: 45_000,
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user