fix: 显示下发智能体的云端图标
This commit is contained in:
1 parent
9147b509c7
commit
a3c02e7464
10 files changed
+127
-12
No files matched your search
@@ -70,6 +70,26 @@ async function geometry(page: Page) {
|
||||
});
|
||||
}
|
||||
|
||||
test('distributed icons load over HTTP and broken images fall back in the titlebar', async ({ page }) => {
|
||||
await page.route('https://yuxi.example.test/api/storage/public/images/agent-0.png', route => route.fulfill({
|
||||
contentType: 'image/svg+xml',
|
||||
body: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><circle cx="16" cy="16" r="15" fill="blue"/></svg>',
|
||||
}));
|
||||
await page.route('https://yuxi.example.test/api/storage/public/images/agent-1.png', route => route.fulfill({ status: 404 }));
|
||||
await page.goto(`${baseUrl}?agents=2&icons=1`);
|
||||
const custom = page.getByRole('button', { name: '与智能体1聊天' }).locator('img');
|
||||
const fallback = page.getByRole('button', { name: '与智能体2聊天' }).locator('img');
|
||||
const speaker = page.getByRole('button', { name: '打开这条智能体消息' }).locator('img');
|
||||
await expect(custom).toHaveAttribute('src', 'https://yuxi.example.test/api/storage/public/images/agent-0.png');
|
||||
await expect(custom).toHaveCSS('image-rendering', 'auto');
|
||||
await expect(speaker).toHaveAttribute('src', 'https://yuxi.example.test/api/storage/public/images/agent-0.png');
|
||||
await expect(fallback).toHaveAttribute('src', /avatar-06\.png/);
|
||||
for (const img of [custom, fallback, speaker]) {
|
||||
await expect.poll(() => img.evaluate(node => (node as HTMLImageElement).naturalWidth)).toBeGreaterThan(0);
|
||||
}
|
||||
await page.screenshot({ path: test.info().outputPath('distributed-icons.png') });
|
||||
});
|
||||
|
||||
for (const size of [{ width: 1440, height: 900 }, { width: 1180, height: 720 }, { width: 1000, height: 640 }]) {
|
||||
test(`preview only clears overlapping speech at ${size.width}x${size.height}`, async ({ page }) => {
|
||||
await page.setViewportSize(size);
|
||||
|
||||
Reference in new issue
Block a user