mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-20 13:51:45 +00:00
fc7d8b5d12
Brownfield strangler migration of the backend onto NestJS modules (auth, trips, days, places, assignments, packing, todo, budget, reservations, collab, files, photos, journey, share, settings, backup, oidc, oauth, admin, atlas, vacay, weather, airports, maps, categories, tags, notifications, system-notices) served through a per-prefix dispatcher, keeping the existing SQLite/better-sqlite3 DB and JWT httpOnly cookie auth, with behavioural parity for every route. Client: React 19 upgrade, "page = wiring container + data hook" pattern across all pages, per-domain Zustand stores bound to @trek/shared contracts, and decomposition of the large components (DayPlanSidebar, PackingListPanel, CollabNotes, FileManager, MemoriesPanel, PlacesSidebar, CollabChat, SystemNoticeModal, BudgetPanel, PlaceFormModal, ...) into focused render units backed by in-file hooks. Apply the shared global request pipeline (helmet/CSP, CORS, HSTS, forced HTTPS, the global MFA policy and request logging) to the NestJS instance as well, so a migrated route is protected identically to the legacy fallback rather than bypassing it.
58 lines
1.8 KiB
TypeScript
58 lines
1.8 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test'
|
|
|
|
/**
|
|
* E2E harness for TREK's critical user flows (FE7).
|
|
*
|
|
* Two web servers are orchestrated: the Express/Nest backend on :3001 against an
|
|
* isolated throwaway SQLite DB (e2e/server-launch.mjs sets TREK_DB_FILE + seeds a
|
|
* known admin), and the Vite dev server on :5173 which proxies /api, /uploads,
|
|
* /ws to the backend. Tests run serially against one worker so they share the
|
|
* single seeded database deterministically.
|
|
*/
|
|
export default defineConfig({
|
|
testDir: './e2e',
|
|
fullyParallel: false,
|
|
workers: 1,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 1 : 0,
|
|
timeout: 45_000,
|
|
expect: { timeout: 15_000 },
|
|
reporter: [['list']],
|
|
use: {
|
|
baseURL: 'http://localhost:5173',
|
|
trace: 'on-first-retry',
|
|
screenshot: 'only-on-failure',
|
|
},
|
|
projects: [
|
|
// Unauthenticated flows (login, register, public share) — no stored session.
|
|
{ name: 'public', testMatch: /\.public\.spec\.ts/, use: { ...devices['Desktop Chrome'] } },
|
|
// One-time login that persists a session for the authenticated flows.
|
|
{ name: 'setup', testMatch: /auth\.setup\.ts/ },
|
|
{
|
|
name: 'app',
|
|
testMatch: /\.spec\.ts/,
|
|
testIgnore: /(\.public\.spec\.ts|auth\.setup\.ts)/,
|
|
use: { ...devices['Desktop Chrome'], storageState: 'e2e/.tmp/state.json' },
|
|
dependencies: ['setup'],
|
|
},
|
|
],
|
|
webServer: [
|
|
{
|
|
// Always start our own backend (never reuse) so the isolated test DB is
|
|
// reset + reseeded on every run, regardless of any stray dev server.
|
|
command: 'node e2e/server-launch.mjs',
|
|
port: 3001,
|
|
reuseExistingServer: false,
|
|
timeout: 180_000,
|
|
stdout: 'pipe',
|
|
stderr: 'pipe',
|
|
},
|
|
{
|
|
command: 'npm run dev',
|
|
port: 5173,
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 120_000,
|
|
},
|
|
],
|
|
})
|