From bbd5e51d3d7bcfa498cbea30a6401e7e1481a87b Mon Sep 17 00:00:00 2001 From: Suzumiya Date: Tue, 6 Oct 2026 00:35:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=EF=BC=9A=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=96=87=E6=A1=88=E6=94=B9=E8=B5=B0=E5=BA=95?= =?UTF-8?q?=E9=83=A8=20toast=20=E5=90=8E=E6=94=B9=E7=94=A8=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `conversationModelSelect.test.tsx` 两处同步 `screen.getByText('…')` 改为 `await screen.findByText(…)`:状态文案现在渲染在 portal 的 toast 里(发布 → 宿主 re-render 一次),同步查询在慢机/并行下会竞态(CI 上就是这样红的) - 本地:`npx vitest run tests/conversationModelSelect.test.tsx` 29 passed;`appSurface + chatDialogFrameLayout` 225 passed / 9 skipped Refs #600, PR #607 --- .../tests/conversationModelSelect.test.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/ai-game-creator-shell/tests/conversationModelSelect.test.tsx b/apps/ai-game-creator-shell/tests/conversationModelSelect.test.tsx index c2a5c252f..efdc1e037 100644 --- a/apps/ai-game-creator-shell/tests/conversationModelSelect.test.tsx +++ b/apps/ai-game-creator-shell/tests/conversationModelSelect.test.tsx @@ -526,7 +526,10 @@ test('pre-send validation falls back when the selected model is disabled', async await act(async () => { await expect(ref.current?.ensureUsable()).resolves.toBe(true); }); - expect(screen.getByText('所选模型已停用,已切换为默认模型')).not.toBeNull(); + // 状态文案现在走组件自带的底部 toast(portal 到 body):等它出现,别用同步查询。 + expect( + await screen.findByText('所选模型已停用,已切换为默认模型'), + ).not.toBeNull(); expect(savedModelId).toBe('quality'); expect(invoke).toHaveBeenCalledWith('select_game_creator_model', { modelId: 'quality', @@ -552,7 +555,7 @@ test('follows the new server default when the saved selection was the default', await waitFor(() => expect(savedModelId).toBe('fast')); expect(savedModelIsDefault).toBe(true); expect( - screen.getByText('默认模型已更新,已切换为新的默认模型'), + await screen.findByText('默认模型已更新,已切换为新的默认模型'), ).not.toBeNull(); expect(invoke).toHaveBeenCalledWith('select_game_creator_model', { modelId: 'fast',