feat(webui): show when the agent picks up queued messages (#6719)
This commit is contained in:
1 parent
3025a01cf0
commit
b453de9cf6
26 files changed
+642
-29
No files matched your search
@@ -59,8 +59,16 @@ const samples: { label: string; message: UIMessage }[] = [
|
||||
];
|
||||
|
||||
export function AttachmentLayoutFixture() {
|
||||
const processingSamples: typeof samples = (["pending", "consumed"] as const).map((status) => ({
|
||||
label: `Attachments: ${status}`,
|
||||
message: {
|
||||
id: `attachments-${status}`, role: "user", content: "", createdAt: 8, processingStatus: status,
|
||||
media: [archive, image("Study.svg", "#83a9d8"), { kind: "video", name: "sample.webm", url: sampleVideo }],
|
||||
},
|
||||
}));
|
||||
const messages = new URLSearchParams(window.location.search).has("processing") ? processingSamples : samples;
|
||||
return <main className="space-y-8 px-4 py-6">
|
||||
{samples.map(({ label, message }) => <section key={message.id} aria-label={label}>
|
||||
{messages.map(({ label, message }) => <section key={message.id} aria-label={label}>
|
||||
<h2 className="mb-3 text-xs font-medium text-muted-foreground">{label}</h2>
|
||||
<MessageBubble message={message} />
|
||||
</section>)}
|
||||
|
||||
@@ -150,6 +150,31 @@ for (const width of [1024, 360]) {
|
||||
}
|
||||
}
|
||||
|
||||
test("attachment-only pending messages keep static dashed edges in forced colors", async ({ page }) => {
|
||||
await page.addInitScript(() => localStorage.setItem("nanobot.locale", "en"));
|
||||
await page.emulateMedia({ forcedColors: "active", reducedMotion: "no-preference", colorScheme: "dark" });
|
||||
await page.goto("/browser/fixture.html?case=attachments&processing");
|
||||
|
||||
const solid = page.getByRole("region", { name: "Attachments: consumed" });
|
||||
const fileSurface = "[data-file-attachment] > span";
|
||||
await expect(solid.locator(fileSurface)).toHaveCSS("border-top-style", "solid");
|
||||
await expect(solid.locator("[data-pending-edge-overlay]")).toHaveCount(0);
|
||||
|
||||
const region = page.getByRole("region", { name: "Attachments: pending" });
|
||||
const card = region.locator(fileSurface);
|
||||
await expect(card).toHaveCSS("border-top-style", "dashed");
|
||||
await expect(card.locator("[data-pending-edge-overlay]")).toBeHidden();
|
||||
const box = await bounds(card);
|
||||
expect({ width: box.width, height: box.height }).toEqual({ width: 96, height: 96 });
|
||||
const mediaEdges = region.locator('[data-solid-tone="media"] > .pending-edge-layer-dashed');
|
||||
await expect(mediaEdges).toHaveCount(2);
|
||||
for (const edge of await mediaEdges.all()) {
|
||||
await expect(edge).toBeVisible();
|
||||
await expect(edge).toHaveCSS("border-top-style", "dashed");
|
||||
await expect(edge).toHaveCSS("animation-name", "none");
|
||||
}
|
||||
});
|
||||
|
||||
test("image lightbox and file download remain keyboard accessible", async ({ page }, testInfo) => {
|
||||
await page.route("**/fixture/retry.webm", (route) => route.fulfill({ status: 503, body: "Temporarily unavailable" }));
|
||||
await openAttachments(page);
|
||||
|
||||
Reference in new issue
Block a user