memlnaut-nisps/playwright.config.js
w1n5t0n 44fc974425 feat(tests): add Playwright e2e suite + debug probe for a-immersive
- Add window.__nisps debug probe (gated on ?debug=1) exposing iml state,
  getOutputs/getLoss/getWeights/getExampleCount, and action triggers
  (thumbsUp/thumbsDown/train/randomise/clearExamples/saveState)
- Fix WasmIML bug: this.dataset was a plain object; import Dataset and
  use new Dataset(100) so computeWeights() is available for training
- Fix WasmIML.addExample/clearDataset to use Dataset API methods
- 44 Playwright e2e tests across 4 spec files:
  - ml-engine.spec.js: WASM inference bounds, training loss, thumbs
    up/down behavior, async training, example capture semantics
  - ui-interactions.spec.js: drawer open/close, mode switching,
    heatmap bar counts, preset chips, keyboard shortcuts (1/2/Z)
  - input-pipeline.spec.js: input→output variation, clamping, joystick
    drag, post-training output bounds across the full input space
  - persistence.spec.js: URL params (?preset, ?spread), localStorage
    round-trip, saveState probe
2026-04-03 16:38:04 +01:00

27 lines
866 B
JavaScript

const { defineConfig } = require('@playwright/test');
module.exports = defineConfig({
testDir: './tests/e2e',
timeout: 30_000,
expect: { timeout: 10_000 },
use: {
baseURL: 'http://localhost:7331',
headless: true,
// WASM + AudioContext require a stable origin
ignoreHTTPSErrors: true,
},
// Start a static file server against the playground/ dir before tests run.
// python3 -m http.server serves directory listings and static assets fine.
// WASM files need correct MIME type — Python's server handles .wasm correctly.
webServer: {
command: 'python3 -m http.server 7331',
cwd: './playground',
url: 'http://localhost:7331',
reuseExistingServer: true,
timeout: 10_000,
},
projects: [
{ name: 'chromium', use: { browserName: 'chromium' } },
],
reporter: [['list'], ['html', { open: 'never' }]],
});