Files
wehub-resource-sync f99010fae1
CI / lint (push) Failing after 1s
CI / frontend (push) Failing after 1s
CI / scripts (push) Failing after 1s
CI / Go Test (ubuntu-latest) (push) Failing after 0s
CI / frontend-node-25 (push) Failing after 1s
CI / docs (push) Failing after 0s
CI / coverage (push) Failing after 0s
CI / e2e (push) Failing after 0s
Docker / build-and-push (push) Failing after 1s
CI / integration (push) Failing after 4m43s
CI / Go Test (windows-latest) (push) Has been cancelled
CI / Desktop Unit Tests (Windows) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Linux (arm64)) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Linux) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Windows) (push) Has been cancelled
Desktop Artifacts (macOS) / Desktop Build (macOS (aarch64)) (push) Has been cancelled
Desktop Artifacts (macOS) / Desktop Build (macOS (x86_64)) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:30:36 +08:00

69 lines
2.4 KiB
Markdown

# Screenshot Pipeline
Generates screenshots for the docs site using Playwright inside Docker.
## Prerequisites
- Docker
- agentsview source at `~/code/agentsview` (override with `AGENTSVIEW_SRC`)
- A sessions database at `~/.agentsview/sessions.db` (override with `SOURCE_DB`)
- The screenshot extractor keeps approved public projects from the newest 60-day
session window (override with `SCREENSHOT_HISTORY_DAYS`)
- Optional local-only screenshot scrub terms via line-separated files. The
extractor redacts the current `HOME` path to `~`. By default it also reads
both `~/.config/agentsview-docs/screenshot-blocked-terms.txt` and the
canonical private terms file at `~/.config/kenn/private-terms.txt` (or
`KENN_PRIVATE_TERMS_FILE`). Override the screenshot-specific path with
`SCREENSHOT_BLOCKED_TERMS_FILE`, or append terms with
`SCREENSHOT_BLOCKED_TERMS`.
## Run all screenshots
```bash
./screenshots/run.sh
```
Output goes to `docs/assets/generated/screenshots/`.
## Run a single screenshot
Pass `--grep` with the test name:
```bash
./screenshots/run.sh --grep "session filters active"
```
Any extra arguments are forwarded to `npx playwright test` inside the container.
## How it works
1. Assembles a Docker build context with the agentsview source, sessions
database, and test files
1. Builds a multi-stage Docker image:
- **Stage 1 (builder):** Compiles the agentsview Go binary with frontend
assets
- **Stage 2 (db):** Extracts a reduced database with screenshot-safe projects
- **Stage 3 (playwright):** Installs Playwright + Chromium + PostgreSQL,
copies binary and DB
1. Runs the container, which:
- Starts PostgreSQL and pushes test data from two simulated machines
- Starts agentsview on port 8090 (SQLite mode, for most screenshots)
- Starts agentsview pg serve on port 8091 (PG mode, for machine label
screenshots)
- Executes the Playwright tests against both servers
1. Screenshots are written to the mounted `/output` volume
(`docs/assets/generated/screenshots/`)
Stages 1 and 2 are cached by Docker, so re-runs after test file changes are
fast.
## Configuration
Viewport: 1440x900, dark mode, `America/Chicago` timezone. See
`playwright.config.ts`.
## Test file
All tests live in `tests/screenshots.spec.ts`. Each test navigates to a UI state
and calls `snap(page, 'name')` or `snapEl(locator, 'name')` to capture a PNG.