feat(chat): add manual refresh for delivered agents
This commit is contained in:
1 parent
862477f9d4
commit
2b1943dd0f
13 files changed
+517
-59
No files matched your search
@@ -40,7 +40,10 @@ for (const width of [520, 1000]) {
|
||||
await page.setViewportSize({ width, height: 800 });
|
||||
await page.goto(baseUrl + '?agents=8');
|
||||
const tabs = page.getByRole('navigation', { name: '已下发智能体' });
|
||||
const refresh = page.getByRole('button', { name: '刷新智能体', exact: true });
|
||||
await expect(tabs.getByRole('button')).toHaveCount(8);
|
||||
await expect(refresh).toBeVisible();
|
||||
await expect(tabs.getByRole('button', { name: '刷新智能体', exact: true })).toHaveCount(0);
|
||||
await expect(page.getByRole('combobox', { name: '新话题使用的智能体' })).toHaveCount(0);
|
||||
const last = tabs.getByRole('button', { name: '与智能体8聊天' });
|
||||
await last.focus();
|
||||
@@ -48,13 +51,22 @@ for (const width of [520, 1000]) {
|
||||
await expect(last).toHaveAttribute('aria-pressed', 'true');
|
||||
const bounds = await page.evaluate(() => {
|
||||
const strip = document.querySelector('.consultation-agent-tabs')!;
|
||||
const refresh = document.querySelector('button[aria-label="刷新智能体"]')!;
|
||||
const controls = document.querySelector('[data-testid="window-controls"]')!;
|
||||
return { right: strip.getBoundingClientRect().right, controlsLeft: controls.getBoundingClientRect().left,
|
||||
refreshLeft: refresh.getBoundingClientRect().left, refreshRight: refresh.getBoundingClientRect().right,
|
||||
scroll: strip.scrollLeft, documentWidth: document.documentElement.scrollWidth };
|
||||
});
|
||||
expect(bounds.right).toBeLessThanOrEqual(bounds.controlsLeft);
|
||||
expect(bounds.right).toBeLessThanOrEqual(bounds.refreshLeft);
|
||||
expect(bounds.refreshRight).toBeLessThanOrEqual(bounds.controlsLeft);
|
||||
expect(bounds.documentWidth).toBeLessThanOrEqual(width);
|
||||
expect(bounds.scroll).toBeGreaterThan(0);
|
||||
await refresh.click();
|
||||
await expect(tabs.getByRole('button')).toHaveCount(9);
|
||||
await expect(page.getByRole('status').filter({ hasText: '已更新' })).toBeVisible();
|
||||
await expect(last).toHaveAttribute('aria-pressed', 'true');
|
||||
await expect(refresh).toBeInViewport();
|
||||
await expect(refresh).toBeEnabled();
|
||||
await page.screenshot({ path: test.info().outputPath('distributed-agents-titlebar.png') });
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user