36ade35240
E2E and integration tests are rare and pin boundary contracts; unit tests assume those contracts and test between them (user, 2026-09-20). The browser half has four boundaries — RenderModel→DOM, JS→wasm, page→peer, worker→OPFS — and everything between them needed no browser at all. `web/shell.js` and `web/serial.js` are the seams: pure modules that RETURN A DESCRIPTION rather than take a DOM double. `gridPlan(model)` answers every question `gridTable` used to answer while creating elements — the data-row index across group headers, what a group header spans, a null group label against an empty one, an empty edit buffer against no editor — and `app.js` is now a loop that builds elements from it. Painting stays untested by Node; what to paint stopped being untestable. 26 tests in `node --test web/tests` (0.12s, no Rust toolchain, no wasm bundle, no npm install), plus three in `web/tests/bundle/` that read the generated .d.ts and so run in the browser job. Playwright goes from 29 tests/36.9s to 16/15.5s on one machine: `widgets.spec.js` and `pointer.spec.js` are gone, replaced by `contract.spec.js`, which asserts that EVERY field the render model projects reaches the screen. The four widgets those specs were written for were one failure at one boundary, and one assertion catches the fifth. It caught it: `doc_name`/`doc_dirty`/`doc_stored_as` reach no element (improvise-5jna, already open). They are named in `UNPAINTED` with the ticket, so the list is the debt written down rather than an exemption. Thirteen faults injected into the Node suite and eight into the served page, each watched to fail the test it names; the last of those was strengthened because the first version passed. `web/assemble.sh` grew an import-completeness guard whose own first version was blind to the multi-line import it exists for. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
45 lines
1.5 KiB
JavaScript
45 lines
1.5 KiB
JavaScript
import { defineConfig, devices } from "@playwright/test";
|
|
|
|
// The one place a line of web/*.js is executed, and where a change to either
|
|
// file belongs. Why, and why Playwright: context/code/clients.md.
|
|
// `reuseExistingServer` will happily adopt a server another checkout started on
|
|
// this port, and then you test THAT tree. See context/code/clients.md.
|
|
const PORT = process.env.IMPROVISE_HARNESS_PORT ?? "8099";
|
|
|
|
export default defineConfig({
|
|
testDir: "./tests",
|
|
fullyParallel: false,
|
|
workers: 1,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: 0,
|
|
reporter: process.env.CI ? [["github"], ["list"]] : "list",
|
|
timeout: 60_000,
|
|
use: {
|
|
baseURL: `http://127.0.0.1:${PORT}`,
|
|
trace: "retain-on-failure",
|
|
},
|
|
// Chromium + Firefox run the OPFS battery; WebKit has no OPFS at all and is
|
|
// kept for the day it does. Every other spec is Chromium-only: clients.md.
|
|
projects: [
|
|
{ name: "chromium", use: { ...devices["Desktop Chrome"] } },
|
|
{
|
|
name: "firefox",
|
|
use: { ...devices["Desktop Firefox"] },
|
|
testMatch: /opfs\.spec\.js/,
|
|
},
|
|
{
|
|
name: "webkit",
|
|
use: { ...devices["Desktop Safari"] },
|
|
testMatch: /opfs\.spec\.js/,
|
|
},
|
|
],
|
|
webServer: {
|
|
command: `python3 -m http.server ${PORT} --bind 127.0.0.1 --directory serve`,
|
|
// The APP, not the site root — since improvise-kh8 the root is the landing
|
|
// page, which would answer 200 with no bundle assembled at all.
|
|
url: `http://127.0.0.1:${PORT}/app/index.html`,
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 30_000,
|
|
},
|
|
});
|