oh-my-muse/muse-studio/e2e/workspace.spec.ts
lili 8a6c809696 test(studio): studio e2e 全套 MSW-off 自起复现 8/8 全绿 + 修 webServer/workspace 假绿
承 MVP#1 前端长板收口。整套 playwright(chromium)在关 MSW、直连真实单体(48080)下 8/8 全绿,
经「移开 .env.local + 无预跑 vite + playwright 自起」验证可独立复现(非仅依赖手起 vite 被 reuse)。

修复(经验证):
- playwright.config.ts webServer.command:`pnpm dev` 在 playwright 派生的 /bin/sh 下报
  「pnpm: command not found」(exit 127,pnpm 不在该 PATH),改用等价 `./node_modules/.bin/vite`;
  并加 `env: VITE_API_MOCK=false`,使关 MSW 在 CI/自起场景可复现(此前仅 reuse 手起 vite 才绿,潜伏假绿)。
- workspace.spec.ts:原断言 mock「星海迷途」在 MSW-off 下必红(MSW 假绿反模式),
  改写为不依赖 mock 的工作台壳渲染冒烟,消除最后一处 MSW 互斥红。

覆盖(均 MSW off 真连、write 路径 DB 核验):accept-suggestion 正+负
(block3 rev1→2 + AI摘要正文 + ai_suggestion 归因落库)、knowledge-confirm
(draft→confirmed + 新建 Canonical entity)、live-read content/market/account/ai、workspace 壳。

进度总账 §五C/§四:记 8/8 里程碑;订正 suggestion 合并后留 pending 根因
(merge 不同事务回写 AI 域、靠 outbox→AI 异步翻,读 ContentSourceServiceImpl 确认,非产品 bug)。

遗留:e2e 暂依赖 muse_slice_live 预置 fixture(/tmp 助手手动 reseed),待补 playwright global-setup 自播种。

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

14 lines
743 B
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 } from '@playwright/test';
/**
* 工作台首页外壳渲染活体冒烟(真实后端,MSW off)。
*
* 原版断言 mock 数据「星海迷途」——在活体口径(VITE_API_MOCK=false 关闭 MSW)下该 mock 永不出现、必红,
* 属 MSW 假绿反模式(见 .agents/skills/golden-journey-vertical-slice.md)。已改为只验证创作台外壳渲染,
* 不依赖任何 mock;真实作品列表渲染由 live-read.spec.ts「作品列表渲染真实作品(content)」覆盖。
*/
test('工作台首页外壳渲染(真实后端, MSW off)', async ({ page }) => {
await page.goto('/');
await expect(page.getByRole('heading', { name: '我的创作台' })).toBeVisible({ timeout: 15_000 });
});