Skip to content

refactor(router): move framework browser-test fixtures and routes out of app#2205

Merged
bpamiri merged 1 commit into
developfrom
peter/fix-2138-2135-framework-fixtures-and-routes
Apr 22, 2026
Merged

refactor(router): move framework browser-test fixtures and routes out of app#2205
bpamiri merged 1 commit into
developfrom
peter/fix-2138-2135-framework-fixtures-and-routes

Conversation

@bpamiri
Copy link
Copy Markdown
Collaborator

@bpamiri bpamiri commented Apr 22, 2026

Summary

Fixes two overlapping 4.0-snapshot hygiene issues together to avoid rebase hell — same files, same /_browser/* routes, same config/routes.cfm:

What changed

  • Moved the three fixture controllers + view folders into vendor/wheels/public/browser-fixtures/{controllers,views}/ alongside a minimal Controller.cfc base that ships a $renderBrowserFixtureView helper. Fixtures render via explicit cfinclude + renderText because Wheels' viewPath is a single string pinned to /app/views — so the fixtures deliberately bypass the normal view-path resolver.
  • New vendor/wheels/public/browser-fixtures/routes.cfm holds the /_browser/* route scope with the same named routes (browserTestHome, browserTestLogin, browserTestAuthenticate, browserTestDashboard, browserTestLogout, browserTestLoginAs) so specs using visitRoute(route="browserTestLogin") keep working.
  • vendor/wheels/Global.cfc::$lockedLoadRoutes auto-mounts the fixture routes and appends the fixture controllers dir to controllerPath, mirroring how /wheels/public/routes.cfm is already auto-mounted. Gated by environment ∈ {testing, development} + a new opt-in setting loadBrowserTestFixtures (default false).
  • This dogfood app opts in via config/settings.cfm so the browser specs that hit the real HTTP server keep working.
  • Deleted the six /_browser routes from config/routes.cfm — now matches the clean lucli scaffold.
  • Deleted the stray app/mailers/UserNotificationsMailer.cfc + view (byte-identical copies already exist under examples/tweet/ and examples/starter-app/).
  • Added a CHANGELOG Fixed entry and an upgrade-guide section at web/sites/guides/src/content/docs/v4-0-0-snapshot/upgrading/3x-to-4x.mdx covering the three upgrade paths (never used these routes → no action; ran browser specs → opt in; had custom /_browser routes → opt in or keep your own).

Test plan

  • bash tools/test-local.sh — 3250 pass, 0 fail, 0 error (Lucee 7 + SQLite).
  • Manual smoke: /_browser/home, /_browser/login, /_browser/login-as?identifier=alice all return 200 with the setting on.
  • Manual smoke: full login flow (GET /_browser/loginPOST /_browser/login (302) → GET /_browser/dashboard (200) renders alice@example.com).
  • Manual smoke: /_browser/home returns 404 when loadBrowserTestFixtures=false.
  • cfformat check passes on every touched CFML file.
  • CI: full cross-engine matrix (Lucee 5/6/7, Adobe 2018/2021/2023/2025, BoxLang) — pending PR checks.

Closes #2138
Closes #2135

… of app (#2138, #2135)

Issue #2138: Three `BrowserTest*.cfc` controllers, their view folders, and
a stray `UserNotificationsMailer.cfc` demo were living in the dogfood app's
`app/` directory but are framework-internal, not app-level code. Anyone
copying this repo as a starting template or inspecting it as reference would
see fixtures they did not write.

Issue #2135: The same leak showed up in `config/routes.cfm` as a `/_browser`
scope with six routes — internal test infrastructure sitting in the one file
a developer is supposed to own.

Fix both in one pass, since they share the same files and routes:

- Move the three fixture controllers and their view folders into
  `vendor/wheels/public/browser-fixtures/{controllers,views}/`, alongside a
  minimal `Controller.cfc` base that provides a `$renderBrowserFixtureView`
  helper. Fixtures now render via explicit `cfinclude` + `renderText` so
  they do not depend on the normal Wheels view-path resolver (Wheels'
  `viewPath` setting is a single string pinned to `/app/views`).
- Add `vendor/wheels/public/browser-fixtures/routes.cfm` holding the
  `/_browser/*` route scope with the same named routes as before
  (`browserTestHome`, `browserTestLogin`, `browserTestAuthenticate`,
  `browserTestDashboard`, `browserTestLogout`, `browserTestLoginAs`).
- Auto-mount from `vendor/wheels/Global.cfc::$lockedLoadRoutes`, mirroring
  how `/wheels/public/routes.cfm` (the framework GUI) is already mounted.
  Gated by (a) `environment ∈ {testing, development}` and (b) a new opt-in
  setting `loadBrowserTestFixtures` that defaults to `false`.
- Enable the setting in this dogfood app via `config/settings.cfm` so
  browser specs that hit the real HTTP server keep working.
- Delete the six `/_browser` routes from `config/routes.cfm`; the file
  now matches the clean lucli scaffold template.
- Delete the stray `app/mailers/UserNotificationsMailer.cfc` plus its view —
  demo-only files that are already duplicated under `examples/tweet/` and
  `examples/starter-app/`.

Core test suite: 3250 pass, 0 fail, 0 error on Lucee 7 + SQLite. Manual
verification confirms `/_browser/home`, `/_browser/login`, `/_browser/login-as`,
and the full login → dashboard → logout redirect flow all return 200 when
the setting is on, and 404 when it is off.

Upgrade-guide entry added: apps that defined their own `/_browser/*` routes
of their own in 4.0-snapshot need to opt in to the new setting or declare
their own routes — the framework's routes register before `config/routes.cfm`
so same-named app routes still win.

Closes #2138
Closes #2135

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bpamiri bpamiri merged commit 2ac13a8 into develop Apr 22, 2026
9 checks passed
@bpamiri bpamiri deleted the peter/fix-2138-2135-framework-fixtures-and-routes branch April 22, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Controllers/views inside /app Internal routes present in application-level files

1 participant