Skip to content

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

feat(test): add signInViaBypassUserPreservingConfig helper

Steven Enamakel712b40a34027
diff --git a/app/test/playwright/helpers/core-rpc.ts b/app/test/playwright/helpers/core-rpc.ts
index 574a2d8cdd..8fe6c272de 100644
--- a/app/test/playwright/helpers/core-rpc.ts
+++ b/app/test/playwright/helpers/core-rpc.ts
@@ -215,6 +215,24 @@ export async function signInViaBypassUser(
}
}
+/** Re-authenticate the same local test user without resetting persisted config. */
+export async function signInViaBypassUserPreservingConfig(page: Page, userId: string): Promise<void> {
+ await callCoreRpc('openhuman.auth_store_session', {
+ token: buildBypassJwt(userId),
+ userId,
+ user: { _id: userId, id: userId, displayName: 'Playwright User' },
+ });
+ await applyBrowserCoreModeInPage(page);
+ await page.goto('/#/home');
+ await waitForAuthenticatedSnapshot(page);
+ await expect
+ .poll(async () => page.evaluate(() => window.location.hash), {
+ timeout: AUTH_CALLBACK_HOME_TIMEOUT_MS,
+ })
+ .toMatch(/^#\/chat/);
+ await waitForAppReady(page);
+}
+
export async function bootAuthenticatedPage(
page: Page,
userId: string,
diff --git a/app/test/playwright/specs/logout-relogin-onboarding.spec.ts b/app/test/playwright/specs/logout-relogin-onboarding.spec.ts
index 370064a101..29f7408152 100644
--- a/app/test/playwright/specs/logout-relogin-onboarding.spec.ts
+++ b/app/test/playwright/specs/logout-relogin-onboarding.spec.ts
@@ -4,6 +4,7 @@ import {
bootRuntimeReadyGuestPage,
callCoreRpc,
signInViaBypassUser,
+ signInViaBypassUserPreservingConfig,
waitForAppReady,
} from '../helpers/core-rpc';
@@ -103,14 +104,13 @@ test.describe('Logout -> re-login onboarding overlay', () => {
test('same-account completed onboarding survives UI logout and re-login', async ({ page }) => {
const userId = 'pw-logout-relogin-completed-user';
await signInViaBypassUser(page, userId);
- await callCoreRpc('openhuman.config_set_onboarding_completed', { value: true });
- await waitForAppReady(page);
- await expect.poll(readOnboardingCompleted).toBe(true);
+ await expectLandedInChat(page);
await logoutViaSettings(page);
+ await expect.poll(readOnboardingCompleted).toBe(true);
await expect(page.getByTestId('onboarding-layout')).toHaveCount(0);
- await signInViaBypassUser(page, userId);
+ await signInViaBypassUserPreservingConfig(page, userId);
await page.goto('/#/onboarding/welcome');
await waitForAppReady(page);
await expect