agent-zero/tests/test_webui_message_queue_static.py
linkliti 9964849b19 fix(webui): render pending queue thumbnails and drop failed adds
Pending queue items rendered image thumbnails from server paths before the upload confirmed, showing broken images, and a failed queue add left the pending entry stuck in the queue. Render pending thumbnails from local blob URLs until the upload confirms and drop the pending entry when the add fails.

Validation: queue static suite passes; node --check on message-queue-store.js.
2026-10-13 18:06:47 +03:00

25 lines
846 B
Python

from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parents[1]
def read(*parts: str) -> str:
return (PROJECT_ROOT / Path(*parts)).read_text(encoding="utf-8")
def test_pending_queue_thumbnails_use_local_blob_urls():
store_js = read("webui", "components", "chat", "message-queue", "message-queue-store.js")
queue_html = read("webui", "components", "chat", "message-queue", "message-queue.html")
assert "_pendingAttachmentUrls" in store_js
assert "getAttachmentUrl(item, filename)" in store_js
assert "attachmentUrls?.[filename]" in store_js
assert "getAttachmentUrl(item, att)" in queue_html
def test_failed_queue_adds_drop_pending_entries():
store_js = read("webui", "components", "chat", "message-queue", "message-queue-store.js")
assert store_js.count("_dropPendingItem(tempId)") >= 3