Skip to content

test(agent): pin the login page contract - LoginPage - #2032

Merged
dmitrii-f-t27 merged 1 commit into
queenfrom
zcode/tests-1576-login-page
Oct 15, 2026
Merged

dmitrii-f-t27 merged 1 commit into
queenfrom
zcode/tests-1576-login-page

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Collaborator

Summary

Hold the one export of trios/agent-server/apps/agent/entrypoints/app/login/LoginPage.tsx β€” LoginPage β€” against its contract (#1576), so the next change to that file has something to fail against.

What is pinned:

  • statically: the settled no-session mount answers the welcome card β€” the back button (lucide-arrow-left) and the Welcome to BrowserOS title with its description, the email field with its label and you@example.com placeholder, the magic-link submit disabled on the empty address (exactly one disabled="" in the card), the Or continue with separator, the Continue with Google button with its drawn logo (aria-label="Google") β€” and the error alert stays away;
  • source checks: the spinner branch gated on isPending, the session redirect effect-gated behind session && !isPending toward /home, the submit gated on a non-empty address, both loading disables measured (input and Google button), the sent card's Check your email title and Use a different email reset, and the destructive error alert behind {error && ( β€” these branches live in handlers and effects a static render never presses, and a later suite's auth stand-in would answer its own fixed session, so only the state every stand-in agrees on is pinned as markup.

Two stub sets ride the sibling suites' own stand-in shapes: the router (spread from the real module read through a query-qualified specifier, with the navigate hook answering a plain callback β€” the same block as the onboarding steps suites) and the auth client (signIn/signUp/signOut/useSession answering the settled no-session state, the same shape as StepsLayout and StepTwo), so whichever suite links last, this card renders the same.

Verification

  • bun test entrypoints/app/login/LoginPage.test.ts β€” 2 pass, 0 fail.
  • Broken-copy proof: inverting the pending gate (if (isPending) β†’ if (!isPending)) turns both tests red (0 pass, 2 fail); the copy restores clean via git checkout.
  • Mixed-order run with the neighboring groups (entrypoints/app/login/, entrypoints/onboarding/, entrypoints/app/admin-dashboard/): 13 pass, 0 fail across 10 files.
  • biome ci on the suite file: clean. tsgo --noEmit: 0 mentions of the suite file.

Closes #1576

Dmitrii Fedorov (@dmitrii-f-t27)

Hold the one export of entrypoints/app/login/LoginPage.tsx
against its contract (#1576): the settled
no-session mount answers the welcome card with its back button and
title, the email field with its label and placeholder, the
magic-link submit disabled on the empty address, the separator
line and the Google button with its drawn logo, and keeps the
error alert away. The pending spinner branch, the effect-gated
session redirect, the submit gating, the sent and error cards and
both loading disables are pinned as source checks - a later
suite's auth stand-in would answer its own fixed session, not
this file's fixture, so the static card stays pinned only in the
state every stand-in agrees on. The router and the auth client
ride the sibling suites' own stand-in shapes.

Closes #1576

Dmitrii Fedorov ([@dmitrii-f-t27](https://github.com/dmitrii-f-t27))
@tri-claw

tri-claw Bot commented Oct 15, 2026

Copy link
Copy Markdown

Summary by t27-bees

This PR adds a contract test for LoginPage.tsx that pins its current rendered markup (settled no-session state) and source-level branches (pending spinner, redirect effect, submit gating, loading disables, sent/error cards) so future changes have a baseline to fail against. The test mocks react-router and the auth client to supply a settled no-session fixture, and uses a query-qualified import to isolate its module graph.

Worth a look

  • trios/agent-server/apps/agent/entrypoints/app/login/LoginPage.test.ts:87–98 β€” The first test asserts rendered markup via renderToStaticMarkup, which never runs effects or event handlers. The pending spinner, redirect, submit gating, sent card, and error alert are only verified by the second test's source grep, so a regression that moves those branches into a different component/file would not be caught.
  • trios/agent-server/apps/agent/entrypoints/app/login/LoginPage.test.ts:100–125 β€” The second test does fragile string matching on the raw source (loginCode()). Any semantics-preserving refactor (e.g., if (isPending) { β†’ if (isPending) {, adding parentheses, reformatting, or extracting a variable) will break the test without any behavioral change.
  • trios/agent-server/apps/agent/entrypoints/app/login/LoginPage.test.ts:96 β€” expect(idle.split('disabled=""').length - 1).toBe(1) counts literal disabled="" in the static markup, but the source check at line 113 expects exactly two occurrences of disabled={state === 'loading'}. If the rendered output uses a different attribute form (e.g., disabled without value, or disabled={true}), the counts diverge and the test gives false confidence.
  • trios/agent-server/apps/agent/entrypoints/app/login/LoginPage.test.ts:12–13, 22–30 β€” The mocks use mock.module (Bun-specific) and spread the real react-router module via a query-qualified import. If the real module's exports change, or if another test mutates the same module cache, the fixture may drift.
  • trios/agent-server/apps/agent/entrypoints/app/login/LoginPage.test.ts:33 β€” The subject is imported via ./LoginPage?login-page-suite-real to force a fresh graph. This relies on the bundler honoring the query string for cache busting; if the build system changes, the isolation may break silently.

Read: 1 files, +127 -0, the whole diff. Head b282aa7. Model: openai-compatible/nvidia/nemotron-3-ultra-550b-a55b. Commands: @t27-bees review | summary | help | pause | resume. Free for every repository.

@github-actions

Copy link
Copy Markdown

βœ… Tests passed β€” 3873/3943

Suite Passed Failed Skipped
βœ… agent 416/416 0 0
βœ… build 9/9 0 0
βœ… cdp-protocol 5/5 0 0
βœ… eval 93/93 0 0
βœ… server-agent 280/280 0 0
βœ… server-api 2244/2313 0 69
βœ… server-browser 6/6 0 0
βœ… server-integration 10/11 0 1
βœ… server-lib 279/279 0 0
βœ… server-pglive 166/166 0 0
βœ… server-root 68/68 0 0
βœ… server-sim 8/8 0 0
βœ… server-skills 31/31 0 0
βœ… server-tools 244/244 0 0
βœ… shared 14/14 0 0

View workflow run

@dmitrii-f-t27
dmitrii-f-t27 merged commit b075116 into queen Oct 15, 2026
19 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.

1 participant