style(teacher): make the retry action a playful sticker
This commit is contained in:
1 parent
a7124fb53a
commit
cb48f604dd
7 files changed
+52
-7
No files matched your search
@@ -21,6 +21,31 @@ test.beforeAll(async () => {
|
||||
await server.listen(); url = server.resolvedUrls!.local[0];
|
||||
});
|
||||
test.afterAll(async () => { await server?.close(); });
|
||||
test('retry stickers stay readable and preserve drafts in a 319px consultation', async ({ page }) => {
|
||||
await page.setViewportSize({ width: 1180, height: 800 });
|
||||
await page.addInitScript(() => localStorage.clear());
|
||||
for (const status of ['failed', 'cancelled']) {
|
||||
await page.goto(`${url}?kind=retry&status=${status}&width=319`);
|
||||
const panel = page.getByTestId('teacher-chat-panel');
|
||||
const retry = page.getByRole('button', { name: '继续看看👀', exact: true });
|
||||
await expect(retry).toBeEnabled();
|
||||
await expect(retry).toHaveText('继续看看👀');
|
||||
expect(await retry.evaluate(el => el.scrollWidth <= el.clientWidth)).toBe(true);
|
||||
const [panelBounds, retryBounds] = await Promise.all([panel.boundingBox(), retry.boundingBox()]);
|
||||
expect(retryBounds!.x).toBeGreaterThanOrEqual(panelBounds!.x);
|
||||
expect(retryBounds!.x + retryBounds!.width).toBeLessThanOrEqual(panelBounds!.x + panelBounds!.width);
|
||||
await panel.screenshot({ path: test.info().outputPath(`retry-${status}-319.png`) });
|
||||
const input = page.getByRole('textbox', { name: '向智能体提问' });
|
||||
await input.fill('我还有一点自己的想法');
|
||||
await retry.click();
|
||||
await expect(page.getByText('我们可以先从一个小地方开始。')).toBeVisible();
|
||||
await expect(input).toHaveValue('我还有一点自己的想法');
|
||||
expect(await page.evaluate(() => (window as unknown as { __teacherReplyInputs: unknown[] }).__teacherReplyInputs)).toEqual([
|
||||
{ requestId: expect.any(String), text: '给我一点提示', intent: 'suggestions', references: [], sourceConversationId: 'source' },
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
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 });
|
||||
|
||||
Reference in new issue
Block a user