修复持久目标模式切换测试的异步竞态 #428

Merged
lhk229 merged 1 commits from codex/fix-goal-mode-test-race into master 2026-09-19 01:29:40 +08:00
@@ -2519,6 +2519,11 @@ export function registerDeveloperAgentWindowTests() {
const emptyGoalPanel = await screen.findByLabelText('Agent Goal 状态');
expect(within(emptyGoalPanel).getByText('尚未开始')).not.toBeNull();
// 读取历史的异步链路未结束时按钮处于 disabled,等它可用再切换模式,避免点击落空。
const goalModeButton = screen.getByRole('button', { name: '目标' });
await waitFor(() => {
expect(goalModeButton.hasAttribute('disabled')).toBe(false);
});
selectDeveloperAgentChatMode('goal');
expect(
screen.getByRole('button', { name: '目标' }).getAttribute('aria-pressed'),