Files
PaperClipAI/ui/src/components/issue-properties/IssuePropertiesMarkdownWorkProduct.test.tsx
T
DottaandPaperclip 762d680daf feat(ui): upload files directly in task artifacts (#15964)
## Thinking Path

> - Paperclip helps people manage agent work and retain its context.
> - Task documents and attachments keep that context with the task.
> - The Artifacts panel showed output but could not accept a new file.
> - Uploading through a message can require resuming a paused task.
> - Existing document and attachment APIs can save files directly.
> - This PR adds direct uploads and a drop target to the task panel.
> - People can add context while keeping work paused and unassigned.

## Linked Issues or Issue Description

**What existing behavior does this improve?**
The task Artifacts panel and its existing document and attachment APIs.

**Subsystem affected**
ui/ — React board UI. No server, schema, or API changes.

**Current behavior**
The Artifacts panel cannot upload a file. It also excludes files
uploaded by people. The message composer can require a task to resume
before it submits attachments.

**Proposed behavior**
Use the upload icon or drop files anywhere in the open Artifacts panel.
The target includes the header, padding, and existing cards. Files save
directly to the task without a message or a pause change.

**Reason and benefit**
People can prepare a handoff on a paused, unassigned task without
starting agent work. Markdown becomes a task document. Other supported
files use attachment storage.

**Breaking changes**
Files from people now appear in Artifacts alongside agent output.
Promoted attachments still appear once. A repeated Markdown filename
creates a separate document instead of replacing an existing revision.
Existing APIs and limits stay the same.

**Additional context**
Related upload API work: Refs #7472 and Refs #7248. This PR adds the
missing task-panel entry point. ROADMAP.md lists Artifacts and Work
Products as available; this is a scoped UI improvement.

## What Changed

- Add an upload icon with no visible label or background.
- Accept file drops across the full task panel, including the desktop
portal header and mobile tabs.
- Show per-file progress and inline Retry and Dismiss actions.
- Import Markdown under a new document key and retain existing
revisions.
- Include files from people in Artifacts and dedupe promoted
attachments.
- Add component and task-journey stories for empty, populated, loading,
error, mobile, and drag-over states.
- Add real browser tests for persistence, pause preservation, duplicate
document names, full-panel drops, and partial failure recovery.

## Verification

- Five Playwright tests passed against an isolated instance started by
the source `test-drive` command. The document API, attachment storage,
pause holds, downloads, and task UI were real. Only the explicit upload
failure was injected.
- The browser tests verified desktop and mobile uploads, document
reading, persistence after reload, no task comments or runs, header
drops, preservation of original and hidden internal documents, reserved
filename handling, and upload retry.
- 163 focused UI tests passed.
- `pnpm -r typecheck` passed.
- `pnpm build` passed.
- `pnpm check:token-gates` passed.
- The full Vitest suite is running after repair of an exhausted local
PostgreSQL shared-memory pool. The initial run failed to initialize
PostgreSQL. Six unattached segments had no living creator or last-user
process; removing them restored free slots.
- CI and the current-head Greptile review are pending.

## Risks

- Artifacts now includes user files, so existing tasks can show more
cards.
- Uploads retain the server's authorization, file-type, size, and
revision checks. No migration is needed.
- Binary attachment uploads use the existing API. A transport failure
with an unknown save outcome can retain the existing API's retry
ambiguity.

## Model Used

OpenAI GPT-6 through Codex. The exact runtime snapshot ID and
context-window size were not exposed to this session. The model used
repository inspection, code editing, shell tools, and browser
automation.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-10-12 08:11:31 -05:00

487 lines
20 KiB
TypeScript

// @vitest-environment jsdom
import { flushSync } from "react-dom";
import { createRoot, type Root } from "react-dom/client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { Issue, IssueAttachment, IssueDocument, IssueWorkProduct } from "@paperclipai/shared";
import { artifactReviewDocumentKey } from "@paperclipai/shared";
import { IssuePropertiesArtifactsTab } from "./IssuePropertiesArtifactsTab";
import { ApiError } from "@/api/client";
import { TextAttachmentContext } from "@/context/TextAttachmentContext";
import { RichWorkProductCard } from "@/components/task-chat/RichWorkProductCard";
const mockIssuesApi = vi.hoisted(() => ({
listAttachments: vi.fn(async (): Promise<unknown[]> => []),
listWorkProducts: vi.fn(async (_issueId: string, _options?: { refreshPullRequests?: boolean }): Promise<unknown[]> => []),
ensureWorkProductReviewDocument: vi.fn(async (): Promise<unknown> => ({})),
}));
vi.mock("@/api/issues", () => ({ issuesApi: mockIssuesApi }));
const mockActivityApi = vi.hoisted(() => ({ runsForIssue: vi.fn(async (): Promise<unknown[]> => []) }));
vi.mock("@/api/activity", () => ({ activityApi: mockActivityApi }));
const mockAgentsApi = vi.hoisted(() => ({ list: vi.fn(async (): Promise<unknown[]> => []) }));
vi.mock("@/api/agents", () => ({ agentsApi: mockAgentsApi }));
const mockUseIssueDocuments = vi.hoisted(() =>
vi.fn((): { data: IssueDocument[] } => ({ data: [] })),
);
vi.mock("@/hooks/useIssueDocuments", () => ({ useIssueDocuments: mockUseIssueDocuments }));
vi.mock("@/lib/router", () => ({
Link: ({ to, children, ...props }: { to: string; children: React.ReactNode }) => <a href={to} {...props}>{children}</a>,
useLocation: () => ({ hash: "" }),
}));
vi.mock("@/components/MarkdownBody", () => ({
MarkdownBody: ({ children }: { children: string }) => (
<div data-testid="markdown-body">{children}</div>
),
}));
vi.mock("@/components/IssueDocumentAnnotations", () => ({
DocumentAnnotationsCountChip: ({ docKey }: { docKey: string }) => (
<span data-testid={`annotation-count-${docKey}`} />
),
IssueDocumentAnnotations: ({ doc, children }: { doc: IssueDocument; children: React.ReactNode }) => (
<div data-testid={`annotation-surface-${doc.key}`} data-document-id={doc.id}>{children}</div>
),
}));
const ATTACHMENT_ID = "00000000-0000-4000-8000-000000000001";
const WORK_PRODUCT_ID = "11111111-1111-4111-8111-111111111111";
const REVIEW_KEY = artifactReviewDocumentKey(WORK_PRODUCT_ID);
const issue = { id: "issue-1", companyId: "company-1", identifier: "PAP-1534", workMode: "standard" } as Issue;
function makeMarkdownWorkProduct(overrides: Partial<IssueWorkProduct> = {}): IssueWorkProduct {
const contentPath = `/api/attachments/${ATTACHMENT_ID}/content`;
return {
id: WORK_PRODUCT_ID,
companyId: "company-1",
projectId: null,
issueId: "issue-1",
executionWorkspaceId: null,
runtimeServiceId: null,
type: "artifact",
provider: "paperclip",
externalId: null,
title: "Verification report",
url: null,
status: "ready_for_review",
reviewState: "none",
isPrimary: false,
healthStatus: "unknown",
summary: null,
metadata: {
attachmentId: ATTACHMENT_ID,
contentType: "text/markdown",
byteSize: 64,
contentPath,
openPath: contentPath,
downloadPath: `${contentPath}?download=1`,
originalFilename: "report.md",
},
createdByRunId: null,
createdAt: new Date("2026-08-01T12:00:00Z"),
updatedAt: new Date("2026-08-01T12:00:00Z"),
...overrides,
} as IssueWorkProduct;
}
function makeReviewDocument(overrides: Partial<IssueDocument> = {}): IssueDocument {
return {
id: "document-1",
companyId: "company-1",
issueId: "issue-1",
key: REVIEW_KEY,
title: "Verification report",
format: "markdown",
body: "# Report\n\nRendered body",
latestRevisionId: "revision-1",
latestRevisionNumber: 1,
createdByAgentId: null,
createdByUserId: null,
updatedByAgentId: null,
updatedByUserId: null,
lockedAt: null,
lockedByAgentId: null,
lockedByUserId: null,
createdAt: new Date("2026-08-01T12:00:00Z"),
updatedAt: new Date("2026-08-01T12:00:00Z"),
...overrides,
} as IssueDocument;
}
function makeMarkdownAttachment(): IssueAttachment {
return {
id: ATTACHMENT_ID,
companyId: "company-1",
issueId: "issue-1",
issueCommentId: null,
assetId: "asset-1",
provider: "local",
objectKey: `objects/${ATTACHMENT_ID}`,
contentType: "text/markdown",
byteSize: 64,
sha256: "0".repeat(64),
originalFilename: "report.md",
createdByAgentId: "agent-1",
createdByUserId: null,
createdAt: new Date("2026-08-01T12:00:00Z"),
updatedAt: new Date("2026-08-01T12:00:00Z"),
contentPath: `/api/attachments/${ATTACHMENT_ID}/content`,
} as IssueAttachment;
}
async function act(callback: () => void | Promise<void>) {
let result: void | Promise<void> = undefined;
flushSync(() => {
result = callback();
});
await result;
}
async function flush() {
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 0));
});
}
async function waitForAssertion(assertion: () => void, attempts = 20) {
let lastError: unknown;
for (let attempt = 0; attempt < attempts; attempt += 1) {
try {
assertion();
return;
} catch (error) {
lastError = error;
await flush();
}
}
throw lastError;
}
describe("markdown work product review row", () => {
let container: HTMLDivElement;
let root: Root | null = null;
const openText = vi.fn();
beforeEach(() => {
vi.clearAllMocks();
container = document.createElement("div");
document.body.appendChild(container);
Element.prototype.scrollIntoView = vi.fn();
mockIssuesApi.listAttachments.mockResolvedValue([]);
mockIssuesApi.listWorkProducts.mockResolvedValue([makeMarkdownWorkProduct()]);
mockActivityApi.runsForIssue.mockResolvedValue([]);
mockAgentsApi.list.mockResolvedValue([]);
mockUseIssueDocuments.mockReturnValue({ data: [] });
});
afterEach(async () => {
if (root) {
const currentRoot = root;
await act(async () => currentRoot.unmount());
root = null;
}
container.remove();
});
async function renderTab(
props: { documentDeepLink?: { requestId: number; documentKey: string } | null } = {},
expectedText = "Verification report",
) {
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: false }, mutations: { retry: false } },
});
root = createRoot(container);
const currentRoot = root;
await act(async () =>
currentRoot.render(
<QueryClientProvider client={queryClient}>
<TextAttachmentContext.Provider value={openText}>
<IssuePropertiesArtifactsTab issue={issue} {...props} />
</TextAttachmentContext.Provider>
</QueryClientProvider>,
),
);
await waitForAssertion(() => {
expect(container.textContent).toContain(expectedText);
});
}
function expandButton() {
return container.querySelector('button[aria-expanded]') as HTMLButtonElement;
}
it("renders an expandable row with explicit raw and download actions", async () => {
await renderTab();
expect(container.querySelector("h2")?.textContent).toBe("Verification report");
expect(expandButton().textContent).toBe("Read document");
const raw = container.querySelector('a[title="Open raw"]') as HTMLAnchorElement;
const download = container.querySelector('a[title="Download"]') as HTMLAnchorElement;
expect(raw?.getAttribute("href")).toBe(`/api/attachments/${ATTACHMENT_ID}/content`);
expect(raw?.getAttribute("target")).toBe("_blank");
expect(download?.getAttribute("href")).toBe(`/api/attachments/${ATTACHMENT_ID}/content?download=1`);
});
it("shows saved artifacts while the first PR refresh is stalled", async () => {
const saved = makeMarkdownWorkProduct({
type: "pull_request", provider: "github", title: "Saved PR during refresh",
url: "https://github.com/example/repo/pull/42", metadata: {},
});
let finishRefresh!: (products: unknown[]) => void;
const refresh = new Promise<unknown[]>((resolve) => { finishRefresh = resolve; });
mockIssuesApi.listWorkProducts.mockImplementation(async (_id, options) => options?.refreshPullRequests ? refresh : [saved]);
await renderTab({}, saved.title);
await waitForAssertion(() => {
expect(mockIssuesApi.listWorkProducts).toHaveBeenCalledWith(issue.id, expect.objectContaining({ refreshPullRequests: true }));
expect(container.querySelector(`a[href="${saved.url}"]`)).not.toBeNull();
});
finishRefresh([{ ...saved, metadata: { state: "merged" } }]);
await waitForAssertion(() => expect(container.textContent?.toLowerCase()).toContain("merged"));
});
it("expands into the existing document surface without a server call when the document exists", async () => {
mockUseIssueDocuments.mockReturnValue({ data: [makeReviewDocument()] });
await renderTab();
// The proxy document maps onto the work-product row instead of a
// standalone Documents row.
expect(container.querySelectorAll(`[data-testid="annotation-surface-${REVIEW_KEY}"]`)).toHaveLength(0);
expect(container.querySelector(`[data-testid="annotation-count-${REVIEW_KEY}"]`)).not.toBeNull();
await act(async () => expandButton().click());
expect(
container.querySelector(`[data-testid="annotation-surface-${REVIEW_KEY}"]`)?.getAttribute("data-document-id"),
).toBe("document-1");
expect(container.querySelector('[data-testid="markdown-body"]')?.textContent).toContain("Rendered body");
expect(mockIssuesApi.ensureWorkProductReviewDocument).not.toHaveBeenCalled();
});
it("opens the attachment in a tab without replacing its review controls", async () => {
mockUseIssueDocuments.mockReturnValue({ data: [makeReviewDocument({ latestRevisionNumber: 3 })] });
await renderTab();
expect(container.textContent).toContain("revision 3");
expect(container.querySelector(`[data-testid="annotation-count-${REVIEW_KEY}"]`)).not.toBeNull();
const open = container.querySelector('button[aria-label="Open in tab: Verification report"]') as HTMLButtonElement;
expect(open).not.toBeNull();
await act(async () => open.click());
expect(openText).toHaveBeenCalledWith(ATTACHMENT_ID, "report.md");
expect(expandButton().getAttribute("aria-expanded")).toBe("false");
await act(async () => expandButton().click());
expect(container.querySelector(`[data-testid="annotation-surface-${REVIEW_KEY}"]`)).not.toBeNull();
});
it.each(["compact", "card"] as const)("keeps %s text-card downloads separate from opening a tab", async (variant) => {
root = createRoot(container);
await act(async () => root!.render(
<TextAttachmentContext.Provider value={openText}>
<RichWorkProductCard workProduct={makeMarkdownWorkProduct()} href={`/api/attachments/${ATTACHMENT_ID}/content`} variant={variant} />
</TextAttachmentContext.Provider>,
));
const download = container.querySelector('a[aria-label="Download: Verification report"]') as HTMLAnchorElement;
expect(download.getAttribute("href")).toBe(`/api/attachments/${ATTACHMENT_ID}/content?download=1`);
const click = new MouseEvent("click", { bubbles: true, cancelable: true });
await act(async () => { download.dispatchEvent(click); });
expect(click.defaultPrevented).toBe(false);
expect(openText).not.toHaveBeenCalled();
const open = container.querySelector('button[aria-label="Open in tab: Verification report"]') as HTMLButtonElement;
expect(open).not.toBeNull();
await act(async () => open.click());
expect(openText).toHaveBeenCalledWith(ATTACHMENT_ID, "report.md");
});
it("materializes the document on first expand", async () => {
mockIssuesApi.ensureWorkProductReviewDocument.mockResolvedValue(makeReviewDocument());
await renderTab();
await act(async () => expandButton().click());
expect(container.textContent).toContain("Preparing preview…");
await waitForAssertion(() => {
expect(mockIssuesApi.ensureWorkProductReviewDocument).toHaveBeenCalledWith("issue-1", WORK_PRODUCT_ID);
});
expect(mockIssuesApi.ensureWorkProductReviewDocument).toHaveBeenCalledTimes(1);
});
it("shows an unsupported state without retry for typed rejections", async () => {
mockIssuesApi.ensureWorkProductReviewDocument.mockRejectedValue(
new ApiError("Work product attachment is not Markdown", 415, {}),
);
await renderTab();
await act(async () => expandButton().click());
await waitForAssertion(() => {
expect(container.textContent).toContain("can't be previewed as Markdown");
});
expect(container.textContent).not.toContain("Retry");
});
it("offers an explicit retry for recoverable errors", async () => {
mockIssuesApi.ensureWorkProductReviewDocument.mockRejectedValue(
new ApiError("Internal error", 500, {}),
);
await renderTab();
await act(async () => expandButton().click());
await waitForAssertion(() => {
expect(container.textContent).toContain("Preview failed to load.");
});
const retry = Array.from(container.querySelectorAll("button")).find(
(button) => button.textContent === "Retry",
);
expect(retry).toBeDefined();
await act(async () => retry?.click());
await waitForAssertion(() => {
expect(mockIssuesApi.ensureWorkProductReviewDocument).toHaveBeenCalledTimes(2);
});
});
it("marks oversized markdown as too large without calling the server", async () => {
mockIssuesApi.listWorkProducts.mockResolvedValue([
makeMarkdownWorkProduct({
metadata: {
...(makeMarkdownWorkProduct().metadata as Record<string, unknown>),
byteSize: 512 * 1024 + 1,
},
}),
]);
await renderTab();
await act(async () => expandButton().click());
expect(container.textContent).toContain("too large to preview");
expect(mockIssuesApi.ensureWorkProductReviewDocument).not.toHaveBeenCalled();
});
it("expands from a document deep link and requests materialization", async () => {
mockIssuesApi.ensureWorkProductReviewDocument.mockResolvedValue(makeReviewDocument());
await renderTab({ documentDeepLink: { documentKey: REVIEW_KEY, requestId: 1 } });
await waitForAssertion(() => {
expect(container.querySelector('button[aria-expanded="true"]')).not.toBeNull();
expect(mockIssuesApi.ensureWorkProductReviewDocument).toHaveBeenCalledTimes(1);
expect(Element.prototype.scrollIntoView).toHaveBeenCalledWith({ behavior: "smooth", block: "center" });
});
});
it("hides the promoted markdown attachment from Files but keeps loose attachments", async () => {
const loose = {
...makeMarkdownAttachment(),
id: "22222222-2222-4222-8222-222222222222",
originalFilename: "loose-notes.md",
contentPath: "/api/attachments/22222222-2222-4222-8222-222222222222/content",
};
mockIssuesApi.listAttachments.mockResolvedValue([makeMarkdownAttachment(), loose]);
await renderTab();
await waitForAssertion(() => {
expect(container.textContent).toContain("loose-notes.md");
});
expect(container.querySelectorAll("article")).toHaveLength(2);
const looseLink = Array.from(container.querySelectorAll("a")).find(
(anchor) => anchor.getAttribute("download") === "loose-notes.md",
);
expect(looseLink?.getAttribute("href")).toBe("/api/attachments/22222222-2222-4222-8222-222222222222/content?download=1");
const open = container.querySelector<HTMLButtonElement>('button[aria-label="Open in tab: loose-notes.md"]');
expect(open).not.toBeNull();
await act(async () => open!.click());
expect(openText).toHaveBeenCalledWith(loose.id, "loose-notes.md");
});
it("keeps non-markdown work products on the download row", async () => {
const contentPath = `/api/attachments/${ATTACHMENT_ID}/content`;
mockIssuesApi.listWorkProducts.mockResolvedValue([
makeMarkdownWorkProduct({
metadata: {
attachmentId: ATTACHMENT_ID,
contentType: "application/pdf",
byteSize: 64,
contentPath,
openPath: contentPath,
downloadPath: `${contentPath}?download=1`,
originalFilename: "report.pdf",
},
}),
]);
await renderTab();
await waitForAssertion(() => {
const row = container.querySelector("article");
const link = row?.querySelector("a[download]");
expect(row?.textContent).toContain("Verification report");
expect(link?.textContent).toBe("Download file");
expect(link?.getAttribute("href")).toBe(`${contentPath}?download=1`);
});
expect(container.querySelector("button[aria-expanded]")).toBeNull();
});
it.each(["image/png", "application/octet-stream"])("renders %s media tiles with user uploads and without promoted duplicates", async (contentType) => {
const image = { ...makeMarkdownAttachment(), contentType, originalFilename: "cover.png" };
const looseImage = { ...image, id: "loose-image", contentPath: "/api/attachments/loose-image/content" };
const video = { ...makeMarkdownAttachment(), id: "loose-video", contentType: "application/octet-stream", originalFilename: "clip.mp4", contentPath: "/api/attachments/loose-video/content" };
mockIssuesApi.listAttachments.mockResolvedValue([image, video, looseImage, { ...video, id: "user-video", createdByAgentId: null, createdByUserId: "user-1" }]);
mockIssuesApi.listWorkProducts.mockResolvedValue([makeMarkdownWorkProduct({
title: "Cover artwork",
metadata: { attachmentId: ATTACHMENT_ID, contentType, originalFilename: "cover.png", contentPath: image.contentPath, openPath: image.contentPath, downloadPath: `${image.contentPath}?download=1`, byteSize: 64 },
})]);
await renderTab({}, "Cover artwork");
await waitForAssertion(() => {
const buttons = container.querySelectorAll('button[aria-label^="View image:"], button[aria-label^="Open video:"]');
expect(buttons).toHaveLength(4);
expect(container.querySelectorAll("img")).toHaveLength(2);
expect(container.querySelectorAll("article")).toHaveLength(4);
expect(container.querySelector("video")?.getAttribute("src")).toBe(video.contentPath);
expect(container.querySelectorAll("video")).toHaveLength(2);
});
});
it("groups rich cards by producing run", async () => {
const runOne = "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa";
const runTwo = "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb";
const imagePath = `/api/attachments/${ATTACHMENT_ID}/content`;
mockIssuesApi.listWorkProducts.mockResolvedValue([
makeMarkdownWorkProduct({
id: "22222222-2222-4222-8222-222222222222",
type: "pull_request",
provider: "github",
title: "Artifact grouping PR",
url: "https://github.com/paperclipai/paperclip/pull/1",
createdByRunId: runOne,
metadata: { repo: "paperclipai/paperclip", number: 1, baseRef: "master", headRef: "artifacts" },
}),
makeMarkdownWorkProduct({
id: "33333333-3333-4333-8333-333333333333",
title: "Artifacts screenshot",
createdByRunId: runTwo,
metadata: {
attachmentId: ATTACHMENT_ID,
contentType: "image/png",
byteSize: 64,
contentPath: imagePath,
openPath: imagePath,
downloadPath: `${imagePath}?download=1`,
},
}),
]);
mockActivityApi.runsForIssue.mockResolvedValue([
{ runId: runOne, agentId: "agent-1", startedAt: "2026-09-02T10:00:00Z", createdAt: "2026-09-02T10:00:00Z" },
{ runId: runTwo, agentId: "agent-2", startedAt: "2026-09-02T11:00:00Z", createdAt: "2026-09-02T11:00:00Z" },
]);
mockAgentsApi.list.mockResolvedValue([
{ id: "agent-1", name: "CodexCoder" },
{ id: "agent-2", name: "DesignCoder" },
]);
await renderTab({}, "Artifact grouping PR");
await waitForAssertion(() => {
expect(container.textContent).toContain("CodexCoder");
expect(container.textContent).toContain("DesignCoder");
expect(container.querySelectorAll("article")).toHaveLength(2);
expect(container.querySelector(`img[src="${imagePath}"]`)).not.toBeNull();
expect(container.querySelector('a[href="https://github.com/paperclipai/paperclip/pull/1"]')?.textContent).toContain("Open pull request");
expect(container.querySelector('button[aria-label="View image: Artifacts screenshot"]')).not.toBeNull();
});
});
});