Add platform generation dialogs and task refresh

This commit is contained in:
kdletters
2026-05-26 19:40:23 +08:00
parent abea7cec1d
commit 4001ee0a5c
4 changed files with 58 additions and 10 deletions

View File

@@ -7137,6 +7137,48 @@ test('persisted generating puzzle draft keeps session polling on the same sessio
expect(getPuzzleAgentSession).toHaveBeenCalledTimes(2);
});
test('puzzle compile timeout shows failure dialog when reread session is still generating', async () => {
const user = userEvent.setup();
const runningSession = buildMockPuzzleAgentSession({
sessionId: 'puzzle-session-timeout',
draft: null,
stage: 'collecting_anchors',
progressPercent: 88,
lastAssistantReply: '正在生成拼图草稿。',
});
vi.mocked(createPuzzleAgentSession).mockResolvedValueOnce({
session: runningSession,
});
vi.mocked(executePuzzleAgentAction).mockRejectedValueOnce(
Object.assign(new Error('请求超时1800000ms'), {
name: 'TimeoutError',
}),
);
vi.mocked(getPuzzleAgentSession).mockResolvedValue({
session: runningSession,
});
render(<TestWrapper withAuth />);
await openCreateTemplateHub(user);
await user.click(await findCreationTypeButton('拼图'));
await user.click(await screen.findByRole('button', { name: '生成草稿' }));
const dialog = await screen.findByRole('dialog', { name: '发生错误' });
expect(within(dialog).getByText('拼图草稿 puzzle-session-timeout')).toBeTruthy();
expect(
within(dialog).getByText(
'拼图共创操作超时,请确认运行时后端已启动后重试。',
),
).toBeTruthy();
expect(within(dialog).getByRole('button', { name: '复制报错' })).toBeTruthy();
expect(
await screen.findByRole('progressbar', {
name: '拼图草稿生成进度',
}),
).toBeTruthy();
});
test('published puzzle work card restores its source session for editing', async () => {
const user = userEvent.setup();