Timeline metric browser regressions
Character detail live-update regressions: run npm run test:characters. This executes the production script with mocked DOM, SignalR, and timers using Node only. It covers historical completion replay, a single refresh for new completion, reconnects, completion during initial connection, stale/other-character events, failed analysis, and manual reanalysis.
Run from this directory:
npm ci
npx playwright install chromium
npm test
Set CHROMIUM_PATH to use an existing Chromium executable. The tests load the production metric-chart initializer, repository CSS, and the same Chart.js version referenced by _Layout.cshtml. They use isolated DOM fixtures; no database, login, or running application is required. Keep the pinned Chart.js dependency in step with the layout's CDN version.
Coverage includes all four timeline views and three densities, one and three books, headers consuming different horizontal widths, unequal scene widths, timelines exceeding 30,000 CSS pixels, start/middle/end scrolling, viewport resizing, section collapse/expand, and device pixel ratios 1 and 2. Assertions compare every scene centre with its chart coordinate, and visible rendered point positions, with a tolerance below half a CSS pixel. Tooltips, metric toggles, point navigation, and drag-save scene identity are exercised; saves are mocked.
The chart derives coordinates from rendered scene rectangles. A sticky, viewport-sized canvas lives inside the full-width frame in the existing timeline scroll container. The custom Chart.js linear scale uses CSS pixel positions directly, including axis and frame padding, without scaling scene positions to the chart area. ResizeObserver and the timeline layout event invalidate measurements; scroll events only update the visible chart window.
When scene cards are collapsed after measurement, the last measured geometry remains available. If scene cards are disabled or initially collapsed, the chart retains the standalone ordinal layout until rendered scene geometry becomes available. Analytics and character charts retain their standalone layouts. Raw metric rows remain on their existing CSS grid; they are not part of this chart fix.
Location drag-and-drop regressions
Run npm run test:locations (with CHROMIUM_PATH if using an existing Chromium).
This loads the full production site script and Bootstrap confirmation modal in an isolated location-tree fixture. AJAX responses are mocked. It checks parent assignment/reassignment, cancellation, cycle/no-op rejection, repeated dragging after tree replacement, scroll preservation, server-error display, and relationship modal/AJAX saves. Database behavior is covered separately by PlotLine.Tests/Sql/LocationReparent.sql, whose fixtures always roll back.
Plot Lines narrative map
Run the isolated Razor host from the repository root:
dotnet run --project PlotLine.Tests/PlotLine.Tests.csproj -- --toolbar-browser-host
Then run npm run test:plot-lines from this directory. The test renders the actual narrative-map partial and production CSS/JavaScript with generated data. Inspector/editor requests and association saves are mocked; no database writes occur. It checks Focus/Weave route counts and positions, shared-scene deduplication, thread introductions, per-line gaps, explicit connections, three themes, selection and association submission, narrow-screen scrolling, direct route drops, repeated saves without navigation, stable page/strip/map scroll positions, refreshed counts and attribution markers, and card clearance from all routes. Screenshots are saved under /tmp/plot-map-*.png.
The focused composition gate is dotnet run --project PlotLine.Tests/PlotLine.Tests.csproj -- --plot-lines.
Run npm run test:associate-scenes against the same isolated host for sticky-tray/filter behaviour, page drag auto-scroll in both directions, edge exit/end/cancellation, and downward keyboard/hover previews.
Run npm run test:timeline-plot-retirement against the isolated Razor host for actual Timeline/Settings rendering without plot lanes, health markers, lane controls or plot jumps. It preserves scene membership focus/search and supplied scenario ordering, including stale saved lane preferences. PLOT_ASSET_ORIGIN=https://dev.plotdirector.com exercises deployed frontend assets against the fixture.
Run npm run test:plot-health against the isolated host for lazy Health evidence, stored-status separation, Focus/Weave, annotation clearance, three themes, contribution navigation, and association drop/save preservation. dotnet run --project PlotLine.Tests/PlotLine.Tests.csproj -- --plot-health runs the pure H001–H012 evaluator tests, including partial scenarios, cross-book chapters and 12,000 contributions. No database is required for these tests.
Installed desktop contextual ribbon
With the loopback Razor host running, run xvfb-run -a node PlotLine.Tests/Browser/pwa-desktop.cjs from the repository root (or npm run test:pwa-desktop here). This installs and launches a real Chromium standalone PWA via CDP, rather than assuming viewport width means installed mode. Its Fixture identity is test-executable-only; no human sign-in, database access or authentication endpoint in the web application is involved. It checks browser preservation, actual Razor contributions, six themes, desktop widths, contextual menu keyboard/focus, original form submission, exact route/scope equivalence, jumps, Help and fragment replacement. See Docs/PWA/Desktop-Experience.md for the page/command inventory and declarative contribution contract.
For live Dev-only smoke tests, the executable's --dev-browser-identity create /tmp/pd-dev-browser-<unique>.json operational command provisions a dedicated identity through the normal user/password and email-verification repositories. It validates the configured database is PlotDirector_Development, takes/verifies a unique copy-only backup before provisioning, and writes credentials only into a newly created owner-readable file. The browser must still log in through the normal antiforgery-protected login page; no cookie forging or authentication changes occur. Do not trace/screenshot login, print the file or commit credentials. Run the same command with cleanup to sign in normally and invoke the complete account-deletion workflow, removing the exact identity, its owned fixture projects/files and the private credential file. The helper is compiled only in the test executable and is never part of the deployed web application.
After provisioning a dedicated fixture project/book through normal Dev forms, the private identity file may include ProjectID and BookID. Run xvfb-run -a node PlotLine.Tests/Browser/pwa-desktop-dev.cjs /tmp/pd-dev-browser-<unique>.json for real authenticated browser/installed-PWA Dev smoke coverage. It is pinned to https://dev.plotdirector.com, never records login screenshots/traces, and uses only the dedicated fixture project. Clean up the identity afterwards with the command above.
The contextual-ribbon regression now asserts one 84px active ribbon panel, with context groups to the right of the original groups and no contextual title/toolbar box. All six themes run at 2560/1440/900 px. Wide groups must remain direct when they fit; narrow groups use measured native-menu overflow with keyboard dismissal and unclipped hit targets. Existing equivalent commands are checked by DOM identity across category switches, not just by matching labels/URLs. Mixed management groups retain a compact destructive-action menu.
PWA first-paint checks: node pwa-display-mode.cjs verifies head bootstrap behavior, including stale hints and unavailable storage. pwa-desktop.cjs and the dedicated-identity pwa-desktop-dev.cjs also invoke pwa-first-paint.cjs: a real installed window, parser-paused intermediate screenshots, 2,500 additional content cards, cold/navigation/reload and browser stale-hint tests, composition timing and workspace-movement assertions. The gate is test-response injection only; application pages have no guard/delay. See Docs/PWA/First-Paint.md.
Desktop context menus: npm run test:pwa-context (with the isolated toolbar browser host running) uses a real installed PWA and actual Razor scenes/cards/forms. It verifies browser/Ctrl escape behavior, physical right-click and keyboard invocation, A/B targeting, original and typed-delete confirmations, unavailable/archived/read-only states, real Clipboard API editing and denied access, submenu keyboard/mouse behavior, all six themes and corners at 1440/900, source lifecycle and original primary/drag behavior. pwa-desktop.cjs captures representative contextual menus across the 20-view audit. The Dev suite checks native/PWA menu behavior on every existing smoke route and, when the private test scope contains owned sample IDs, exercises actual scene/entity routes, map inspector/association selection, clipboard and entity details without human login. Passwords, sessions and external/user clipboard content are not captured; screenshots use controlled fixture text.
Edit Scene workspace: with the isolated toolbar browser host running, use npm run test:scene-workspace. This checks the real Razor page/editor fragments in browser and installed-PWA windows, including shared area navigation/history, inspector stability and width recovery, Story/Relationships save flows, themes and responsive layouts. See Docs/Codex/EditSceneWorkspace.md for the capability inventory and optional read-only visual snapshot workflow.
Desktop promotion
Run npm run test:desktop-promotion for isolated browser coverage of eligibility, suppression/reminders, real screenshot geometry, pointer/keyboard interaction, modal focus, install prompting/fallback, themes and standalone exclusion. npm run test:pwa also checks the shared install mechanism and service worker.
For Dev verification, provision a private identity using the existing --dev-browser-identity create /tmp/pd-dev-browser-<unique>.json harness command, then run xvfb-run -a node desktop-promotion-dev.cjs /tmp/pd-dev-browser-<unique>.json. This uses normal authentication and creates an isolated project/book, captures theme previews under /tmp, installs a real Chromium app and checks first paint. Always run --dev-browser-identity cleanup afterwards. Never pass real user credentials or run against Production.
Desktop record workspaces
Run the isolated fixture host with dotnet run --project PlotLine.Tests/PlotLine.Tests.csproj -- --toolbar-browser-host, then npm run test:record-workspaces. The suite renders nine real Razor forms and checks Browser preservation, Desktop composition, responsive widths, ribbon Save/icons, existing unobtrusive validation, multipart/antiforgery submission, themes and parser-paused first paint.
For Dev-only verification, provision an identity with --dev-browser-identity create /tmp/pd-dev-browser-<unique>.json, then run xvfb-run -a node record-workspaces-dev.cjs /tmp/pd-dev-browser-<unique>.json. It creates isolated records via their normal forms, installs/launches a real Chromium app, verifies eight record types plus details/settings/management, saves and reloads a changed book, checks keyboard/context behaviour, and measures initial geometry. Always finish with --dev-browser-identity cleanup to remove the account and all owned fixture data. Production is never a test target.
Responsive Chapters, Timeline and Plot Lines: start the isolated Razor host from the repository root with dotnet run --project PlotLine.Tests -- --toolbar-browser-host, then run npm run test:responsive-content in this directory. Repeat with PD_RESPONSIVE_STANDALONE=1 for simulated standalone shell mode. The test checks 360, 390, 412, 800 and 1440 CSS pixels in modern dark, warm dark and modern light themes, with short/long chapter titles, long rail/book names, visible actions, sticky rails, internal scrolling, zoom connector coordinates and page overflow. Screenshots at 390 and 1440px are written to /tmp/responsive-*.png. These fixtures render compiled application views without a database; standalone simulation does not replace device testing.
Alternative Scenario theme acceptance
Start the isolated Razor host from the repository root with dotnet run --project PlotLine.Tests -- --toolbar-browser-host, then run xvfb-run -a node PlotLine.Tests/Browser/scenario-themes.cjs in another terminal. This renders the actual Scenario list, creation, board and Compare views without database access. The test enumerates the configured themes, switches them with the account theme picker, checks populated and empty states at 1440/650 widths, measures representative text contrast, and installs and launches a real standalone Chromium PWA. Screenshots go to /tmp/pd-scenario-visual (override with PD_SCENARIO_SCREENSHOTS). Movement form identities and chapter selection are checked; database-backed scene movement and applying a scenario are deliberately outside this fixture.
Manuscript setup themes
Start the isolated Razor host with dotnet run --project PlotLine.Tests/PlotLine.Tests.csproj -- --toolbar-browser-host, then run node onboarding-theme.cjs here. Run xvfb-run -a node onboarding-theme.cjs --installed for actual Chromium installed-PWA coverage. PD_BROWSER_FIXTURE_URL selects the host (default port 5238); PD_THEME_SCREENSHOTS optionally selects an existing screenshot directory. All 11 steps use synthetic view models and no import actions are submitted. Four light/dark theme variants cover software-card/button contrast and card selection, hover, focus and disabled states.