Run browser tests locally: Playwright 1.64.1 in .venv, scripts switch to it on their own

The browser tests and screenshot tools now work with plain python3 on a machine whose
system Python refuses pip installs: tools/use_venv.py re-runs them with the repo's .venv.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-23 16:50:15 -04:00
co-authored by Claude Opus 5.5
parent 3f971a94c2
commit cab9343b26
13 changed files with 64 additions and 9 deletions
+3 -1
View File
@@ -21,7 +21,8 @@ src/ui/ the browser shell: input, HUD, build menu, notebook, setti
test/ headless suites (t_*.js) and their harness; browser tests (play.py,
t_smooth.py); run_all.py
tools/ shot.py (screenshots), where.py, map.py, perf.py, playthrough.py,
scenes/ (screenshot setups), experiments/ (measurements and reports)
use_venv.py (switches browser scripts to .venv), scenes/ (screenshot
setups), experiments/ (measurements and reports)
docs/ this map, DESIGN.md, TESTING.md, systems/ (notes per system),
history/ (the owner's requests), agent-log.md
dist/, shots/ build output and screenshots (not committed)
@@ -456,6 +457,7 @@ The frame loop and boot.
- `tools/perf.py`: Times the renderer and the simulation in a headless browser: light, drawWorld (with and without light and glow), the pixel upload and blit, and one simulation tick, in ms. Rebuild first.
- `tools/playthrough.py`: Headless browser run: load the page, start a world, play a little, take screenshots.
- `tools/shot.py`: Screenshot the game in a headless browser, after setting up a scene with JavaScript.
- `tools/use_venv.py`: Let browser scripts run with plain python3 by switching to the repo's .venv.
- `tools/where.py`: Turn a line number in dist/index.html into the source file and line it came from.
- `tools/experiments/cast_sunk_mold.js`: Block-sized bit mold sunk into the ground with a stone furnace built over its funnel.
- `tools/experiments/factory_cost.js`: What does a running factory cost when the player is somewhere else? Builds K self-running modules in a generated world, far from the bot, and measures simulation time per tick. Each module: a coal + copper-ore furnace burning in a stone-block box, a spring feeding a water wheel, a shaft carrying its power to a 10-block belt that hauls sand off a hopper.