style(teacher): use the playful continue button in the composer
This commit is contained in:
1 parent
e4198e3d6d
commit
784fa8c8db
7 files changed
+65
-53
No files matched your search
@@ -27,7 +27,7 @@ test('retry stickers stay readable and preserve drafts in a 319px consultation',
|
||||
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 });
|
||||
const retry = panel.locator('.consultation-retry');
|
||||
await expect(retry).toBeEnabled();
|
||||
await expect(retry).toHaveText('继续看看👀');
|
||||
expect(await retry.evaluate(el => el.scrollWidth <= el.clientWidth)).toBe(true);
|
||||
@@ -41,24 +41,28 @@ test('retry stickers stay readable and preserve drafts in a 319px consultation',
|
||||
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' },
|
||||
{ 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 }) => {
|
||||
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}`);
|
||||
const input = page.getByRole('textbox', { name: '向智能体提问' });
|
||||
const hint = page.getByRole('button', { name: '给我一点提示', exact: true });
|
||||
const hint = page.locator('form .consultation-hint');
|
||||
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)');
|
||||
await expect(hint).toHaveText('继续看看👀');
|
||||
await expect(hint).toHaveCSS('background-color', 'rgb(255, 242, 201)');
|
||||
const initialSend = (await send.boundingBox())!;
|
||||
const hintBounds = (await hint.boundingBox())!;
|
||||
expect(hintBounds.x).toBeLessThan(initialSend.x);
|
||||
expect(hintBounds.height).toBeGreaterThanOrEqual(44);
|
||||
expect(hintBounds.x + hintBounds.width).toBeLessThanOrEqual(initialSend.x);
|
||||
await page.getByTestId('teacher-chat-panel').screenshot({ path: test.info().outputPath(`composer-hint-${width}.png`) });
|
||||
expect(await sent()).toEqual([]);
|
||||
await input.fill('我想先自己说说');
|
||||
await expect(hint).toHaveCount(0);
|
||||
@@ -71,9 +75,9 @@ for (const width of [319, 508]) {
|
||||
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' }]);
|
||||
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);
|
||||
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('留着我自己的草稿');
|
||||
@@ -82,7 +86,7 @@ for (const width of [319, 508]) {
|
||||
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`) });
|
||||
await page.screenshot({ path: test.info().outputPath(`composer-draft-${width}.png`) });
|
||||
});
|
||||
|
||||
test(`rich replies keep code, tables and images inside the panel at ${width}px`, async ({ page }) => {
|
||||
|
||||
Reference in new issue
Block a user