Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions e2e/tests/paste-upload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,22 @@ test.describe("Paste to upload", () => {
page,
context,
}) => {
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
// Headless CI exposes no readable clipboard, so capture what the app writes.
await page.addInitScript(() => {
const store = window as unknown as { __lastCopy?: string };
const record = (text: string) => {
store.__lastCopy = text;
return Promise.resolve();
};
if (navigator.clipboard) {
navigator.clipboard.writeText = record;
} else {
Object.defineProperty(navigator, "clipboard", {
configurable: true,
value: { writeText: record },
});
}
Comment on lines +68 to +72

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Fallback path loses coverage

On CI's non-secure origin, defining a successful navigator.clipboard.writeText forces copyText() down the Clipboard API path. The test therefore no longer exercises the textarea and execCommand('copy') fallback that production uses there. Because no other test covers that fallback, it could regress while this end-to-end test remains green. Capture the copied value without replacing the absent Clipboard API, or add dedicated fallback coverage.

Prompt To Fix With AI
This is a comment left during a code review.
Path: e2e/tests/paste-upload.spec.ts
Line: 68-72

Comment:
**Fallback path loses coverage**

On CI's non-secure origin, defining a successful `navigator.clipboard.writeText` forces `copyText()` down the Clipboard API path. The test therefore no longer exercises the textarea and `execCommand('copy')` fallback that production uses there. Because no other test covers that fallback, it could regress while this end-to-end test remains green. Capture the copied value without replacing the absent Clipboard API, or add dedicated fallback coverage.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Codex

});
await new Shell(page).goto(`/vms/projects/${projectName}`);

await pasteFile(page, {
Expand All @@ -74,7 +89,9 @@ test.describe("Paste to upload", () => {
{ timeout: 30000 },
);

const copied = await page.evaluate(() => navigator.clipboard.readText());
const copied = await page.evaluate(
() => (window as unknown as { __lastCopy?: string }).__lastCopy ?? "",
);
expect(copied).toMatch(/\/vms\/review\/[^?]+\?token=\w+$/);

// The link is public, so it opens without a session.
Expand Down
Loading