style(teacher): use the playful continue button in the composer
This commit is contained in:
@@ -1829,20 +1829,21 @@ test('project consultations preserve student drafts and switch between work and
|
||||
await expect(page.getByRole('button', { name: '与代码智能体聊天' })).toBeVisible();
|
||||
await expect(page.getByRole('button', { name: '与朋友聊天' })).toHaveAttribute('aria-pressed', 'true');
|
||||
await expect(page.locator('#coding-consultation-dock')).toHaveCSS('width', '508px');
|
||||
await expect(teacher.getByTestId('consultation-composer-actions').getByRole('button', { name: '给我一点提示', exact: true })).toBeVisible();
|
||||
await expect(teacher.locator('form .consultation-hint')).toBeVisible();
|
||||
await expect(teacher.locator('form .consultation-hint')).toHaveText('继续看看👀');
|
||||
await expect(teacher.getByText('把你的困惑说出来就好')).toHaveCount(0);
|
||||
await expect(teacher.getByText('当前项目',{exact:true})).toHaveCount(0);
|
||||
await expect(teacher.getByRole('button',{name:'解释当前代码',exact:true})).toBeVisible();
|
||||
expect((await readState(electronApp)).captured.filter(item=>item.path.endsWith('/messages')&&item.method==='POST')).toHaveLength(0);
|
||||
await teacher.getByRole('textbox',{name:'向智能体提问'}).fill('还没说完的困惑');
|
||||
await expect(teacher.getByRole('button',{name:'给我一点提示',exact:true})).toHaveCount(0);
|
||||
await expect(teacher.locator('form .consultation-hint')).toHaveCount(0);
|
||||
expect((await readState(electronApp)).captured.filter(item=>item.path.endsWith('/messages')&&item.method==='POST')).toHaveLength(0);
|
||||
await teacher.getByRole('textbox',{name:'向智能体提问'}).fill('');
|
||||
await teacher.getByRole('button',{name:'给我一点提示',exact:true}).click();
|
||||
await teacher.locator('form .consultation-hint').click();
|
||||
await expect(teacher.getByText('我们可以从你最近试过的地方聊起。')).toBeVisible();
|
||||
await expect(teacher.getByTestId('teacher-discussion')).toHaveCount(0);
|
||||
await teacher.getByRole('textbox',{name:'向智能体提问'}).fill('还没说完的困惑');
|
||||
await expect(teacher.getByRole('button',{name:'给我一点提示',exact:true})).toHaveCount(0);
|
||||
await expect(teacher.locator('form .consultation-hint')).toHaveCount(0);
|
||||
await expect(teacher.getByRole('textbox',{name:'向智能体提问'})).toHaveValue('还没说完的困惑');
|
||||
expect((await readState(electronApp)).captured.filter(item=>item.path.endsWith('/messages')&&item.method==='POST')).toHaveLength(1);
|
||||
await teacher.getByRole('button',{name:'怎样观察别人玩游戏?',exact:true}).click();
|
||||
@@ -1881,7 +1882,7 @@ test('project consultations preserve student drafts and switch between work and
|
||||
}
|
||||
expect(requests.find(item => item.path.endsWith('/agent-topics') && item.method === 'POST')?.body?.teacherVersion).toBe(9);
|
||||
await expect(teacher).toHaveAccessibleName('朋友咨询');
|
||||
expect(consultationRequests[0].body).toMatchObject({intent:'suggestions',text:'给我一点提示'});
|
||||
expect(consultationRequests[0].body).toMatchObject({intent:'suggestions',text:'继续看看👀'});
|
||||
expect(consultationRequests[1].body).toMatchObject({text:'怎样观察别人玩游戏?'});
|
||||
expect(consultationRequests[1].body?.intent).toBeUndefined();
|
||||
await page.screenshot({path:test.info().outputPath('project-teacher-side-chat.png')});
|
||||
|
||||
@@ -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