fix: show teacher introductions as standalone clickable bubbles

This commit is contained in:
鲨鱼辣椒 committed 2026-09-29 17:16:37 +08:00
1 parent 2922f35e4b
commit 3a175101c9
11 files changed
+43 -26

No files matched your search

+13 -3
View File
@@ -41,6 +41,10 @@ for (const width of [375, 768, 1280]) {
await page.goto(baseUrl + '?agents=3&welcomes');
const group = page.getByTestId('teacher-welcomes');
await expect(group.locator('.teacher-welcome-card')).toHaveCount(3);
await expect(group).toHaveCSS('background-color', 'rgba(0, 0, 0, 0)');
await expect(group).toHaveCSS('box-shadow', 'none');
await expect(group.getByText('来认识一下')).toHaveCount(0);
await expect(group.getByRole('button', { name: '先自己试试' })).toHaveCount(0);
await expect(group).toBeInViewport({ ratio: 1 });
for (const card of await group.locator('.teacher-welcome-card').all()) {
await expect(card).toBeInViewport({ ratio: 1 });
@@ -53,12 +57,13 @@ for (const width of [375, 768, 1280]) {
await page.screenshot({ path: test.info().outputPath(`teacher-introductions-${width}.png`) });
await group.getByRole('button', { name: '收起智能体2的介绍' }).click();
await expect(group.locator('.teacher-welcome-card')).toHaveCount(2);
await group.getByRole('button', { name: '和智能体3聊聊' }).click();
await expect(page.locator('#coding-consultation-dock')).toHaveCount(0);
await group.getByRole('button', { name: '和智能体3聊聊' }).click({ position: { x: 8, y: 8 } });
await expect(page.getByRole('button', { name: '与智能体3聊天' })).toHaveAttribute('aria-pressed', 'true');
await expect(group).toHaveCount(0);
await page.getByRole('button', { name: '关闭智能体栏' }).click();
await expect(group.locator('.teacher-welcome-card')).toHaveCount(1);
await group.getByRole('button', { name: '先自己试试' }).click();
while (await group.count()) await group.getByRole('button', { name: /^收起.*的介绍$/ }).first().click();
await expect(group).toHaveCount(0);
});
}
@@ -75,7 +80,12 @@ test('many teacher introductions remain scrollable and honor reduced motion', as
await last.scrollIntoViewIfNeeded();
await expect(last).toBeInViewport({ ratio: 1 });
expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(520);
await group.getByRole('button', { name: '先自己试试' }).click();
await last.focus();
await page.keyboard.press('Enter');
await expect(page.getByRole('button', { name: '与智能体8聊天' })).toHaveAttribute('aria-pressed', 'true');
await page.getByRole('button', { name: '关闭智能体栏' }).click();
await expect(group.locator('.teacher-welcome-card')).toHaveCount(7);
while (await group.count()) await group.getByRole('button', { name: /^收起.*的介绍$/ }).first().click();
await expect(group).toHaveCount(0);
});