fix: preserve complete consultation replies and recover retained history

This commit is contained in:
鲨鱼辣椒 committed 2026-09-28 17:38:31 +08:00
1 parent dda2f0a3be
commit d530abe580
14 files changed
+643 -38

No files matched your search

+34
View File
@@ -47,6 +47,40 @@ test('retry stickers stay readable and preserve drafts in a 319px consultation',
});
for (const width of [319, 508]) {
test(`quoted replies recover fully and incomplete replies retry without losing the draft at ${width}px`, async ({ page }) => {
await page.setViewportSize({ width: 1180, height: 800 });
const sent = () => page.evaluate(() => (window as unknown as { __teacherReplyInputs: unknown[] }).__teacherReplyInputs);
await page.goto(`${url}?kind=recovered&width=${width}`);
const panel = page.getByTestId('teacher-chat-panel');
const body = page.getByTestId('teacher-reply');
await expect(body).toContainText('它早就不是"刚搭好架子"那种阶段了');
await expect(body).toContainText('现在的阶段是「能玩,正在调手感」。');
await expect(page.getByText('查看收到的原始内容').locator('..')).not.toHaveAttribute('open');
await expect(page.getByRole('button', { name: '重新回答' })).toHaveCount(0);
expect(await sent()).toEqual([]);
expect(await body.evaluate(el => el.scrollWidth <= el.clientWidth)).toBe(true);
await panel.screenshot({ path: test.info().outputPath(`recovered-${width}.png`) });
await page.goto(`${url}?kind=incomplete&width=${width}`);
await expect(page.getByRole('status')).toHaveText('这次回复未能完整显示');
await expect(page.getByTestId('teacher-reply')).toHaveCount(0);
expect(await sent()).toEqual([]);
const input = page.getByRole('textbox', { name: '向智能体提问' });
await input.fill('我还在写的新想法');
const retry = page.getByRole('button', { name: '重新回答' });
const bounds = (await retry.boundingBox())!;
expect(bounds.height).toBeGreaterThanOrEqual(44);
expect(await panel.evaluate(el => el.scrollWidth <= el.clientWidth)).toBe(true);
await panel.screenshot({ path: test.info().outputPath(`incomplete-${width}.png`) });
await retry.click();
await expect(page.getByText('好,我们就从这一个问题聊起。')).toBeVisible();
await expect(input).toHaveValue('我还在写的新想法');
expect(await sent()).toEqual([{
requestId: expect.any(String), text: '现在项目是什么阶段?',
sourceConversationId: 'original-source', references: [{ messageId: 'original-message', text: '原来的项目记录', role: 'assistant' }],
}]);
});
test(`empty-composer hint stays readable and keeps the send position stable at ${width}px`, async ({ page }) => {
await page.setViewportSize({ width: 1180, height: 800 });
await page.goto(`${url}?kind=ordinary&width=${width}`);