WSL에서 E2E Testing
Vercel의 agent-browser에는 Unix domain socket 비호환성 때문에 daemon 시작에 실패하는 known Windows bug가 있습니다. workaround는 dev server는 Windows에서 실행하고 agent-browser는 WSL 안에서 실행하는 것입니다.
일반 setup: WSL이 아닌 플랫폼(macOS, Linux, Docker)은 대신 E2E Testing 가이드를 참고하세요.
- Ubuntu가 설치된 WSL2(
wsl --list --verbose) - WSL 안에 설치된 agent-browser:
npm install -g agent-browser - 설치된 Playwright chromium:
agent-browser install --with-deps(sudo 필요)
1. WSL에서 접근 가능한 Windows host IP 찾기
Section titled “1. WSL에서 접근 가능한 Windows host IP 찾기”ipconfig | findstr "IPv4" | findstr "WSL"# Example output: IPv4 Address. . . . . . . . . . . : 172.18.64.1또는 WSL 안에서 다음을 실행합니다.
wsl -d Ubuntu -- bash -c "cat /etc/resolv.conf | grep nameserver"이 시스템의 Windows host IP는 172.18.64.1입니다.
2. Windows에서 dev server 시작(모든 interface에 bind)
Section titled “2. Windows에서 dev server 시작(모든 interface에 bind)”# Backend (Hono on port 3090) - already binds to 0.0.0.0 by defaultbun run dev:server &
# Frontend (Vite on port 5173) - needs --host flagcd packages/web && bun x vite --host 0.0.0.0 &3. WSL에서 server에 접근 가능한지 확인
Section titled “3. WSL에서 server에 접근 가능한지 확인”wsl -d Ubuntu -- curl -s http://172.18.64.1:3090/api/healthwsl -d Ubuntu -- curl -s -o /dev/null -w "%{http_code}" http://172.18.64.1:5173agent-browser command 실행
Section titled “agent-browser command 실행”모든 command는 Windows terminal에서 실행하며 앞에 wsl -d Ubuntu --를 붙입니다.
# Open a pagewsl -d Ubuntu -- agent-browser open http://172.18.64.1:5173
# Take interactive snapshot (get element refs like @e1, @e2)wsl -d Ubuntu -- agent-browser snapshot -i
# Click, fill, presswsl -d Ubuntu -- agent-browser click @e1wsl -d Ubuntu -- agent-browser fill @e2 "some text"wsl -d Ubuntu -- agent-browser press Enter
# Wait for content to loadwsl -d Ubuntu -- agent-browser wait 3000
# Reload page (hard refresh)wsl -d Ubuntu -- agent-browser reload
# Close browserwsl -d Ubuntu -- agent-browser closescreenshot 찍기
Section titled “screenshot 찍기”Screenshot은 먼저 WSL-native path에 저장한 뒤, /mnt/c/ mount를 통해 Windows filesystem으로 복사해야 합니다.
# Save to WSL home, then copy to projectwsl -d Ubuntu -- bash -c ' agent-browser screenshot /home/user/screenshot.png 2>&1 && cp /home/user/screenshot.png /path/to/archon/e2e-screenshots/my-test.png'왜 /mnt/c/...에 직접 저장하지 않나요? agent-browser는 Node.js process를 통해 path를 resolve하는데, 일부 setup에서는 /mnt/c/ path가 깨질 수 있습니다(예: C:/Program Files/Git/가 앞에 붙음). WSL-native path에 저장한 뒤 복사하면 이를 피할 수 있습니다.
- WSL2에서
localhost는 동작하지 않습니다 - Windows host IP(172.18.64.1)를 사용해야 합니다. - Vite는
0.0.0.0에 bind해야 합니다 - 기본localhost는 WSL에서 접근할 수 없습니다. - Git Bash path expansion - Git Bash를 거치면
/status가C:/Program Files/Git/status로 확장됩니다. agent-browser 문제가 아니라 shell이/path를 확장하는 문제입니다. - SSE
Connectedindicator -webplatform conversation에서만 표시됩니다. Telegram/Slack conversation은Disconnected로 표시됩니다(예상 동작). - Daemon startup -
agent-browser open이 “Daemon failed to start”로 실패하면 stale daemon을 종료하고 다시 시도합니다:wsl -d Ubuntu -- pkill -f daemon.js