The three specs shared one mutable backend and said so in their own
comments ("Restart the backend between CI runs"). WP-70 recorded the fix as
a dev-only seed endpoint; it isn't needed. The DB path already routes
through IConfiguration, so playwright.config's webServer hands the backend a
throwaway SQLite file per invocation — the same trick TestWebApplicationFactory
already uses, with zero backend change. And StubIdentityProvider already
honoured X-Subject; the only gap was that nothing sent it. That matters
because the backend has no IsDevelopment() gate anywhere, so a seed endpoint
would have had to invent the codebase's first environment gate.
subjectInterceptor mirrors the existing roleInterceptor and is wired into the
same isDevMode()-only list. Interceptors alone were not enough: the raw XHR
upload and the hand-written letter-preview fetch bypass Angular's chain (as
CLAUDE.md documents), so both now stamp X-Subject explicitly — without that,
every uploaded document still landed under DemoOwner.
reuseExistingServer stays on: flipping it would break local runs for anyone
already serving the docker stack. Each run gets a unique DB filename and
global-setup sweeps only prior runs' leftovers — deleting a fixed path
mid-run risks SQLite silently recreating an empty, unmigrated file under
fullyParallel.
Verified: e2e passes twice back-to-back with no backend restart, and
X-Subject was observed on a real request, not merely wired.
brief-v2.spec.ts keeps the shared identity for now — see the KNOWN GAP note;
a backend staleness bug makes /brief/preview return a sent letter with the
draft watermark for any non-DemoOwner BSN. actors.ts reserves the actor for
whoever fixes it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
76 lines
3.7 KiB
TypeScript
76 lines
3.7 KiB
TypeScript
import {
|
|
ApplicationConfig,
|
|
LOCALE_ID,
|
|
isDevMode,
|
|
provideBrowserGlobalErrorListeners,
|
|
} from '@angular/core';
|
|
import { provideRouter, withInMemoryScrolling, withViewTransitions } from '@angular/router';
|
|
import type { ActivatedRouteSnapshot } from '@angular/router';
|
|
import { provideHttpClient, withInterceptors } from '@angular/common/http';
|
|
import { registerLocaleData } from '@angular/common';
|
|
import localeNl from '@angular/common/locales/nl';
|
|
import localeEn from '@angular/common/locales/en';
|
|
|
|
import { routes } from './app.routes';
|
|
import { scenarioInterceptor } from '@shared/infrastructure/scenario.interceptor';
|
|
import { roleInterceptor } from '@shared/infrastructure/role.interceptor';
|
|
import { subjectInterceptor } from '@shared/infrastructure/subject.interceptor';
|
|
import { provideApiClient } from '@shared/infrastructure/api-client.provider';
|
|
import { SESSION_PORT } from '@shared/application/session.port';
|
|
import { SessionStore } from '@auth/application/session.store';
|
|
import { provideRouteFocus } from '@shared/layout/route-focus';
|
|
import { provideUnloadFlush } from '@shared/application/pending-saves';
|
|
import { HEADER_ADMIN_LINKS, HEADER_NAV_ITEMS } from '@shared/layout/site-header/nav-config';
|
|
import { DEBUG_PANEL } from '@shared/layout/shell/shell.component';
|
|
import { ADMIN_LINKS, NAV_ITEMS } from './shell/nav.config';
|
|
import { DebugStateComponent } from './shell/debug-state/debug-state.component';
|
|
|
|
// Both locales' data so DatePipe/number pipes work for whichever bundle is active.
|
|
registerLocaleData(localeNl);
|
|
registerLocaleData(localeEn);
|
|
|
|
export const appConfig: ApplicationConfig = {
|
|
providers: [
|
|
provideBrowserGlobalErrorListeners(),
|
|
provideRouter(
|
|
routes,
|
|
withInMemoryScrolling({ scrollPositionRestoration: 'enabled' }),
|
|
// Cross-fade page-to-page navigations only. A silent same-route nav — e.g.
|
|
// draft-sync stamping `?aanvraag=<id>` into the URL mid-wizard — must NOT
|
|
// animate: for the transition's duration Firefox's `::view-transition`
|
|
// overlay swallows pointer events (Chrome sets pointer-events:none, so it
|
|
// doesn't), which loses a click landing on it and makes the wizard's "next"
|
|
// button need a second click. Skip the transition when the route is unchanged.
|
|
withViewTransitions({
|
|
onViewTransitionCreated: ({ transition, from, to }) => {
|
|
// `from`/`to` are the ROOT snapshots (the shared shell), so descend to the
|
|
// leaf before comparing — otherwise every navigation looks "same route".
|
|
const leaf = (r: ActivatedRouteSnapshot) => {
|
|
while (r.firstChild) r = r.firstChild;
|
|
return r;
|
|
};
|
|
if (leaf(from).routeConfig === leaf(to).routeConfig) transition.skipTransition();
|
|
},
|
|
}),
|
|
),
|
|
// Dev-only: the ?scenario= toggle must never reach a production build, where
|
|
// a query param could otherwise force errors on the live app.
|
|
provideHttpClient(
|
|
withInterceptors(
|
|
isDevMode() ? [scenarioInterceptor, roleInterceptor, subjectInterceptor] : [],
|
|
),
|
|
),
|
|
provideApiClient(),
|
|
{ provide: SESSION_PORT, useExisting: SessionStore },
|
|
// Per-bundle locale: the localize build sets `$localize.locale` ('nl'/'en'); the
|
|
// non-localized dev/source build leaves it undefined → fall back to 'nl'. (Was hardcoded
|
|
// 'nl', which mis-formatted dates/numbers in the en bundle.)
|
|
{ provide: LOCALE_ID, useFactory: () => $localize.locale ?? 'nl' },
|
|
provideRouteFocus(),
|
|
provideUnloadFlush(),
|
|
{ provide: HEADER_NAV_ITEMS, useValue: NAV_ITEMS },
|
|
{ provide: HEADER_ADMIN_LINKS, useValue: ADMIN_LINKS },
|
|
{ provide: DEBUG_PANEL, useValue: DebugStateComponent },
|
|
],
|
|
};
|