feat(teacher): show a subtle hint action in the empty composer

This commit is contained in:
鲨鱼辣椒 committed 2026-09-28 15:17:18 +08:00
1 parent e00b3912bc
commit 73331e64f2
8 files changed
+184 -62

No files matched your search

+38
View File
@@ -22,6 +22,44 @@ test.beforeAll(async () => {
});
test.afterAll(async () => { await server?.close(); });
for (const width of [319, 508]) {
test(`empty-composer hint stays lightweight 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}`);
const input = page.getByRole('textbox', { name: '向智能体提问' });
const hint = page.getByRole('button', { name: '给我一点提示', exact: true });
const send = page.getByRole('button', { name: '提问', exact: true });
const sent = () => page.evaluate(() => (window as unknown as { __teacherReplyInputs: unknown[] }).__teacherReplyInputs);
await expect(hint).toBeEnabled();
await expect(hint).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)');
const initialSend = (await send.boundingBox())!;
const hintBounds = (await hint.boundingBox())!;
expect(hintBounds.x).toBeLessThan(initialSend.x);
expect(await sent()).toEqual([]);
await input.fill('我想先自己说说');
await expect(hint).toHaveCount(0);
expect(await send.boundingBox()).toEqual(initialSend);
await input.fill(' ');
await expect(hint).toBeVisible();
await input.fill('');
await expect(hint).toBeVisible();
expect(await send.boundingBox()).toEqual(initialSend);
expect(await sent()).toEqual([]);
await hint.click();
await expect(page.getByText('我们可以先从一个小地方开始。')).toBeVisible();
expect(await sent()).toEqual([{ requestId: expect.any(String), text: '给我一点提示', intent: 'suggestions', references: [], sourceConversationId: 'source' }]);
await expect(page.getByRole('button', { name: '我也说不清,你带我看看', exact: true })).toHaveCount(0);
await expect(page.locator('.consultation-messages').getByRole('button', { name: '给我一点提示', exact: true })).toHaveCount(0);
const card = page.getByRole('button', { name: '可以从哪个小地方开始?' });
await expect(card).toBeVisible();
await input.fill('留着我自己的草稿');
await expect(hint).toHaveCount(0);
await card.click();
await expect(page.getByText('好,我们就从这一个问题聊起。')).toBeVisible();
await expect(input).toHaveValue('留着我自己的草稿');
expect(await sent()).toHaveLength(2);
await page.screenshot({ path: test.info().outputPath(`composer-hint-${width}.png`) });
});
test(`rich replies keep code, tables and images inside the panel at ${width}px`, async ({ page }) => {
await page.setViewportSize({ width: 1180, height: 800 });
const errors: string[] = [];