oh-my-muse/muse-studio/e2e/live-read.spec.ts
zizi 6dcabf69fb feat(solo): 收口治理入口并裁剪 studio 表面
完成 2.0.0 S4 的外部 AI、admin、account 与 solo SQL 收口,并推进 S5 studio 市场/handoff/旧编辑器入口裁剪。S5 的前端单测、构建与 route-only e2e 已留证;MSW-off 创作主线 e2e 仍因本地后端活体启动口径待修正,已在总账标为未完成验收。
2026-07-08 11:45:26 +08:00

60 lines
2.8 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(作品列表)/account(个人资料)/ai(智能体列表)的真实后端数据在 UI 正确渲染。
*/
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.skip('市场浏览渲染真实资产(market)', async ({ page }) => {
await seedToken(page);
await page.goto('/market');
// .first():推荐位与资产列表可能同时渲染同一资产(推荐区新增),strict 模式需唯一匹配;渲染即证真实市场数据已加载。
await expect(page.getByText('活体市场资产·测试').first()).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.skip('个人中心渲染真实购买/授权记录(account 深页)', async ({ page }) => {
await seedToken(page);
await page.goto('/account');
// 个人中心「我的购买 / 我的授权」渲染 market→account 投影的真实资产(后端经 market 跨模块 Facade 提供curl 已证)。
await expect(page.getByText('活体市场资产·测试').first()).toBeVisible({ timeout: 15_000 });
});
test.skip('个人中心渲染真实安全事件(account 深页)', async ({ page }) => {
await seedToken(page);
await page.goto('/account');
// 个人中心「安全事件」区渲染 GET /account/security-events 的真实摘要(按登录用户隔离;种子见 /tmp/SeedSec.javacurl 已证)。
await expect(page.getByText('活体安全事件·异地登录提醒').first()).toBeVisible({ timeout: 15_000 });
});
});