oh-my-muse/muse-studio/e2e/live-read.spec.ts
lili c7c65a97f2 feat(studio): 个人中心渲染真实购买/授权记录(account 深页活体切片)
承 account facade 活体订正(单体内 /account/{purchases,licenses,publish-records} 经 market 跨模块
MarketAccountProjectionProvider 本就可用),把已确认可用的后端接进 UI:
- PersonalCenter 新增「我的购买 / 我的授权」两区,渲染 market→account 投影真实记录;
- useAccount 加 useAccountPurchases / useAccountLicenses(GET /account/{purchases,licenses})。
- live-read.spec.ts 加第 5 例(chromium, MSW off, 真连 48080):/account 渲染真实资产「活体市场资产·测试」。

验证:整套 e2e 12/12、vitest 47/47、tsc 绿。进度总账 §五C 个人中心就地更新。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 03:11:20 -07:00

53 lines
2.3 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.

import { expect, test, type Page } from '@playwright/test';
/**
* 活体只读旅程 e2e(真实后端,MSW off)。
*
* 前置:vite 以 VITE_API_MOCK=false 运行(关 MSW)、真实 muse-server 在 48080、muse_slice_live 已种子。
* 目的:验证 rendered studio 经「client.ts 注入 tenant-id 修复」后的 HTTP 客户端,能直连活体单体并把
* content(作品列表)/market(资产浏览)/account(个人中心)三个 BC 的真实后端数据在 UI 正确渲染
* ——即真实数据形态与页面渲染契约对齐(MSW mock 形态之外的活体校验)。
*/
const TOKEN = 'test1';
async function seedToken(page: Page): Promise<void> {
await page.addInitScript((t) => {
window.localStorage.setItem('accessToken', t);
window.localStorage.setItem('tenantId', '1');
}, TOKEN);
}
test.describe('活体只读旅程(真实后端,MSW off)', () => {
test('作品列表渲染真实作品(content)', async ({ page }) => {
await seedToken(page);
await page.goto('/');
// .first():种子库存在多个同名作品(多次播种),strict 模式需唯一匹配;能渲染即证真实后端作品列表已加载。
await expect(page.getByText('活体验证样书').first()).toBeVisible({ timeout: 15_000 });
});
test('市场浏览渲染真实资产(market)', async ({ page }) => {
await seedToken(page);
await page.goto('/market');
await expect(page.getByText('活体市场资产·测试')).toBeVisible({ timeout: 15_000 });
});
test('个人中心渲染真实账户(account)', async ({ page }) => {
await seedToken(page);
await page.goto('/account');
await expect(page.getByText('活体用户')).toBeVisible({ timeout: 15_000 });
});
test('智能体列表渲染真实 Agent(ai)', async ({ page }) => {
await seedToken(page);
await page.goto('/agents');
await expect(page.getByText('活体测试智能体').first()).toBeVisible({ timeout: 15_000 });
});
test('个人中心渲染真实购买/授权记录(account 深页)', async ({ page }) => {
await seedToken(page);
await page.goto('/account');
// 个人中心「我的购买 / 我的授权」渲染 market→account 投影的真实资产(后端经 market 跨模块 Facade 提供curl 已证)。
await expect(page.getByText('活体市场资产·测试').first()).toBeVisible({ timeout: 15_000 });
});
});