feat(billing): guide parents to recharge the child account

This commit is contained in:
brother7 committed 2026-10-09 08:43:05 +08:00
1 parent fe1a3775c5
commit 281e6dc151
10 files changed
+105 -14

No files matched your search

+7 -5
View File
@@ -4,7 +4,7 @@ type WalletFixture = { requests: string[]; paid: boolean; created: boolean };
type FixtureGlobal = typeof globalThis & { __pointWalletE2E: WalletFixture };
test.describe('Permanent point wallet', () => {
test('reopens an unpaid order, keeps its frozen amount, and refreshes only after confirmed credit', async ({ launchElectronApp }, testInfo) => {
test('shows the child recipient, reopens its frozen unpaid order, and refreshes only after confirmed credit', async ({ launchElectronApp }, testInfo) => {
const app = await launchElectronApp({ skipSetup: true });
try {
const page = await getStableWindow(app);
@@ -40,12 +40,12 @@ test.describe('Permanent point wallet', () => {
});
if (path === '/api/auth/me') return result({
success: true,
user: { username: 'point-wallet', userId: 'point-wallet-user', tenantId: null, deptId: null, authorities: [] },
user: { username: 'child-wallet', userId: 'child-wallet-user', tenantId: null, deptId: null, authorities: [] },
moduleAccess: { programming: true, design: true, robot: true },
});
if (path === '/api/works/user/agent-profile') return result({
success: true, profile: {
display_name: '词元点数用户', age: null, gender: null, avatar_url: null,
display_name: '小麦', age: null, gender: null, avatar_url: null,
share_age_with_agents: false, share_gender_with_agents: false, analysis_enabled: true,
completed: true, version: 1, updated_at: '2026-09-22T00:00:00Z',
},
@@ -78,13 +78,15 @@ test.describe('Permanent point wallet', () => {
await page.goto(applicationUrl, { waitUntil: 'domcontentloaded' });
await page.getByTestId('ai-module-option-programming').click();
await expect(page.getByTestId('main-layout')).toBeVisible();
await expect(page.getByTestId('sidebar-member-menu-trigger')).toContainText('词元点数用户');
await expect(page.getByTestId('sidebar-member-menu-trigger')).toContainText('小麦');
await page.getByTestId('sidebar-member-menu-trigger').click();
await expect(page.getByTestId('sidebar-total-token-points')).toHaveText('0 点');
await expect(page.getByText('点数已用尽,充值后可继续使用。')).toBeVisible();
await expect(page.getByText('点数已用尽,请由家长完成当前账号充值。')).toBeVisible();
await page.getByTestId('sidebar-point-wallet-open').click();
const wallet = page.getByTestId('point-wallet-dialog');
await expect(wallet).toContainText('1 元充值 50 点');
await expect(wallet.getByTestId('point-recharge-recipient')).toHaveText('充值到:小麦(child-wallet)');
await expect(wallet).toContainText('请由家长登录孩子的账号完成付款');
await expect(wallet).not.toContainText('重置卡');
await wallet.getByRole('button', { name: /500 点\s*¥10.00/ }).click();
await expect(wallet.getByAltText('充值支付二维码')).toBeVisible();