Files
Darkhorse7starsandGitHub 71f27c05cf landing first: hanzo.ai is the landing for everyone, and no sign-in forces a checkout (#98)
- `/` draws the landing to every reader, signed in or not, paying or not
  (Apex `members={false}`); only the desktop app's window opens the app there
  (`DESKTOP_BOOT`).
- /onboarding no longer sends an account with no plan to pay's plans: a
  sign-in goes back to where it was headed. A checkout opens only when one was
  chosen (`?next=/pay…`), pay's plans only from an offer link.
- Try Hanzo and Open Hanzo open the app at /chat (a stranger signs up on the
  way); Back to app, a deleted organization, a support session and a paid
  checkout's return name /chat too.
- Gates: signed-in app specs open /chat; apex, sale and onboarding assert the
  new rules. LLM.md states them.
2026-10-29 03:53:58 -04:00

36 lines
1.4 KiB
TypeScript

import { expect, test } from '@playwright/test'
import { serveExport } from './export'
import { signIn } from '../session'
/**
* A MEMBER'S `/` NEVER DRAWS THE CRASH PAGE.
*
* The session settles after the page paints: first the SDK is loading, then it
* is signed in. A component that calls a hook only on the second render throws
* React #310 and the whole site reads "Something went wrong". So userinfo is
* answered late, and the page must reach the app with no page error.
*/
let base: string
let stop: () => Promise<void>
test.beforeAll(async () => {
const served = await serveExport()
base = served.url
stop = served.close
})
test.afterAll(async () => stop())
test('a session that settles late does not crash the site', async ({ page }) => {
const errors: string[] = []
page.on('pageerror', (e) => errors.push(e.message))
await signIn(page)
await page.route('**/v1/iam/oauth/userinfo', async (route) => {
await new Promise((r) => setTimeout(r, 800))
await route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ sub: 'gate', name: 'gate', email: '[email protected]' }) })
})
await page.goto(base + '/chat')
await page.waitForTimeout(2500)
await expect(page.getByText('Something went wrong')).toHaveCount(0)
expect(errors.filter((m) => /Minified React error|Rendered (more|fewer) hooks/.test(m))).toEqual([])
})