mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
055c3ae5c7
The pictures picked up five faults that the run could not see, because a passing step only proves the click landed. The ring vanished on the lightbox: the accent is nearly black and so is the overlay. It now measures the surface behind it and puts a white hairline outside itself and the number only where the contrast is too low, so every other picture keeps the single line it had. The number fell outside the picture whenever the target was wider than the frame, which is every full-width row: the frame is known before the ring is drawn, so the number moves inside far enough to clear the edge. The satellite imagery was a grey rectangle although every tile came back 200. Leaflet fades a tile in over 200 ms and takes the progress from `+new Date()`, and the browser's clock is pinned to the picture day, so the opacity it writes on every frame is always 0. A stylesheet on Leaflet's own `leaflet-tile-loaded` outranks that inline style. The satellite guide also waits for decoded tiles now instead of for a tile element to exist. The uploaded files looked like nothing anyone would upload. A PDF is drawn with an issuer band, a reference, a table of fields and a footer, and the two photographs are gone: a drawn photograph reads as clip art at any size, so the trip carries a map screenshot with a pin and a booking confirmation in a browser window, which are graphics in reality too. In the panel, a step picture was covered into a 16:10 box and lost its sides; contained everywhere now, the hero and the result in 16:9. Beside that: the place guide gained the drag-and-drop route to a day as its fourth step, in all 23 languages, and `e2e/help/README.md` now holds the whole visual contract, the traps that cost this round (the pinned clock, prettier against the client sources, a killed run holding its ports) and how to find out which pictures a change forces to be retaken.
48 lines
1.9 KiB
JavaScript
48 lines
1.9 KiB
JavaScript
// Boots the TREK backend for the Playwright E2E run against a fresh, isolated
|
|
// SQLite database. The DB file is deleted first so every run starts clean, then
|
|
// the server's own startup seeds a known admin from ADMIN_EMAIL/ADMIN_PASSWORD.
|
|
//
|
|
// The server is built once and launched as a SINGLE node process (not the
|
|
// watch-mode `npm run dev`, which spawns tsc -w + node --watch grandchildren
|
|
// that survive Playwright's teardown and then linger on :3001 with stale DB
|
|
// state). A single child is killed cleanly when Playwright tears the run down.
|
|
import { rmSync } from 'node:fs'
|
|
import { spawn, execSync } from 'node:child_process'
|
|
import path from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
const here = path.dirname(fileURLToPath(import.meta.url))
|
|
// The port is in the name, so two runs on two port pairs keep two databases
|
|
// and can render different guide files at the same time.
|
|
const apiPort = process.env.E2E_API_PORT || '3001'
|
|
const dbFile = path.join(here, '.tmp', `e2e-${apiPort}.db`)
|
|
const serverDir = path.join(here, '..', '..', 'server')
|
|
|
|
for (const f of [dbFile, `${dbFile}-wal`, `${dbFile}-shm`]) {
|
|
try { rmSync(f, { force: true }) } catch {}
|
|
}
|
|
|
|
// Build once (no watcher) — the resulting process is a single killable node.
|
|
execSync('node scripts/build.mjs', { cwd: serverDir, stdio: 'inherit' })
|
|
|
|
const env = {
|
|
...process.env,
|
|
TREK_DB_FILE: dbFile,
|
|
ADMIN_EMAIL: 'e2e@trek.local',
|
|
ADMIN_PASSWORD: 'E2eTest12345!',
|
|
// playwright.config.ts picks the port; 3001 is the historical default.
|
|
PORT: process.env.E2E_API_PORT || '3001',
|
|
NODE_ENV: 'development',
|
|
}
|
|
|
|
const child = spawn(process.execPath, ['--require', 'tsconfig-paths/register', 'dist/index.js'], {
|
|
cwd: serverDir,
|
|
env,
|
|
stdio: 'inherit',
|
|
})
|
|
const stop = () => { try { child.kill() } catch {} }
|
|
process.on('SIGINT', stop)
|
|
process.on('SIGTERM', stop)
|
|
process.on('exit', stop)
|
|
child.on('exit', code => process.exit(code ?? 0))
|