* chore: add CLAUDE.md * chore: pr feedback * chore: contributing guideline rules * chore: pr feedback (cherry picked from commit fc30140e6ec313c94405e7ca4fbab8096dc1c6c7)
1.9 KiB
1.9 KiB
e2e/AGENTS.md
End-to-end tests against a real Immich stack from docker-compose.yml (server on port 2285): API specs with vitest, browser specs with Playwright.
Rules
test-assets/is a git submodule; initialize it before running exif or upload specs.- Use the shared helpers in
src/utils.ts(utils.adminSetup,utils.userSetup,utils.resetDatabase,utils.createAsset,utils.waitForQueueFinish,asBearerAuth,asKeyAuth,immichCli) instead of re-implementing login or fixtures.
Skills
- Run API specs:
src/specs/server/**/*.e2e-spec.ts, run withmise //e2e:test(it builds the SDK, CLI and Docker images first). If nothing answers at127.0.0.1:2285, the vitestglobalSetupstarts the Docker stack itself; setVITEST_DISABLE_DOCKER_SETUP=trueto reuse a running one. One file:pnpm exec vitest --run src/specs/server/api/album.e2e-spec.ts. Maintenance-mode specs usepnpm exec vitest --run --config vitest.maintenance.config.ts. - Run browser specs: Playwright projects are
web(src/specs/web/, real backend),maintenance(src/specs/maintenance/web/), andui(src/ui/specs/, mocked network fromsrc/ui/mock-network/).mise //e2e:test-webruns all projects and installs browsers first. One project or file:pnpm exec playwright test --project=web src/specs/web/album.e2e-spec.ts; add--uifor the Playwright UI. SetPLAYWRIGHT_DISABLE_WEBSERVER=1to reuse a running stack. - Write an API spec: in
beforeAllcallawait utils.resetDatabase()andadmin = await utils.adminSetup(), create users withutils.userSetup(admin.accessToken, dto), and call the server through@immich/sdkfunctions withasBearerAuth(token)or throughsupertestonappfor raw status-code and validation checks. After uploads,await utils.waitForQueueFinish(admin.accessToken, 'thumbnailGeneration')before asserting on derived data.