mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-29 04:20:39 +00:00
They were gated on a token this machine happened to hold, so they skipped wherever it had expired — which is most of the time and all of CI. Verification that only runs on one laptop is verification nobody has. Two things make a session and both are needed: the token says somebody is signed in, and userinfo says who. Several rooms wait on the second before they read anything, so a token alone leaves the empty state on screen and a spec asserting against it proves nothing. Nine tests that skipped now run, on a machine that has never logged in.
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { expect, test } from '@playwright/test'
|
|
import { signIn } from './session'
|
|
|
|
|
|
/** The subject `signIn` mints under; the theme is keyed on it. */
|
|
const SUB = 'gate'
|
|
|
|
for (const mode of ['light', 'dark'] as const) {
|
|
test(`a ${mode} theme chosen elsewhere is honoured here`, async ({ page }) => {
|
|
await signIn(page, { sub: SUB })
|
|
// What another Hanzo surface would have written, before this one loads.
|
|
await page.addInitScript(
|
|
({ m, s }) => {
|
|
localStorage.setItem('hanzo_iam_theme', m)
|
|
localStorage.setItem(`hanzo_iam_theme:${s}`, m)
|
|
},
|
|
{ m: mode, s: SUB },
|
|
)
|
|
|
|
await page.setViewportSize({ width: 1440, height: 900 })
|
|
await page.goto('/chat')
|
|
await page.waitForLoadState('networkidle')
|
|
|
|
await expect
|
|
.poll(
|
|
() =>
|
|
page.evaluate(() => ({
|
|
data: document.documentElement.getAttribute('data-theme'),
|
|
dark: document.documentElement.className.includes('dark'),
|
|
})),
|
|
{ timeout: 10_000 },
|
|
)
|
|
.toEqual({ data: mode, dark: mode === 'dark' })
|
|
})
|
|
}
|