测试:模型状态文案改走底部 toast 后改用异步查询
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 6m31s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 4m36s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 6m10s
Project CI / Frontend tests (pull_request) Successful in 3m19s
Project CI / Backend tests (pull_request) Successful in 7m32s
Project CI / AI game creator shell web tests (pull_request) Successful in 2m59s
Project CI / Repository checks (pull_request) Successful in 6m26s
Project CI / Native shell tests (pull_request) Successful in 8m52s

- `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
This commit is contained in:
2026-10-06 00:35:32 +08:00
parent 57ae4d5251
commit bbd5e51d3d
@@ -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',