OpenAny Testing
Pre-flight (before ANY work on this project)
- UI changes: load
design-taste-frontend skill first. The LILA RULE applies — no purple/blue AI gradients, no decorative glassmorphism, no BorderBeam/particles on a tool-grade app. Tool-grade aesthetic: zinc-neutral palette, single accent, MOTION_INTENSITY 3-4, VISUAL_DENSITY 5-6. If you catch yourself writing indigo-500 or cyan-400 or from-#818cf8 to-#06b6d4, stop and re-read the design skill.
- Design Read required: before any UI work, declare a one-line "Design Read" per
design-taste-frontend Section 0.B. For this project: "Reading this as: desktop file viewer tool for developers, VS Code / Linear tool-grade aesthetic, Tailwind + restrained motion." Any component that doesn't fit this read is wrong.
- New features: research existing solutions before implementing (user's core principle —
research-first-development).
- File handling: check
references/react-pdf-blobs.md — Web Workers can't access blob URLs from the main thread.
Two testing strategies
A. Playwright E2E (CI / local CLI)
cd ~/projects/open-any
# Start dev server (Hermes terminal can't background npm run dev — use subprocess)
python3 -c "
import subprocess, time
p = subprocess.Popen(['npm','run','dev'], stdout=subprocess.DEVNULL)
time.sleep(3)
print('Server ready')
"
# Run E2E — MUST use env var to point to existing Chromium
PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=$HOME/.cache/ms-playwright/chromium-1217/chrome-linux64/chrome \
npx playwright test --reporter=list
B. Agent browser tools (zero install, real-time debug)
Use Hermes' built-in browser_navigate, browser_console, browser_snapshot:
// browser_console expression to drop a file programmatically
(async () => {
const resp = await fetch('/test-package.json');
const blob = await resp.blob();
const file = new File([blob], 'test.json', { type: 'application/json' });
const dt = new DataTransfer(); dt.items.add(file);
const dropDiv = document.querySelector('[class*=\"border\"]') as HTMLElement;
if (!dropDiv) throw new Error('No drop zone');
const dragover = new DragEvent('dragover', { bubbles: true, cancelable: true });
Object.defineProperty(dragover, 'dataTransfer', { value: dt });
dropDiv.dispatchEvent(dragover);
const drop = new DragEvent('drop', { bubbles: true, cancelable: true });
Object.defineProperty(drop, 'dataTransfer', { value: dt });
dropDiv.dispatchEvent(drop);
await new Promise(r => setTimeout(r, 2000));
return document.body.innerText.includes('test.json') ? 'OK' : 'FAIL';
})()
Architecture
- Unit tests: 218 vitest tests (formatDetect, registry, store, handlers)
- E2E tests: 14 Playwright tests in
e2e/handlers.spec.ts
- Drops test files via programmatic DragEvent (fetch → Blob → File → DataTransfer → dispatchEvent)
- Test files in
public/test-* and test-files/
- Uses existing Chromium 1217 binary (Hermes browser backend)
CI
Two jobs: check (lint → test → build) → e2e (Playwright)
Pitfalls
- Dev server (WSL):
npm run dev now runs vite --host 0.0.0.0. Without --host, the Windows browser cannot reach the WSL2 dev server — localhost on Windows does not point to WSL2. Use the Network URL shown by Vite (e.g. http://172.x.x.x:5173/).
- Dev server (Hermes): Hermes
terminal(background=true) silently kills npm run dev. Use execute_code with subprocess.Popen instead.
- Playwright version mismatch:
@playwright/test 1.61.0 expects chromium_headless_shell-1228, but the system has chromium-1217. Use PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH env var to point to the existing binary. In CI (GitHub Actions), the npx playwright install --with-deps chromium step handles this automatically.
- Playwright webServer config: Setting
webServer in playwright.config.ts causes timeouts in Hermes' environment. Use local-only mode with the env var and let CI handle its own server start.
- Test file refresh: Copy from
test-files/ to public/ when adding new test data.
- npm install proxy: In WSL (China), npm needs
HTTP_PROXY=http://127.0.0.1:7890. If Clash is not running, npm registry connections time out. npm install succeeds locally but silently skips some packages.
Test file refresh
If test files need updating, copy from test-files to public:
cp test-files/02-data/package.json public/test-package.json
cp test-files/06-pdf/icml2026-paper.pdf public/test-paper.pdf
# ...etc
1---2name: openany-test3description: Run OpenAny unit tests + Playwright E2E tests — both handlers and browser rendering4---56# OpenAny Testing78## Pre-flight (before ANY work on this project)9101. **UI changes**: load `design-taste-frontend` skill first. The LILA RULE applies — no purple/blue AI gradients, no decorative glassmorphism, no BorderBeam/particles on a tool-grade app. Tool-grade aesthetic: zinc-neutral palette, single accent, MOTION_INTENSITY 3-4, VISUAL_DENSITY 5-6. If you catch yourself writing `indigo-500` or `cyan-400` or `from-#818cf8 to-#06b6d4`, stop and re-read the design skill.112. **Design Read required**: before any UI work, declare a one-line "Design Read" per `design-taste-frontend` Section 0.B. For this project: "Reading this as: desktop file viewer tool for developers, VS Code / Linear tool-grade aesthetic, Tailwind + restrained motion." Any component that doesn't fit this read is wrong.123. **New features**: research existing solutions before implementing (user's core principle — `research-first-development`).134. **File handling**: check `references/react-pdf-blobs.md` — Web Workers can't access blob URLs from the main thread.1415## Two testing strategies1617### A. Playwright E2E (CI / local CLI)18```bash19cd ~/projects/open-any2021# Start dev server (Hermes terminal can't background npm run dev — use subprocess)22python3 -c "23import subprocess, time24p = subprocess.Popen(['npm','run','dev'], stdout=subprocess.DEVNULL)25time.sleep(3)26print('Server ready')27"2829# Run E2E — MUST use env var to point to existing Chromium30PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=$HOME/.cache/ms-playwright/chromium-1217/chrome-linux64/chrome \31npx playwright test --reporter=list32```3334### B. Agent browser tools (zero install, real-time debug)35Use Hermes' built-in `browser_navigate`, `browser_console`, `browser_snapshot`:36```js37// browser_console expression to drop a file programmatically38(async () => {39 const resp = await fetch('/test-package.json');40 const blob = await resp.blob();41 const file = new File([blob], 'test.json', { type: 'application/json' });42 const dt = new DataTransfer(); dt.items.add(file);43 const dropDiv = document.querySelector('[class*=\"border\"]') as HTMLElement;44 if (!dropDiv) throw new Error('No drop zone');45 const dragover = new DragEvent('dragover', { bubbles: true, cancelable: true });46 Object.defineProperty(dragover, 'dataTransfer', { value: dt });47 dropDiv.dispatchEvent(dragover);48 const drop = new DragEvent('drop', { bubbles: true, cancelable: true });49 Object.defineProperty(drop, 'dataTransfer', { value: dt });50 dropDiv.dispatchEvent(drop);51 await new Promise(r => setTimeout(r, 2000));52 return document.body.innerText.includes('test.json') ? 'OK' : 'FAIL';53})()54```5556## Architecture5758- **Unit tests**: 218 vitest tests (formatDetect, registry, store, handlers)59- **E2E tests**: 14 Playwright tests in `e2e/handlers.spec.ts`60 - Drops test files via programmatic DragEvent (fetch → Blob → File → DataTransfer → dispatchEvent)61 - Test files in `public/test-*` and `test-files/`62 - Uses existing Chromium 1217 binary (Hermes browser backend)6364## CI6566Two jobs: `check` (lint → test → build) → `e2e` (Playwright)6768## Pitfalls6970- **Dev server (WSL)**: `npm run dev` now runs `vite --host 0.0.0.0`. Without `--host`, the Windows browser cannot reach the WSL2 dev server — `localhost` on Windows does not point to WSL2. Use the Network URL shown by Vite (e.g. `http://172.x.x.x:5173/`).71- **Dev server (Hermes)**: Hermes `terminal(background=true)` silently kills `npm run dev`. Use `execute_code` with `subprocess.Popen` instead.72- **Playwright version mismatch**: `@playwright/test` 1.61.0 expects `chromium_headless_shell-1228`, but the system has `chromium-1217`. Use `PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH` env var to point to the existing binary. In CI (GitHub Actions), the `npx playwright install --with-deps chromium` step handles this automatically.73- **Playwright webServer config**: Setting `webServer` in playwright.config.ts causes timeouts in Hermes' environment. Use local-only mode with the env var and let CI handle its own server start.74- **Test file refresh**: Copy from `test-files/` to `public/` when adding new test data.75- **npm install proxy**: In WSL (China), npm needs `HTTP_PROXY=http://127.0.0.1:7890`. If Clash is not running, npm registry connections time out. `npm install` succeeds locally but silently skips some packages.7677## Test file refresh7879If test files need updating, copy from test-files to public:80```bash81cp test-files/02-data/package.json public/test-package.json82cp test-files/06-pdf/icml2026-paper.pdf public/test-paper.pdf83# ...etc84```