From 19c370302756128834f8ebcb0932a4e9dd378df7 Mon Sep 17 00:00:00 2001 From: Suzumiya Date: Tue, 15 Sep 2026 18:54:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=20markdown=20=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=B8=B2=E6=9F=93=E5=90=8E=E7=9A=84=E6=97=A2=E6=9C=89?= =?UTF-8?q?=E6=96=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - appSurface/project-commands.suite.ts:去掉期望文本里手写的前缀短横线(列表项目符号改由 CSS 绘制) - appSurface/project-commands.suite.ts:把路径匹配限定到 LI 元素(去掉前缀后 li 与内部 p 文本相同,getByText 会命中两个元素) - appSurface/project-assets.suite.ts、supervisor-runtime.suite.ts、preview-shortcuts:同步去掉期望文本里的手写短横线 - 背景:a60c04b53 把无序列表从手写短横线文本改成真正的 list-disc 标记,9 条既有断言因此失败,本笔把它们对齐到新契约 --- .../tests/appSurface/project-assets.suite.ts | 2 +- .../appSurface/project-commands.suite.ts | 48 ++++++++++++------- .../assert-planning-and-status-shortcuts.ts | 4 +- .../appSurface/supervisor-runtime.suite.ts | 4 +- 4 files changed, 33 insertions(+), 25 deletions(-) diff --git a/apps/ai-game-creator-shell/tests/appSurface/project-assets.suite.ts b/apps/ai-game-creator-shell/tests/appSurface/project-assets.suite.ts index e1b9f0b75..76d46704d 100644 --- a/apps/ai-game-creator-shell/tests/appSurface/project-assets.suite.ts +++ b/apps/ai-game-creator-shell/tests/appSurface/project-assets.suite.ts @@ -808,7 +808,7 @@ export function registerProjectAssetTests() { expect(await screen.findByText(/本地项目资产:/)).not.toBeNull(); expect(screen.getByText(/asset-20\.png/)).not.toBeNull(); expect(screen.queryByText(/asset-21\.png/)).toBeNull(); - expect(screen.getByText(/- 还有 2 个资产/)).not.toBeNull(); + expect(screen.getByText(/还有 2 个资产/)).not.toBeNull(); }); it('cancels asset list policy confirmation without reading assets', async () => { diff --git a/apps/ai-game-creator-shell/tests/appSurface/project-commands.suite.ts b/apps/ai-game-creator-shell/tests/appSurface/project-commands.suite.ts index a7dc65789..83af9d6ef 100644 --- a/apps/ai-game-creator-shell/tests/appSurface/project-commands.suite.ts +++ b/apps/ai-game-creator-shell/tests/appSurface/project-commands.suite.ts @@ -856,9 +856,9 @@ export function registerProjectCommandTests() { await submitChat('/diff checkpoint-1'); expect(await screen.findByText(/checkpoint:checkpoint-1/)).not.toBeNull(); - expect(screen.getByText(/- game\/file-20\.ts/)).not.toBeNull(); - expect(screen.queryByText(/- game\/file-21\.ts/)).toBeNull(); - expect(screen.getByText(/- 还有 2 项/)).not.toBeNull(); + expect(screen.getByText(/^game\/file-20\.ts$/)).not.toBeNull(); + expect(screen.queryByText(/^game\/file-21\.ts$/)).toBeNull(); + expect(screen.getByText(/还有 2 项/)).not.toBeNull(); expect(invoke).toHaveBeenCalledWith('diff_local_project_checkpoint', { projectPath: '/tmp/authorized-game', checkpointId: 'checkpoint-1', @@ -928,7 +928,7 @@ export function registerProjectCommandTests() { fireEvent.click(screen.getByRole('button', { name: '确认' })); expect(await screen.findByText(/checkpoint:checkpoint-1/)).not.toBeNull(); - expect(screen.getByText(/- game\/index\.html/)).not.toBeNull(); + expect(screen.getByText(/^game\/index\.html$/)).not.toBeNull(); expect(invoke).toHaveBeenCalledWith('diff_local_project_checkpoint', { projectPath: '/tmp/authorized-game', checkpointId: 'checkpoint-1', @@ -3803,12 +3803,19 @@ export function registerProjectCommandTests() { expect( screen.getByText( (_, element) => - element?.tagName === 'LI' && - element.textContent?.trim() === '- game/', + element?.tagName === 'LI' && element.textContent?.trim() === 'game/', ), ).not.toBeNull(); - expect(screen.getByText(/- game\/index\.html/)).not.toBeNull(); - expect(screen.getByText(/- assets\/uploads\/hero\.png/)).not.toBeNull(); + // 列表项渲染成 `
  • game/index.html

  • `:去掉手写短横线之后 + // `
  • ` 与内部 `

    ` 的文本完全相同,必须限定在 `LI` 上匹配,否则 getByText 会命中两个元素。 + expect( + screen.getByText( + (_, element) => + element?.tagName === 'LI' && + element.textContent?.trim() === 'game/index.html', + ), + ).not.toBeNull(); + expect(screen.getByText(/^assets\/uploads\/hero\.png$/)).not.toBeNull(); expect(invoke).toHaveBeenCalledWith('list_local_project_files', { projectPath: '/tmp/authorized-game', }); @@ -3872,7 +3879,14 @@ export function registerProjectCommandTests() { fireEvent.click(screen.getByRole('button', { name: '确认' })); expect(await screen.findByText(/本地项目文件:/)).not.toBeNull(); - expect(screen.getByText(/- game\/index\.html/)).not.toBeNull(); + // 同 `lists local project files` 的原理:`

  • ` 与内部 `

    ` 文本相同,需限定 `LI`。 + expect( + screen.getByText( + (_, element) => + element?.tagName === 'LI' && + element.textContent?.trim() === 'game/index.html', + ), + ).not.toBeNull(); expect(invoke).toHaveBeenCalledWith('list_local_project_files', { projectPath: '/tmp/authorized-game', }); @@ -4010,9 +4024,9 @@ export function registerProjectCommandTests() { expect( screen.getByText(/路径:\.agent\/project\.index\.json/), ).not.toBeNull(); - expect(screen.getByText(/- game\/file-12\.html · 21B/)).not.toBeNull(); - expect(screen.queryByText(/- game\/file-13\.html/)).toBeNull(); - expect(screen.getByText(/- 还有 2 项/)).not.toBeNull(); + expect(screen.getByText(/^game\/file-12\.html · 21B$/)).not.toBeNull(); + expect(screen.queryByText(/^game\/file-13\.html$/)).toBeNull(); + expect(screen.getByText(/还有 2 项/)).not.toBeNull(); expect(invoke).toHaveBeenCalledWith('build_local_project_index', { projectPath: '/tmp/authorized-game', }); @@ -4247,12 +4261,10 @@ export function registerProjectCommandTests() { expect(await screen.findByText(/Agent 智能服务状态:/)).not.toBeNull(); const chatText = screen.getByLabelText('聊天').textContent ?? ''; - expect(chatText).toContain( - '- 总体:已连接 · 3/3 个 Agent 可用 · 0 个待处理', - ); - expect(chatText).toContain('- 账号状态:已就绪'); - expect(chatText).toContain('- 输出方式:流式关闭 · 联网检索关闭'); - expect(chatText).toContain('- 所有 Agent 使用统一的官方智能服务'); + expect(chatText).toContain('总体:已连接 · 3/3 个 Agent 可用 · 0 个待处理'); + expect(chatText).toContain('账号状态:已就绪'); + expect(chatText).toContain('输出方式:流式关闭 · 联网检索关闭'); + expect(chatText).toContain('所有 Agent 使用统一的官方智能服务'); expect(screen.getByRole('button', { name: '查看状态' })).not.toBeNull(); expect(screen.queryByText(/sk-test-secret/)).toBeNull(); expect(screen.queryByText(/generator-secret/)).toBeNull(); diff --git a/apps/ai-game-creator-shell/tests/appSurface/project-preview/preview-shortcuts/assert-planning-and-status-shortcuts.ts b/apps/ai-game-creator-shell/tests/appSurface/project-preview/preview-shortcuts/assert-planning-and-status-shortcuts.ts index 0b6126a85..3788df509 100644 --- a/apps/ai-game-creator-shell/tests/appSurface/project-preview/preview-shortcuts/assert-planning-and-status-shortcuts.ts +++ b/apps/ai-game-creator-shell/tests/appSurface/project-preview/preview-shortcuts/assert-planning-and-status-shortcuts.ts @@ -1222,9 +1222,7 @@ export async function assertPlanningAndStatusShortcutFlow( const handoffMessage = messageBubble( handoffMessages[handoffMessages.length - 1], ); - expect(handoffMessage.textContent).toContain( - '- Run:run-main-shortcut-trace', - ); + expect(handoffMessage.textContent).toContain('Run:run-main-shortcut-trace'); expect(handoffMessage.textContent).toContain( 'Ready:art/Asset 生成首版美术素材', ); diff --git a/apps/ai-game-creator-shell/tests/appSurface/supervisor-runtime.suite.ts b/apps/ai-game-creator-shell/tests/appSurface/supervisor-runtime.suite.ts index c2c18e0bb..330be5fc0 100644 --- a/apps/ai-game-creator-shell/tests/appSurface/supervisor-runtime.suite.ts +++ b/apps/ai-game-creator-shell/tests/appSurface/supervisor-runtime.suite.ts @@ -1888,9 +1888,7 @@ export function registerSupervisorRuntimeTests() { ).not.toBeNull(); expect(screen.getByText(/编排轮次:/)).not.toBeNull(); expect(screen.getByText(/产物快照:/)).not.toBeNull(); - expect( - screen.getByText(/- game\/index\.html · fnv1a64:game/), - ).not.toBeNull(); + expect(screen.getByText(/game\/index\.html · fnv1a64:game/)).not.toBeNull(); expect(screen.getByText(/最近步骤:/)).not.toBeNull(); expect( screen.getByText(/Evaluator #2 · passed · evaluation/),