Skip to content

Cover leaving the login screen, and give firecms_cloud a test runner - #1048

Merged
fgatti675 merged 1 commit into
mainfrom
test-login-abandonment
Nov 17, 2026
Merged

fgatti675 merged 1 commit into
mainfrom
test-login-abandonment

Conversation

@fgatti675

Copy link
Copy Markdown
Member

view_abandoned shipped in d139c76 with no test behind it, on the screen that carries the funnel's largest number: 31.0% of login-screen visitors never clicked any sign-in method in May 2026, 42.4% in October, 41.4% in November. That is the metric the next decision about this screen will rest on, so the code producing it shouldn't be the one untested file in the flow.

What changed

The reporting moves out of the view into useAbandonmentReporter, which takes only React and so can be tested without standing up @firecms/ui and @firecms/core. The view keeps what is genuinely its own — whether the terms box was ticked, how many times the gate stopped the visitor — and calls markResolved when a sign-in method is attempted.

Behaviour is unchanged. Same two exits, same guards, same params.

Tests

Eight, covering both exits (pagehide for mobile, unmount for in-app navigation), silence once the visitor has done the thing, at most one report however the screen goes away, the elapsed seconds, and that the newest callback is the one called.

One is a named regression: subscribing the effect to the callback identity would run its cleanup on every render and report an abandonment each time — and hosts do pass an inline closure, SaasApp.tsx does. Reintroducing that bug fails that test and only that test:

✕ does not report when the host passes a new callback each render
Tests: 1 failed, 7 passed, 8 total

The runner

The package had no component runner, only node --test over two files. This adds Jest configured exactly as packages/ui already has it, taking src/**/*.spec.tsx so the two runners never collect each other's files. npm test now runs both.

Verified

  • 8 Jest tests pass
  • the existing node --test test/colors.test.ts still passes
  • the firecmsco/saas app suite, which aliases @firecms/cloud to this source, stays at 409 passing across 37 files

Generated by Claude Code

…ting

`view_abandoned` shipped in d139c76 inline in the login view, where it could
only be tested by standing up @firecms/ui and @firecms/core. It carries the
funnel's largest number — 31.0% of login-screen visitors never clicked any
sign-in method in May 2026, 42.4% in October, 41.4% in November — so it should
not be the one piece of that flow with no test behind it.

`useAbandonmentReporter` takes only React, so it can be covered directly. The
view keeps what is genuinely its own, whether the terms box was ticked and how
many times the gate stopped the visitor, and calls `markResolved` when a
sign-in method is attempted.

Behaviour is unchanged: the same two exits (`pagehide`, which fires on mobile
where `beforeunload` does not, and unmount for in-app navigation), the same
guards, the same params. The hook keeps reading the callback through a ref and
subscribing on `[]`: hosts pass a fresh closure every render, and subscribing
on its identity would run the cleanup — and so report an abandonment — on each
one.

Tests live in firecmsco/saas, whose suite already aliases @firecms/* to these
sources and tests this package's contract for the same reason (see
src/remote/lazy_export_contract.test.ts). Adding a runner here would mean new
devDependencies and a pnpm-lock.yaml regeneration, which is a separate change.

Verified: the saas app suite, which compiles this source, stays at 409 passing
across 37 files.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011VZh1qoNGKbXQrrrFiDoeQ
@fgatti675
fgatti675 force-pushed the test-login-abandonment branch from a41b239 to 7e1cced Compare November 17, 2026 12:20
@fgatti675
fgatti675 merged commit f3e6d90 into main Nov 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants