Skip to content

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

test(e2e): update login and logout tests

Steven Enamakel61dd9145de0d
diff --git a/app/test/playwright/specs/logout-relogin-onboarding.spec.ts b/app/test/playwright/specs/logout-relogin-onboarding.spec.ts
index 854115cb95..c930703436 100644
--- a/app/test/playwright/specs/logout-relogin-onboarding.spec.ts
+++ b/app/test/playwright/specs/logout-relogin-onboarding.spec.ts
@@ -53,8 +53,10 @@ async function expectLandedInChat(page: Page): Promise<void> {
}
async function logoutViaSettings(page: Page): Promise<void> {
- await callCoreRpc('openhuman.auth_clear_session', {});
- await page.goto('/#/');
+ await page.goto('/#/settings/account');
+ await waitForAppReady(page);
+ await page.getByTestId('settings-nav-logout').click();
+ await expect(page.getByTestId('welcome-cta-tinyhumans')).toBeVisible({ timeout: 20_000 });
// A core RPC response only confirms that persistence was updated. Wait for
// the browser's CoreStateProvider to observe that signed-out snapshot before
// asserting the public route, otherwise a preceding authenticated snapshot
@@ -79,6 +81,32 @@ test.describe('Logout -> re-login onboarding overlay', () => {
await bootRuntimeReadyGuestPage(page);
});
+ test('same-account completed onboarding survives UI logout and re-login', async ({ page }) => {
+ const userId = 'pw-logout-relogin-completed-user';
+ const tokenPayload = Buffer.from(
+ JSON.stringify({ sub: userId, userId, exp: Math.floor(Date.now() / 1000) + 3600 })
+ ).toString('base64url');
+ const token = `eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.${tokenPayload}.sig`;
+
+ await callCoreRpc('openhuman.auth_store_session', { token });
+ await callCoreRpc('openhuman.config_set_onboarding_completed', { value: true });
+ await page.goto('/#/chat');
+ await waitForAppReady(page);
+ await expect.poll(readOnboardingCompleted).toBe(true);
+
+ await logoutViaSettings(page);
+ await expect(page.getByTestId('onboarding-layout')).toHaveCount(0);
+
+ await callCoreRpc('openhuman.auth_store_session', { token });
+ await page.goto('/#/onboarding/welcome');
+ await waitForAppReady(page);
+ await expect
+ .poll(async () => page.evaluate(() => window.location.hash), { timeout: 20_000 })
+ .toMatch(/^#\/chat/);
+ await expect.poll(readOnboardingCompleted).toBe(true);
+ await expect(page.getByTestId('onboarding-layout')).toHaveCount(0);
+ });
+
test('re-login after logout re-runs onboarding from clean state and lands in chat', async ({
page,
}) => {
diff --git a/app/test/playwright/specs/runtime-picker-login.spec.ts b/app/test/playwright/specs/runtime-picker-login.spec.ts
index 9b11f1594e..1b0e44f4c3 100644
--- a/app/test/playwright/specs/runtime-picker-login.spec.ts
+++ b/app/test/playwright/specs/runtime-picker-login.spec.ts
@@ -48,28 +48,23 @@ test.describe('Runtime picker -> login -> logout', () => {
await bootRuntimeReadyGuestPage(page);
});
- // DELETED, not unskipped: `runtime picker validates cloud URL/token inputs
- // and unreachable hosts` and `returning to cloud-mode guest state keeps
- // provider login available`.
- //
- // Both carried `test.skip(true, 'web Playwright lane does not reliably
- // surface the desktop-style runtime picker overlay yet')`. That reason is
- // structural, not flaky, and no amount of rewriting fixes it: every test in
- // this file boots through `bootRuntimeReadyGuestPage`, which calls
- // `seedBrowserCoreMode` and writes `openhuman_core_mode`,
- // `openhuman_core_rpc_url` and `openhuman_core_rpc_token` into localStorage
- // before the first paint. The app therefore already knows its runtime and
- // is correct not to show the picker. Removing that seeding leaves the web
- // build with no core to talk to, so the page never boots — the overlay is
- // unreachable in this lane by construction.
- //
- // The desktop lane covers all of it, and more: see
- // `app/test/e2e/specs/runtime-picker-login.spec.ts` —
- // `clicking "Select a Runtime" opens the runtime picker with both options`,
- // `cloud option reveals URL + token inputs and validates them`,
- // `"Test Connection" against an unreachable host shows the unreachable pill`,
- // `switching back to Local and clicking Continue closes the picker`.
- // That is a strict superset of the two deleted cases.
+ test('shows current welcome choices and provider sign-in options', async ({ page }) => {
+ await expect(page.getByTestId('welcome-card-self')).toBeVisible();
+ await expect(page.getByTestId('welcome-cta-self')).toBeVisible();
+ await expect(page.getByTestId('welcome-cta-tinyhumans')).toBeVisible();
+ await expect(page.getByRole('button', { name: /Google|GitHub|Twitter|Discord/i }).first()).toBeVisible();
+ });
+
+ test('self-hosted choice completes the current custom setup wizard', async ({ page }) => {
+ await page.getByTestId('welcome-cta-self').click();
+ await expect(page.getByTestId('onboarding-custom-inference-step')).toBeVisible();
+ await page.getByTestId('onboarding-next-button').click();
+ await expect(page.getByTestId('onboarding-custom-search-step')).toBeVisible();
+ await page.getByTestId('onboarding-search-skip').click();
+ await expect(page.getByTestId('onboarding-custom-vault-step')).toBeVisible();
+ await page.getByTestId('onboarding-next-button').click();
+ await expect.poll(() => page.evaluate(() => window.location.hash)).toContain('#/chat');
+ });
test('provider login reaches home and logout returns to welcome', async ({ page }) => {
await signInViaBypassUser(page, 'pw-runtime-picker-login');