Move frontend assertions out of the PHP test suite - #287
Merged
Conversation
TelematicsHardeningTest and CustomerContactIdentitySafetyTest read Ember templates and components through file_get_contents(__DIR__ . '/../../addon/...') and asserted on their source text. That put UI edits on the backend CI critical path — a deleted panel in customer/form.hbs broke the PHP suite, which skipped the coverage gate and therefore the Codecov upload. The assertions also matched source strings rather than behavior, so they passed on a match inside a comment and failed on a harmless rename, while executing no server/src code. All 15 addon/ reads are gone. Each assertion is re-expressed in the Ember suite against behavior: - cell/telematic-status, connectivity/telematics/details: active and connected both surface as "Connected" - telematic/details: webhook URL is derived from public_id and is null when only the Ember uuid exists; last_sync_job_id and last_sync_error reach the UI - telematic/form, telematic/settings: endpoint fields are partitioned into the advanced section and fall back to provider default_value - device/details, device/panel-header: last-seen timestamp formatting and connection state taking precedence over the raw online flag - customer/form: welcome email is opt-in, gated on isNew plus the customer portal extension, and writes meta.customer_portal.send_welcome_email without dropping sibling meta; the user selector queries is_customer The backend assertions in both PHP files are untouched. Two build fixes were needed for the Ember suite to load this addon at all: @ember/legacy-built-in-components is an optional peer of ember-engines, so pnpm skips it and vendor.js dies on a missing module; and a lazy engine keeps its modules out of the dummy app, so every dummy/components/* import failed to resolve. Eager loading is scoped to `ember test` run from this package, leaving host apps — and `ember build` — on the lazy path. Co-Authored-By: Claude Opus 5 <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.
Why
server/tests/TelematicsHardeningTest.phpandserver/tests/CustomerContactIdentitySafetyTest.phpreached across into the Ember addon withfile_get_contents(__DIR__ . '/../../addon/...')and asserted on template/component source text.That had three costs:
addon/components/customer/form.hbsbroke the PHP suite, which skipped the coverage gate and therefore skipped the Codecov upload entirely.server/srccode executes in them.What changed
All 15
addon/reads are gone from the two PHP files. Every assertion is re-expressed in the Ember suite against behavior. Backend assertions in both files are untouched.case 'active': return 'Connected';in the status cell + details controllercell/telematic-statusandconnectivity/telematics/detailsboth mapactive/connected→Connected/successthis.args.resource?.public_idpresent,?.uuidabsentwebhookUrlbuilds frompublic_id, returnsnullwhen only the Ember uuid exists'this.hasWebhookUrl','Provider polling'in the template<Telematic::Details>shows the URL, the unavailable message, or the polling copy per provider'advancedCredentialFields','field.default_value'<details>section and fall back to the providerdefault_value'format-date-fns this.lastSeenLabel ...'Device::Detailsrenders18 Jun 2026, 15:28,-when never seen'this.showWelcomeEmailOption','this.toggleWelcomeEmail'isNew+ portal extension, writesmeta.customer_portal.send_welcome_emailwithout dropping sibling meta'is_customer=true'{ doesnt_have_contact: true, is_customer: true }New: 8 test files. Extended: 6.
Two build fixes came along
The Ember suite could not load this addon's modules at all before this — every existing test file failed identically with
Could not find module '@fleetbase/fleetops-engine/...'.@ember/legacy-built-in-componentsadded todevDependencies. It's an optional peer ofember-engines, so pnpm skips it andvendor.jsdies on a missing module. Lockfile updated withpnpm install --lockfile-only; the diff is only this package.index.js—lazyLoadingis disabled only forember testrun from this package (process.argv.includes('test') && process.cwd() === __dirname). A lazy engine keeps its modules out of the dummy app. Host apps andember buildstay on the lazy path — verified: the production build still emitsdist/engines-dist/@fleetbase/fleetops-engine/assets/engine-*.js.Verification
PHP — both files green:
TelematicsHardeningTest: 25 passed, 12 skipped (550 assertions)CustomerContactIdentitySafetyTest: 5 passed (43 assertions)php-cs-fixer --dry-run: cleanEmber.js CI steps, run locally:
pnpm run lint— exit 0 (js, hbs, css, intl)pnpm run build— exit 0Ember tests — the 27 new pure-logic unit assertions pass. The container-based tests (1 controller unit file, 6 rendering files) could not be executed:
setupTest/setupRenderingTestfail for every test in this checkout, pre-existing ones included, onFailed to create an instance of 'service:universe/registry-service'. Treat those as unverified.Known follow-ups (not in this PR)
.github/workflows/ember.ymlnever runsember test— only lint and build. These assertions gate nothing in CI yet. Wiring that up first needs theuniverse/registry-servicecontainer failure fixed and the generatedit rendersboilerplate tests cleaned up.addon/, usingdirname(__DIR__, 2)instead of__DIR__ . '/../../', which is why the original sweep missed them:server/tests/OrderFileAttachmentTest.php:6-7andserver/tests/OrderActivityFlowRegressionTest.php:108.scripts/pest-runner.phpexits 0 with zero output in this environment — reproduces on untouched files, caused by theauto_prepend_filebootstrap it injects.Unit | Component | telematic/form: editing server uri updates resource credentials(pre-existing) callsprototype.setCredential.call({...}), but@actionreturns a pre-bound function sothis.argsis undefined.🤖 Generated with Claude Code