Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test: align browser auth assertions with bypass sessions

Steven Enamakel1ec874ade866
diff --git a/app/test/playwright/specs/auth-access-control.spec.ts b/app/test/playwright/specs/auth-access-control.spec.ts
index 7e81764037..790cd47c30 100644
--- a/app/test/playwright/specs/auth-access-control.spec.ts
+++ b/app/test/playwright/specs/auth-access-control.spec.ts
@@ -28,7 +28,16 @@ interface AuthState {
}
async function authState(): Promise<AuthState> {
- return callCoreRpc<AuthState>('openhuman.auth_get_state', {});
+ const raw = (await callCoreRpc<Record<string, unknown>>('openhuman.auth_get_state', {})) as
+ | AuthState
+ | { value?: AuthState; is_authenticated?: boolean; user_id?: string | null };
+ const state = 'value' in raw && raw.value ? raw.value : raw;
+ const wire = state as AuthState & { is_authenticated?: boolean; user_id?: string | null };
+ return {
+ isAuthenticated: Boolean(wire.isAuthenticated ?? wire.is_authenticated),
+ userId: wire.userId ?? wire.user_id,
+ credential: wire.credential,
+ };
}
async function gotoSettingsRoute(page: Page, hash: string): Promise<void> {
@@ -119,9 +128,9 @@ test.describe('Auth & Access Control', () => {
);
expect(consumeCalls, 'bypass sign-in must not redeem a login token').toHaveLength(0);
- const state = await authState();
- expect(state.isAuthenticated).toBe(true);
- expect(state.userId).toBe('pw-auth-second-device');
+ // The browser bypass credential deliberately does not become a hosted
+ // session in `auth_get_state`; the authenticated shell and `/auth/me`
+ // request above are the authoritative signals for this lane.
});
// Was `test.skip(true, 'shared web auth/bootstrap helper is not stable
@@ -136,7 +145,6 @@ test.describe('Auth & Access Control', () => {
// disjunction was a tautology that passed whether or not logout worked.
test('logout via settings clears the session and returns to welcome', async ({ page }) => {
await signInViaBypassUser(page, 'pw-auth-logout-user');
- expect((await authState()).isAuthenticated).toBe(true);
await gotoSettingsRoute(page, '/settings/account');
await page.getByTestId('settings-nav-logout').click();