Skip to content

Commit e7b10a5

Browse files
committed
test: regression + docs for three-rain and p5-rain
- tests/README.md: commands, layout, matrix-full vs matrix-experimental-renderers - tests/regression/matrix-experimental-renderers.spec.js: four URLs (preset + explicit renderer) - matrix-full.spec.js: exclude mathcode_alphabet_three and mathcode_p5 from WebGL Cartesian product - matrix-playwright-helpers: rainSurfaceCanvas (first visible canvas); assertMatrixBootsClean uses it - Smoke specs: matrix-three-rain, matrix-p5-rain use shared helpers; Prettier on tests/*.spec.js - Docs: CONTRIBUTING, README, DEV_README, DEPENDENCY_POLICY, TESTING_SUMMARY, migration_repl, playwright.regression.config, Copilot/agent instructions Made-with: Cursor
1 parent f61ee37 commit e7b10a5

19 files changed

Lines changed: 423 additions & 227 deletions

.copilot/instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ When adding features that span multiple windows/displays:
342342
These complement `.github/copilot-instructions.md` (treat that file as the detailed source of truth).
343343
344344
- **Renderers**: `js/webgl/` (GLSL + regl **temporarily**, vendored `lib/regl.min.js`) and `js/webgpu/` (WGSL). Experimental: `renderer=three` (`js/three-rain/`), `renderer=p5` (`js/p5-rain/`). URL `renderer=regl` is a legacy alias for WebGL. Holoplay / Looking Glass is **WebGL-only** — see [RENDERING.md](../RENDERING.md), [RENDERING_PIPELINE.md](../RENDERING_PIPELINE.md), [HOLOPLAY.md](../HOLOPLAY.md), and [DEPENDENCY_POLICY.md](../DEPENDENCY_POLICY.md).
345-
- **Tests**: `npm test` runs Node tests + Playwright smoke tests; `npm run test:regression` is the full mode×effect matrix (slow). Failures on `[Matrix][WebGL]` console lines are intentional.
345+
- **Tests**: `npm test` runs Node tests + Playwright smoke tests (`tests/README.md`). `npm run test:regression` runs `tests/regression/`: **`matrix-full.spec.js`** (WebGL mode×effect; skips `mathcode_alphabet_three` / `mathcode_p5`) and **`matrix-experimental-renderers.spec.js`** (**three-rain**, **p5-rain**). Slow. Failures on `[Matrix][WebGL]` console lines are intentional.
346346
- **PWA cache names**: Not just `matrix-v{version}` — the service worker uses `matrix-sw-{scope}-v{VERSION}-{VER}`; `js/main.js` prints the matching string for debugging.
347347
- **GLSL**: Shared uniforms must match precision across vertex/fragment stages on some GPUs (`uniform mediump float` where shared). Shader sources are loaded as static strings after fetch (avoid undefined `shaderSource`).
348348
- **GitHub Pages**: Main-site deploy must **sync to `origin/gh-pages`** before rewriting root so `pr-*` previews are not wiped; see [GITHUB_PAGES.md](../.github/GITHUB_PAGES.md).

.github/agents/matrix-rain-operator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ cd ../..
150150

151151
#### Testing and Validation
152152

153-
- **`npm test`**: Node unit tests (`tests/*.test.mjs`) + Playwright smoke tests (`tests/*.spec.js`). Regression matrix: `npm run test:regression`.
153+
- **`npm test`**: Node unit tests (`tests/*.test.mjs`) + Playwright smoke tests (`tests/*.spec.js`). **`npm run test:regression`**: `tests/regression/` — WebGL mode×effect (`matrix-full.spec.js`) + experimental **three** / **p5** renderers (`matrix-experimental-renderers.spec.js`). See `tests/README.md`.
154154
- Console hooks in `tests/matrix-playwright-helpers.js` fail CI on `[Matrix][WebGL]` and invalid program errors.
155155

156156
**Essential test URLs** (always append `&suppressWarnings=true`):

.github/copilot-agents/matrix-rain-operator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ cd ../..
150150

151151
#### Testing and Validation
152152

153-
- **`npm test`**: Node unit tests (`tests/*.test.mjs`) + Playwright smoke tests (`tests/*.spec.js`). Regression matrix: `npm run test:regression`.
153+
- **`npm test`**: Node unit tests (`tests/*.test.mjs`) + Playwright smoke tests (`tests/*.spec.js`). **`npm run test:regression`**: `tests/regression/` — WebGL mode×effect (`matrix-full.spec.js`) + experimental **three** / **p5** renderers (`matrix-experimental-renderers.spec.js`). See `tests/README.md`.
154154
- Console hooks in `tests/matrix-playwright-helpers.js` fail CI on `[Matrix][WebGL]` and invalid program errors.
155155

156156
**Essential test URLs** (always append `&suppressWarnings=true`):

.github/copilot-instructions.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ cp msdfgen/build/msdfgen out/
138138
- **Install**: `npm ci` (runs `postinstall``scripts/vendor-webgl-deps.mjs` to refresh `lib/regl.min.js`).
139139
- **Default suite**: `npm test` → Node unit tests (`tests/*.test.mjs`) + Playwright smoke tests (`tests/*.spec.js`, **not** `tests/regression/**`).
140140
- **Helpers**: `tests/matrix-playwright-helpers.js` attaches console/page listeners so **`[Matrix][WebGL]`** lines and invalid-program errors fail CI.
141-
- **Full matrix** (optional, slow): `npm run test:regression` uses `playwright.regression.config.js` and `tests/regression/`every `getAvailableModes()` × `getAvailableEffects()` on WebGL.
141+
- **Full regression** (optional, slow): `npm run test:regression` uses `playwright.regression.config.js` and `tests/regression/`WebGL **mode×effect** matrix (`matrix-full.spec.js`, experimental renderer presets excluded) plus **three-rain / p5-rain** (`matrix-experimental-renderers.spec.js`). See `tests/README.md`.
142142

143143
**CRITICAL**: After shader or renderer changes, run at least `npm test` before merging.
144144

@@ -323,15 +323,15 @@ gallery/ # Screenshot storage directory
323323

324324
```javascript
325325
galleryManager.on("itemChange", ({ item, index }) => {
326-
// Fired when switching to new shader
326+
// Fired when switching to new shader
327327
});
328328

329329
galleryManager.on("screenshotCapture", ({ item, duration }) => {
330-
// Fired when capturing screenshot for missing image
330+
// Fired when capturing screenshot for missing image
331331
});
332332

333333
galleryManager.on("playlistComplete", () => {
334-
// Fired when playlist finishes, triggers new playlist generation
334+
// Fired when playlist finishes, triggers new playlist generation
335335
});
336336
```
337337

@@ -447,16 +447,16 @@ The Matrix Mode panel in the top-right corner provides user controls for customi
447447

448448
```javascript
449449
modeDisplay.on("versionChange", (version) => {
450-
/* handle version change */
450+
/* handle version change */
451451
});
452452
modeDisplay.on("effectChange", (effect) => {
453-
/* handle effect change */
453+
/* handle effect change */
454454
});
455455
modeDisplay.on("toggleScreensaver", (enabled) => {
456-
/* handle screensaver toggle */
456+
/* handle screensaver toggle */
457457
});
458458
modeDisplay.on("changeSwitchInterval", (interval) => {
459-
/* handle interval change */
459+
/* handle interval change */
460460
});
461461
```
462462

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ npm test
6464
3. **Make your changes** with clear, focused commits
6565
4. **Test thoroughly** across different Matrix versions and browsers
6666
5. **Format your code** (match CI): `npx prettier --write --use-tabs --print-width 160 "index.html" "./js/**/*.js" "./lib/gpu-buffer.js" "./scripts/**/*.mjs" "./tests/**/*.js"`
67-
6. **Run tests**: `npm test` (and `npm run test:regression` if you change shaders or renderers)
67+
6. **Run tests**: `npm test` (and `npm run test:regression` if you change shaders or renderers). See **[tests/README.md](tests/README.md)** for suite layout; regression includes **`matrix-experimental-renderers.spec.js`** for **`three-rain`** / **`p5-rain`** in addition to the WebGL mode×effect matrix.
6868
7. **Submit a pull request** with a clear description
6969

7070
## 📋 Code Style Guidelines

DEPENDENCY_POLICY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ This repository ships as **static files** (no app bundler). Anything we add must
4242

4343
## Reviews
4444

45-
When upgrading or adding dependencies, update `**SECURITY.md`** supply-chain table and run `**npm test**` (and `**npm run test:regression**` for renderer/shader changes).
45+
When upgrading or adding dependencies, update `**SECURITY.md`** supply-chain table and run `**npm test**` (and `**npm run test:regression**` for renderer/shader changes — see `**tests/README.md**`).

DEV_README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ The brilliance? **Sawtooth waves** create natural-looking randomness while ensur
4646
// Converting human-intuitive colors to machine-readable values
4747
// Like translating between the Matrix's perception layer and reality
4848
const f = (n) => {
49-
const k = (n + hue * 12) % 12;
50-
return lightness - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));
49+
const k = (n + hue * 12) % 12;
50+
return lightness - a * Math.max(-1, Math.min(k - 3, 9 - k, 1));
5151
};
5252
```
5353

