feat: 按老师发布配置渲染快捷提示
This commit is contained in:
1 parent
4103754b80
commit
53d5b6ba5b
7 files changed
+147
-3
No files matched your search
@@ -47,6 +47,35 @@ test('retry stickers stay readable and preserve drafts in a 319px consultation',
|
||||
});
|
||||
|
||||
for (const width of [319, 508]) {
|
||||
test(`published shortcuts send their prompts and keep eight long labels scrollable at ${width}px`, async ({ page }) => {
|
||||
await page.setViewportSize({ width: 1180, height: 800 });
|
||||
await page.goto(`${url}?kind=shortcuts&width=${width}`);
|
||||
const panel = page.getByTestId('teacher-chat-panel');
|
||||
const shortcuts = page.locator('form .consultation-hint');
|
||||
await expect(shortcuts).toHaveCount(8);
|
||||
await expect(shortcuts.first()).toHaveText('看看进展');
|
||||
await expect(shortcuts.nth(1)).toHaveText('解释代码');
|
||||
await expect(shortcuts.nth(1)).toBeEnabled();
|
||||
const form = (await panel.locator('form').boundingBox())!;
|
||||
expect(form.y + form.height).toBeLessThanOrEqual(800);
|
||||
expect(await panel.evaluate(el => el.scrollWidth <= el.clientWidth)).toBe(true);
|
||||
await shortcuts.last().scrollIntoViewIfNeeded();
|
||||
await panel.screenshot({ path: test.info().outputPath(`shortcuts-${width}.png`) });
|
||||
await shortcuts.last().click();
|
||||
await expect(page.getByText('请讨论第 8 个主题。', { exact: true })).toBeVisible();
|
||||
await expect(page.getByText('好,我们就从这一个问题聊起。')).toBeVisible();
|
||||
await shortcuts.nth(1).click();
|
||||
await expect(page.getByText('请解释当前项目最近的代码改动,用一个具体例子帮助我理解。', { exact: true })).toBeVisible();
|
||||
const inputs = await page.evaluate(() => (window as unknown as { __teacherReplyInputs: unknown[] }).__teacherReplyInputs);
|
||||
expect(inputs).toEqual([
|
||||
{ requestId: expect.any(String), text: '请讨论第 8 个主题。', references: [], projectId: 'fixture', sourceConversationId: 'source' },
|
||||
{ requestId: expect.any(String), text: '请解释当前项目最近的代码改动,用一个具体例子帮助我理解。', references: [], projectId: 'fixture', sourceConversationId: 'source' },
|
||||
]);
|
||||
await page.goto(`${url}?kind=shortcuts-empty&width=${width}`);
|
||||
await expect(page.getByRole('textbox', { name: '向智能体提问' })).toBeEnabled();
|
||||
await expect(page.locator('form .consultation-hint')).toHaveCount(0);
|
||||
});
|
||||
|
||||
for (const chat of ['legacy', 'continuous']) test(`quoted ${chat} 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);
|
||||
|
||||
Reference in new issue
Block a user