Files
ImageApi/dev/e2e/README.md
T
Cameron CordesandClaude Opus 5.5 f00a309a24 dev/e2e: disposable server for app e2e / agent UI testing
`dev/e2e/e2e.sh up` runs an isolated ImageApi (port 8090, own build dir,
db, thumbnails, HLS) next to a real local server, serving a copy of a
synthetic fixture library. Every fixture image has its path, date and
scenario burned into the pixels; manifest.json records expected dates,
GPS, cameras, tags and counts. `reset` restores the baseline.

- LOCAL_BIND_URL makes the hardcoded localhost:8088 listener
  configurable (default unchanged; empty disables it) so a second
  instance can start.
- create_user bin: the server has no registration route; idempotent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 13:02:49 -04:00

79 lines
3.2 KiB
Markdown

# e2e dev server
A disposable ImageApi instance with a known, synthetic media library, for
end-to-end and agent-driven UI testing of the SynologyFileViewer app.
```bash
dev/e2e/e2e.sh up # build + fixtures + reset + start; blocks until ingest is done
dev/e2e/e2e.sh reset # back to the pristine baseline (after tests mutate things)
dev/e2e/e2e.sh stop
```
Log in from the app with **server** `http://10.0.2.2:8090` (Android
emulator) or `http://127.0.0.1:8090` (Expo web / `adb reverse tcp:8090 tcp:8090`),
**user** `e2e`, **password** `E2eTest#2026pass`.
## Isolation
It runs next to a real local server without touching it:
| | real server | e2e server |
|---|---|---|
| exe | `target/debug/image-api.exe` | `dev/e2e/.work/bin/image-api-e2e.exe` (built in `target/e2e`) |
| port | `BIND_URL` + `localhost:8088` | `127.0.0.1:8090` only (`LOCAL_BIND_URL=` disables the 8088 bind) |
| data | your `.env` | `dev/e2e/.work/state/` (db, thumbs, hls, gifs, previews, media) |
| AI | configured | off — Ollama points at a closed port |
`stop` kills by image name `image-api-e2e.exe`, so it can't hit the real
server. Everything under `.work/` is gitignored and safe to delete.
## Fixtures
`gen_fixtures.py` renders every image with its relative path, date and
scenario burned into the pixels — a screenshot tells you exactly which
fixture is on screen. `.work/state/manifest.json` lists every item with its
expected date, GPS, camera, tags and duplicate relationship, plus expected
counts; assert against it rather than hardcoding.
| Folder | Covers |
|---|---|
| `2019/2019-07-04 Beach Day`, `2021/Paris Trip`, `2022/Hiking` | EXIF dates, GPS (map), cameras, tags, mixed orientation |
| `2022/Hiking/summit.mp4`, `Videos/` | landscape + portrait video, HLS, container dates |
| `2023/Birthday` | dated, no GPS |
| `Grid Stress` (60) | scrolling / pagination |
| `Screenshots` | date from filename only (`filename` source), PNG |
| `Undated` | no date anywhere → pinned mtime (`fs_time` source) |
| `On This Day` | memories: today's month/day in 2018/2020/2024 |
| `private` | `EXCLUDED_DIRS` — never indexed |
| `Duplicates` | byte-identical copy of `2021/Paris Trip/IMG_1000.jpg` |
| `Empty Album` | folder with no media |
"On This Day" is relative to the generation date — run
`e2e.sh fixtures --force && e2e.sh reset` on a later day to keep memories
populated. Tags from the manifest are seeded through the API on first start.
To test against real photos, `e2e.sh fixtures --import /path/to/folder`
copies a folder into `media/imported/` (the source is only read).
## Extra configuration
Put server env overrides in `dev/e2e/env.local` (gitignored); it's appended
to the generated `.env` on every `reset`. E.g. to exercise AI insights
against the local llama-swap:
```
LLM_BACKEND=llamacpp
LLAMA_SWAP_URL=http://localhost:9292/v1
```
Env for the script itself: `E2E_PORT`, `E2E_BIND` (`0.0.0.0` for a physical
device on Wi-Fi), `E2E_USER`, `E2E_PASS`.
## Notes for agents
- WSL2 (NAT networking) can't reach Windows' `127.0.0.1`; use `curl.exe`,
or `e2e.sh api GET 'photos?path=&recursive=true'` / `e2e.sh token`.
- Sort values are lowercase: `sort=datetakendesc`.
- Rebuild after server changes with `e2e.sh build` (restarts if running).
- Server log: `.work/server.log`.