@@ -149,8 +149,9 @@ npx prettier --write --use-tabs --print-width 160 "index.html" "./js/**/*.js" ".
149149
npx playwright install # once per machine
150150
npm test
151151

152-
# Optional: full WebGL mode × effect regression (slow)
152+
# Optional: full regression (slow): WebGL mode×effect matrix + three-rain / p5-rain
153153
npm run test:regression
154+
# See tests/README.md for what each suite covers.
154155

155156
# Performance testing with URL parameters
156157
localhost:8000/?fps=30&resolution=0.5&effect=none

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,4 @@ The glyphs are formatted as a multi-channel distance field (or MSDF) via Victor
222222

223223
The raindrops themselves are particles [computed on the GPU and stored in textures](https://threejs.org/examples/webgl_gpgpu_water.html), much smaller than the final render. The data sent from the CPU to the GPU every frame is negligible.
224224

225-
**Contributing / tests:** Install with `npm ci`, run `npm test` (Playwright + unit tests). Full WebGL mode×effect coverage is `npm run test:regression`. See [CONTRIBUTING.md](CONTRIBUTING.md), [DEV_README.md](DEV_README.md), and [RENDERING.md](RENDERING.md).
225+
**Contributing / tests:** Install with `npm ci`, run `npm test` (Playwright + unit tests). **`npm run test:regression`** runs the WebGL **mode×effect** matrix plus **experimental renderer** checks (**`three-rain`**, **`p5-rain`**). See [tests/README.md](tests/README.md), [CONTRIBUTING.md](CONTRIBUTING.md), [DEV_README.md](DEV_README.md), and [RENDERING.md](RENDERING.md).

TESTING_SUMMARY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Multi-Monitor Fullscreen - Testing Summary
22

3+
> **Automated Playwright layout** (default smoke vs regression, `three-rain` / `p5-rain`): see **[tests/README.md](tests/README.md)**.
4+
5+
36
## Test Date
47
December 16, 2024
58

migration_repl.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ Every stage that calls `regl({...})` must be rewritten.
155155
| `package.json` | Remove `regl` dependency |
156156
| `scripts/vendor-webgl-deps.mjs` | Stop copying regl to `lib/` |
157157
| `service-worker.js` | Remove `lib/regl.min.js` from `STATIC_ASSETS` when file deleted |
158-
| `tests/regression/matrix-full.spec.js` | Still valid; must pass after migration |
158+
| `tests/regression/matrix-full.spec.js` | Still valid; must pass after migration (WebGL-only matrix; skips experimental renderer presets). |
159+
| `tests/regression/matrix-experimental-renderers.spec.js` | **three-rain** / **p5-rain** URLs; must pass if those paths change. |
159160
| `README.md` / `RENDERING.md` / `.github/copilot-instructions.md` | Update wording from “regl” to new stack |
160161

161162
**Optional:** `js/webgl/lkgHelper.js` — may stay JS-only; verify it does not assume regl types.

0 commit comments

Comments
 (0)