Files
star-map/e2e/README.md
Claude 3a859360ba Add the deep-sky backdrop, the last unbuilt piece of the plan
The design doc scopes deep-sky objects as a galaxy-view backdrop and lists
fetchDeepSky.ts, deepsky.json and deepsky.model.ts, but none of it existed —
it was the only part of the plan with no implementation behind it.

ETL: fetchDeepSky.ts pulls the OpenNGC catalog, classifies each object as a
galaxy/nebula/cluster, and keeps the ~460 worth drawing (everything Messier,
everything with a common name, and anything brighter than magnitude 9) out of
~12,000 mostly-anonymous rows. build.ts runs it and validates the output.

Distances are the hard part: OpenNGC has no distance column, and both fallbacks
fail for the best-known objects. M31, M33 and M42 are Local Group members whose
redshift is negative or absent, and a galaxy's catalog parallax comes from a
cross-matched foreground star — 6 mas for M31 would put a 780 kpc galaxy at
167 pc. So records store a unit direction on the celestial sphere rather than a
position (the line of sight is always known precisely, and the objects are drawn
on a fixed backdrop shell where true distance is unusable anyway), and distance
is optional metadata carrying its own provenance. Parallax is trusted only for
galactic objects, redshift only above z=0.003 where expansion outweighs peculiar
velocity. 330 of 463 get a distance; the rest honestly report none.

Rendering: DeepSkyRenderer paints the objects as soft additive billboards on a
2500 pc shell — clear of the 50 pc star field, beyond the camera's 2000 pc orbit
limit, and inside its 5000 pc far plane. Size comes from real angular extent, so
Andromeda is six times wider than the full Moon, clamped at both ends. Sprites
rather than points because the WebGPU backend caps point primitives at one pixel;
materials are shared per kind and brightness band, so 460 objects cost nine of
them. The brightest dozen get permanent labels, which needed the label overlay to
accept string ids alongside numeric star ids. The backdrop is decorative, so a
failure to load its dataset is logged and the star field comes up regardless.

Also documents the app in the README, which until now covered only the plugin
marketplace.

Tests: 112 passing, up from 54. Build, both typechecks and the Playwright suite
are green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WaySiNst4HhDXBHnMy8p5G
2026-08-03 15:19:39 +00:00

33 lines
1.8 KiB
Markdown

# End-to-end tests (Playwright)
These tests run the real Angular dev server in a real Chromium browser, covering interactions
that unit/component tests (under `src/**/*.spec.ts`, run via `npm test`) can only approximate
under jsdom — most importantly the galaxy↔system **camera-flight transitions** (real WebGPU/
WebGL2 initialization + raycaster picking) and cross-view **search navigation**.
## Running
```bash
npm run e2e # headless run against a freshly started dev server
npx playwright test --ui # interactive UI mode
npx playwright show-report
```
`playwright.config.ts` starts `npm run start -- --port=4300` automatically and waits for it to
respond before running the suite (`webServer.reuseExistingServer` is `true` outside CI, so an
already-running `ng serve` on port 4300 is reused instead of starting a second one). Port 4300
is used instead of the Angular CLI's conventional 4200 to avoid colliding with an unrelated
server a developer might already have running there.
## Notes
- The Sun (`Sol`) is always placed at the coordinate-system origin (`x=0,y=0,z=0`), which is
exactly where the default galaxy-view camera looks. `camera-flight.spec.ts` relies on this to
reliably click-select it by clicking the center of the canvas, without needing pixel-perfect
knowledge of the star field's on-screen layout.
- Data (bootstrap fetch of `stars.bin`/`stars-index.json`/`bodies.json`/`exoplanets.json`/
`deepsky.json`) loads asynchronously after the page loads, so tests poll (re-click/re-check)
rather than assume the scene is interactive immediately after `page.goto()`.
- `deepsky.json` is the one dataset the scene treats as optional: it only feeds the decorative
backdrop, so a failure to load it is logged and the star field comes up regardless.