refactor(router): move framework browser-test fixtures and routes out of app#2205
Merged
bpamiri merged 1 commit intoApr 22, 2026
Merged
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two overlapping 4.0-snapshot hygiene issues together to avoid rebase hell — same files, same
/_browser/*routes, sameconfig/routes.cfm:BrowserTest*.cfccontrollers, their view folders, and a strayUserNotificationsMailer.cfcdemo lived in the dogfood app'sapp/directory. Anyone copying this repo as a starting template saw fixtures they did not write.config/routes.cfmas a/_browserscope with six routes.What changed
vendor/wheels/public/browser-fixtures/{controllers,views}/alongside a minimalController.cfcbase that ships a$renderBrowserFixtureViewhelper. Fixtures render via explicitcfinclude+renderTextbecause Wheels'viewPathis a single string pinned to/app/views— so the fixtures deliberately bypass the normal view-path resolver.vendor/wheels/public/browser-fixtures/routes.cfmholds the/_browser/*route scope with the same named routes (browserTestHome,browserTestLogin,browserTestAuthenticate,browserTestDashboard,browserTestLogout,browserTestLoginAs) so specs usingvisitRoute(route="browserTestLogin")keep working.vendor/wheels/Global.cfc::$lockedLoadRoutesauto-mounts the fixture routes and appends the fixture controllers dir tocontrollerPath, mirroring how/wheels/public/routes.cfmis already auto-mounted. Gated byenvironment ∈ {testing, development}+ a new opt-in settingloadBrowserTestFixtures(defaultfalse).config/settings.cfmso the browser specs that hit the real HTTP server keep working./_browserroutes fromconfig/routes.cfm— now matches the clean lucli scaffold.app/mailers/UserNotificationsMailer.cfc+ view (byte-identical copies already exist underexamples/tweet/andexamples/starter-app/).Fixedentry and an upgrade-guide section atweb/sites/guides/src/content/docs/v4-0-0-snapshot/upgrading/3x-to-4x.mdxcovering the three upgrade paths (never used these routes → no action; ran browser specs → opt in; had custom/_browserroutes → opt in or keep your own).Test plan
bash tools/test-local.sh— 3250 pass, 0 fail, 0 error (Lucee 7 + SQLite)./_browser/home,/_browser/login,/_browser/login-as?identifier=aliceall return 200 with the setting on.GET /_browser/login→POST /_browser/login(302) →GET /_browser/dashboard(200) rendersalice@example.com)./_browser/homereturns 404 whenloadBrowserTestFixtures=false.cfformat checkpasses on every touched CFML file.Closes #2138
Closes #2135