From fab1c4bb5888869bbb0c7fcdc4a0570a9dde20ec Mon Sep 17 00:00:00 2001 From: Alex Kern Date: Tue, 15 Jul 2025 22:55:19 -0700 Subject: [PATCH] Add e2e test for file transfers --- .claude/settings.local.json | 10 + package.json | 2 +- playwright.config.ts | 6 +- src/components/CopyableInput.tsx | 1 + src/components/DownloadButton.tsx | 1 + src/components/DropZone.tsx | 1 + src/components/ProgressBar.tsx | 5 +- src/components/StartButton.tsx | 1 + src/hooks/useDownloader.ts | 27 ++- src/hooks/useUploaderConnections.ts | 47 +++- src/messages.ts | 9 + src/types.ts | 1 + test-results/.last-run.json | 6 + tests/e2e/file-transfer.test.ts | 92 +++++++ tests/e2e/helpers.ts | 361 ++++++++++++++++++++++++++++ 15 files changed, 562 insertions(+), 8 deletions(-) create mode 100644 .claude/settings.local.json create mode 100644 test-results/.last-run.json create mode 100644 tests/e2e/file-transfer.test.ts create mode 100644 tests/e2e/helpers.ts diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..6b71b59 --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,10 @@ +{ + "permissions": { + "allow": [ + "Bash(pnpm build:*)", + "Bash(pnpm test:*)", + "Bash(npm test:*)" + ], + "deny": [] + } +} \ No newline at end of file diff --git a/package.json b/package.json index 0cfe084..7643a18 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "scripts": { "dev": "next", "dev:full": "docker compose up redis coturn -d && COTURN_ENABLED=true REDIS_URL=redis://localhost:6379 next", - "build": "next build", + "build": "next build && cp -r public .next/standalone/ && cp -r .next/static .next/standalone/.next/", "start": "next start", "start:peerjs": "./bin/peerjs.js", "lint:check": "eslint 'src/**/*.ts[x]'", diff --git a/playwright.config.ts b/playwright.config.ts index 4338e61..cc72eb1 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -2,10 +2,14 @@ import { defineConfig } from '@playwright/test' export default defineConfig({ testDir: './tests/e2e', + workers: 1, // Run tests serially to avoid WebRTC port conflicts webServer: { command: 'node .next/standalone/server.js', - port: 3000, + url: 'http://localhost:3000', timeout: 120 * 1000, reuseExistingServer: true, }, + use: { + baseURL: 'http://localhost:3000', + }, }) diff --git a/src/components/CopyableInput.tsx b/src/components/CopyableInput.tsx index 9df1884..3e61682 100644 --- a/src/components/CopyableInput.tsx +++ b/src/components/CopyableInput.tsx @@ -16,6 +16,7 @@ export function CopyableInput({ {label}
diff --git a/src/components/DropZone.tsx b/src/components/DropZone.tsx index 7f84b2d..0bf4042 100644 --- a/src/components/DropZone.tsx +++ b/src/components/DropZone.tsx @@ -97,6 +97,7 @@ export default function DropZone({ multiple />