diff --git a/apps/ai-game-creator-shell/tests/appSurface/project-development.suite.ts b/apps/ai-game-creator-shell/tests/appSurface/project-development.suite.ts index 885d8cc33..62b408736 100644 --- a/apps/ai-game-creator-shell/tests/appSurface/project-development.suite.ts +++ b/apps/ai-game-creator-shell/tests/appSurface/project-development.suite.ts @@ -6566,7 +6566,32 @@ export function registerProjectWorkbenchFoundationTests() { }; } if (command === 'ensure_ui_design_resource_for_prototype') { - return null; + // 必须返回真实形状的成功结果:返回 `null` 会让 `result.manifest.projectId` + // 抛 TypeError 并被组件吞进错误分支,用例就永远测不到它名字里的成功路径。 + return { + asset: { + id: 'ui-design-doc', + kind: GAME_CREATION_APP_UI_DESIGN_DOC_ASSET_KIND, + mediaType: GAME_CREATION_APP_UI_DESIGN_DOC_MEDIA_TYPE, + localPath: 'assets/ui-design.json', + source: { kind: 'generated' as const }, + }, + manifest: { + ...manifest, + assets: [ + ...manifest.assets, + { + id: 'ui-design-doc', + kind: GAME_CREATION_APP_UI_DESIGN_DOC_ASSET_KIND, + mediaType: GAME_CREATION_APP_UI_DESIGN_DOC_MEDIA_TYPE, + localPath: 'assets/ui-design.json', + source: { kind: 'generated' as const }, + }, + ], + }, + committedProjectRevision: 1, + created: true, + }; } throw new Error(`unexpected invoke ${command}`); }, @@ -6599,6 +6624,15 @@ export function registerProjectWorkbenchFoundationTests() { }), }), ); + // 成功路径:桥接结果被接受后画布切到 UI 编辑器视图;走错误分支时会停在 + // `resources.selected.*` 并在提示条上留下原因,这条断言让用例真的覆盖它名字里的事。 + await waitFor(() => + expect( + screen + .getByLabelText('项目主视窗') + .getAttribute('data-resource-view-state'), + ).toBe('resources.ui-editor'), + ); }); it('refuses to embed a non-loopback game preview in the client workbench', () => {