The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(e2e): reformat playwright specs and helpers
Steven Enamakel0fe3e2bc2569
diff --git a/app/test/e2e/specs/settings-data-management.spec.ts b/app/test/e2e/specs/settings-data-management.spec.tsindex c37031535b..5daac0f1a6 100644--- a/app/test/e2e/specs/settings-data-management.spec.ts+++ b/app/test/e2e/specs/settings-data-management.spec.ts@@ -55,9 +55,7 @@ describe('Settings - Data Management', function () {const frontendUserId = await browser.execute(() => {const readState = (window as unknown as {- __OPENHUMAN_CORE_STATE__?: () => {- snapshot?: { auth?: { userId?: string | null } };- };+ __OPENHUMAN_CORE_STATE__?: () => { snapshot?: { auth?: { userId?: string | null } } };}).__OPENHUMAN_CORE_STATE__;return readState?.()?.snapshot?.auth?.userId ?? null;diff --git a/app/test/playwright/helpers/chat-transcript.ts b/app/test/playwright/helpers/chat-transcript.tsindex 47f8a31c81..b1d5dfb4d5 100644--- a/app/test/playwright/helpers/chat-transcript.ts+++ b/app/test/playwright/helpers/chat-transcript.ts@@ -1,7 +1,7 @@import { expect, type Page } from '@playwright/test';-import { callCoreRpc } from './core-rpc';import { waitForSelectedThreadId } from './chat-drive';+import { callCoreRpc } from './core-rpc';export interface PersistedThreadMessage {content: string;@@ -25,11 +25,9 @@ export async function persistedThreadMessages(threadId: string): Promise<Persistreturn messages as PersistedThreadMessage[];}-export async function selectedThreadTranscript(page: Page): Promise<{- threadId: string;- content: string;- total: number;-}> {+export async function selectedThreadTranscript(+ page: Page+): Promise<{ threadId: string; content: string; total: number }> {const threadId = await waitForSelectedThreadId(page);const response = await callCoreRpc<unknown>('openhuman.threads_transcript_get', {thread_id: threadId,@@ -48,11 +46,7 @@ export async function selectedThreadTranscript(page: Page): Promise<{expect((data as { hasMore: unknown }).hasMore).toBe(false);expect(Array.isArray((data as { items: unknown }).items)).toBe(true);expect((data as { total: number }).total).toBeGreaterThan(0);- return {- threadId,- content: JSON.stringify(data),- total: (data as { total: number }).total,- };+ return { threadId, content: JSON.stringify(data), total: (data as { total: number }).total };}export async function inFlightThreadKeys(): Promise<string[]> {diff --git a/app/test/playwright/helpers/core-rpc.ts b/app/test/playwright/helpers/core-rpc.tsindex 8fe6c272de..fccbdce4a7 100644--- a/app/test/playwright/helpers/core-rpc.ts+++ b/app/test/playwright/helpers/core-rpc.ts@@ -216,7 +216,10 @@ 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> {+export async function signInViaBypassUserPreservingConfig(+ page: Page,+ userId: string+): Promise<void> {await callCoreRpc('openhuman.auth_store_session', {token: buildBypassJwt(userId),userId,diff --git a/app/test/playwright/specs/agent-review.spec.ts b/app/test/playwright/specs/agent-review.spec.tsindex 3c8fcd8435..ab59fa3c82 100644--- a/app/test/playwright/specs/agent-review.spec.ts+++ b/app/test/playwright/specs/agent-review.spec.ts@@ -1,4 +1,11 @@-import { expect, test, type Page, type TestInfo } from '@playwright/test';+import { expect, type Page, test, type TestInfo } from '@playwright/test';++import {+ bootRuntimeReadyGuestPage,+ dismissWalkthroughIfPresent,+ signInViaBypassUser,+ waitForAppReady,+} from '../helpers/core-rpc';const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;@@ -7,17 +14,14 @@ async function attachCheckpoint(page: Page, testInfo: TestInfo, name: string): Pbody: await page.screenshot({ fullPage: true }),contentType: 'image/png',});- await testInfo.attach(`${name}.html`, {- body: await page.content(),- contentType: 'text/html',- });+ await testInfo.attach(`${name}.html`, { body: await page.content(), contentType: 'text/html' });const response = await fetch(`${MOCK_ADMIN_BASE}/__admin/requests`);expect(response.ok, 'mock request log is available for the checkpoint').toBe(true);const payload: unknown = await response.json();expect(payload && typeof payload === 'object' && 'data' in payload).toBe(true);const requests = (payload as { data: unknown }).data;expect(Array.isArray(requests), 'mock request log contains a data array').toBe(true);- const safeRequests = (requests as Array<Record<string, unknown>>).map((request) => {+ const safeRequests = (requests as Array<Record<string, unknown>>).map(request => {const safe = { ...request };for (const key of Object.keys(safe)) {if (/authorization|token|credential|secret/i.test(key)) safe[key] = '[redacted]';@@ -30,13 +34,6 @@ async function attachCheckpoint(page: Page, testInfo: TestInfo, name: string): P});}-import {- bootRuntimeReadyGuestPage,- dismissWalkthroughIfPresent,- signInViaBypassUser,- waitForAppReady,-} from '../helpers/core-rpc';-async function bootReviewedFlow(page: import('@playwright/test').Page, userId: string) {await bootRuntimeReadyGuestPage(page);try {@@ -50,7 +47,9 @@ async function bootReviewedFlow(page: import('@playwright/test').Page, userId: s}test.describe('Agent review - canonical shell + privacy flow', () => {- test('reaches the shell and opens the privacy panel with review artifacts', async ({ page }, testInfo) => {+ test('reaches the shell and opens the privacy panel with review artifacts', async ({+ page,+ }, testInfo) => {await bootReviewedFlow(page, 'pw-agent-review');// The composer is the durable readiness marker for the unified chat shell;diff --git a/app/test/playwright/specs/channels-smoke.spec.ts b/app/test/playwright/specs/channels-smoke.spec.tsindex 32b8ca7b2d..95509d3178 100644--- a/app/test/playwright/specs/channels-smoke.spec.ts+++ b/app/test/playwright/specs/channels-smoke.spec.ts@@ -1,8 +1,8 @@import { expect, test } from '@playwright/test';import {- callCoreRpc,bootAuthenticatedPage,+ callCoreRpc,dismissWalkthroughIfPresent,waitForAppReady,} from '../helpers/core-rpc';@@ -30,7 +30,7 @@ async function telegramConnected(): Promise<boolean> {: unwrapped;expect(Array.isArray(entries), 'channels_status returns channel status entries').toBe(true);const telegram = (entries as TelegramStatus[]).find(- (entry) =>+ entry =>(entry.channel_id ?? entry.channel) === 'telegram' &&(entry.auth_mode ?? entry.authMode) === 'bot_token');diff --git a/app/test/playwright/specs/chat-conversation-history.spec.ts b/app/test/playwright/specs/chat-conversation-history.spec.tsindex b9baa5dccb..21e1abb042 100644--- a/app/test/playwright/specs/chat-conversation-history.spec.ts+++ b/app/test/playwright/specs/chat-conversation-history.spec.ts@@ -1,13 +1,13 @@import { expect, type Page, test } from '@playwright/test';+import { selectedThreadTranscript } from '../helpers/chat-transcript';+import { persistedThreadMessages } from '../helpers/chat-transcript';import {bootAuthenticatedPage,callCoreRpc,dismissWalkthroughIfPresent,waitForAppReady,} from '../helpers/core-rpc';-import { selectedThreadTranscript } from '../helpers/chat-transcript';-import { persistedThreadMessages } from '../helpers/chat-transcript';const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;const USER_ID = 'pw-chat-conversation-history';diff --git a/app/test/playwright/specs/chat-harness-cancel.spec.ts b/app/test/playwright/specs/chat-harness-cancel.spec.tsindex c48ef9bacb..44af160c3d 100644--- a/app/test/playwright/specs/chat-harness-cancel.spec.ts+++ b/app/test/playwright/specs/chat-harness-cancel.spec.ts@@ -1,11 +1,11 @@import { expect, type Page, test } from '@playwright/test';+import { inFlightThreadKey, persistedThreadMessages } from '../helpers/chat-transcript';import {bootAuthenticatedPage,dismissWalkthroughIfPresent,waitForAppReady,} from '../helpers/core-rpc';-import { inFlightThreadKey, persistedThreadMessages } from '../helpers/chat-transcript';const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;const USER_ID = 'pw-chat-cancel';@@ -141,17 +141,21 @@ test.describe('Chat Harness - Cancel', () => {await expect.poll(() => inFlightThreadKey(threadId)).toBeUndefined();await expect.poll(async () => page.locator('#root').innerText()).toContain('one two');await expect- .poll(async () => {- const messages = await persistedThreadMessages(threadId);- return messages.some(- message => message.sender === 'user' && message.content === PROMPT- ) && messages.some(- message =>- message.sender === 'agent' &&- message.content.includes('one two') &&- message.extraMetadata.stopped === true- );- }, { timeout: 10_000 })+ .poll(+ async () => {+ const messages = await persistedThreadMessages(threadId);+ return (+ messages.some(message => message.sender === 'user' && message.content === PROMPT) &&+ messages.some(+ message =>+ message.sender === 'agent' &&+ message.content.includes('one two') &&+ message.extraMetadata.stopped === true+ )+ );+ },+ { timeout: 10_000 }+ ).toBe(true);const messages = await persistedThreadMessages(threadId);const stopped = messages.find(diff --git a/app/test/playwright/specs/chat-harness-send-stream.spec.ts b/app/test/playwright/specs/chat-harness-send-stream.spec.tsindex 6eebf8df81..0cee19d8f1 100644--- a/app/test/playwright/specs/chat-harness-send-stream.spec.ts+++ b/app/test/playwright/specs/chat-harness-send-stream.spec.ts@@ -1,15 +1,15 @@import { expect, type Page, test } from '@playwright/test';-import {- bootAuthenticatedPage,- dismissWalkthroughIfPresent,- waitForAppReady,-} from '../helpers/core-rpc';import {inFlightThreadKey,persistedThreadMessages,selectedThreadTranscript,} from '../helpers/chat-transcript';+import {+ bootAuthenticatedPage,+ dismissWalkthroughIfPresent,+ waitForAppReady,+} from '../helpers/core-rpc';const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;const USER_ID = 'pw-chat-send-stream';@@ -161,13 +161,16 @@ test.describe('Chat Harness - Send Stream', () => {.toBe(true);await expect- .poll(async () => {- try {- return (await selectedThreadTranscript(page)).content;- } catch {- return '';- }- }, { timeout: 10_000 })+ .poll(+ async () => {+ try {+ return (await selectedThreadTranscript(page)).content;+ } catch {+ return '';+ }+ },+ { timeout: 10_000 }+ ).toContain(CANARY);const durable = await selectedThreadTranscript(page);expect(durable.threadId).toBe(threadId);diff --git a/app/test/playwright/specs/conversations-web-channel-flow.spec.ts b/app/test/playwright/specs/conversations-web-channel-flow.spec.tsindex 78341185bc..6006c19d00 100644--- a/app/test/playwright/specs/conversations-web-channel-flow.spec.ts+++ b/app/test/playwright/specs/conversations-web-channel-flow.spec.ts@@ -1,11 +1,11 @@import { expect, type Page, test } from '@playwright/test';+import { inFlightThreadKeys } from '../helpers/chat-transcript';import {bootAuthenticatedPage,dismissWalkthroughIfPresent,waitForAppReady,} from '../helpers/core-rpc';-import { inFlightThreadKeys } from '../helpers/chat-transcript';const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;const USER_ID = 'pw-conversations-web-channel';diff --git a/app/test/playwright/specs/cron-jobs-flow.spec.ts b/app/test/playwright/specs/cron-jobs-flow.spec.tsindex 668025d2f8..a78a650933 100644--- a/app/test/playwright/specs/cron-jobs-flow.spec.ts+++ b/app/test/playwright/specs/cron-jobs-flow.spec.ts@@ -53,10 +53,7 @@ test.describe('Cron jobs settings panel', () => {const morningId = morning.id;expect(morningId, 'morning_briefing has a generated id').toBeTruthy();if (morning.enabled === false) {- await callCoreRpc('openhuman.cron_update', {- job_id: morningId,- patch: { enabled: true },- });+ await callCoreRpc('openhuman.cron_update', { job_id: morningId, patch: { enabled: true } });}await openCronJobsPanel(page);@@ -83,10 +80,7 @@ test.describe('Cron jobs settings panel', () => {) as { id?: string };const removableId = removable.id;expect(removableId, 'cron_add returns a generated id').toBeTruthy();- await callCoreRpc('openhuman.cron_update', {- job_id: removableId,- patch: { enabled: false },- });+ await callCoreRpc('openhuman.cron_update', { job_id: removableId, patch: { enabled: false } });await page.getByTestId('cron-refresh').click();const removableRow = page.getByTestId(`cron-job-row-${removableId}`);await expect(removableRow).toBeVisible();diff --git a/app/test/playwright/specs/guided-tour-gates.spec.ts b/app/test/playwright/specs/guided-tour-gates.spec.tsindex bd5733f7b6..aa525d9884 100644--- a/app/test/playwright/specs/guided-tour-gates.spec.ts+++ b/app/test/playwright/specs/guided-tour-gates.spec.ts@@ -41,7 +41,9 @@ test.describe('Guided tour gates', () => {await waitForAppReady(page);});- test('follows the current seven-step route and ends with its seeded welcome note', async ({ page }) => {+ test('follows the current seven-step route and ends with its seeded welcome note', async ({+ page,+ }) => {await armWalkthrough(page);const steps = [diff --git a/app/test/playwright/specs/logout-relogin-onboarding.spec.ts b/app/test/playwright/specs/logout-relogin-onboarding.spec.tsindex 29f7408152..e4b437d474 100644--- a/app/test/playwright/specs/logout-relogin-onboarding.spec.ts+++ b/app/test/playwright/specs/logout-relogin-onboarding.spec.ts@@ -54,9 +54,7 @@ async function expectLandedInChat(page: Page): Promise<void> {page.evaluate(() => {const state = (window as typeof window & {- __OPENHUMAN_CORE_STATE__?: () => {- snapshot?: { onboardingCompleted?: boolean };- };+ __OPENHUMAN_CORE_STATE__?: () => { snapshot?: { onboardingCompleted?: boolean } };}).__OPENHUMAN_CORE_STATE__?.();return state?.snapshot?.onboardingCompleted;diff --git a/app/test/playwright/specs/navigation.spec.ts b/app/test/playwright/specs/navigation.spec.tsindex d9becd624e..9c335108b2 100644--- a/app/test/playwright/specs/navigation.spec.ts+++ b/app/test/playwright/specs/navigation.spec.ts@@ -27,7 +27,7 @@ const ROUTES: RouteEntry[] = [{ route: '/skills', expectedHash: '/connections' }, // back-compat redirect{ route: '/activity', expectedHash: '/settings/account' }, // back-compat redirect{ route: '/intelligence', expectedHash: '/settings/account' }, // back-compat redirect- // Settings is a routed page and the /settings index resolves to Account.+ // Settings is a routed page and the /settings index resolves to Account.{ route: '/settings', expectedHash: '/settings/account' },];diff --git a/app/test/playwright/specs/runtime-picker-login.spec.ts b/app/test/playwright/specs/runtime-picker-login.spec.tsindex 2b6012f4d9..07559b76ef 100644--- a/app/test/playwright/specs/runtime-picker-login.spec.ts+++ b/app/test/playwright/specs/runtime-picker-login.spec.ts@@ -63,7 +63,9 @@ test.describe('Runtime picker -> login -> logout', () => {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();+ 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 }) => {diff --git a/app/test/playwright/specs/webhooks-tunnel-flow.spec.ts b/app/test/playwright/specs/webhooks-tunnel-flow.spec.tsindex 72c73a930b..ee53cb5708 100644--- a/app/test/playwright/specs/webhooks-tunnel-flow.spec.ts+++ b/app/test/playwright/specs/webhooks-tunnel-flow.spec.ts@@ -111,5 +111,4 @@ test.describe('Webhook tunnel CRUD (UI + core RPC + mock backend)', () => {// Connections surface, not the former trigger-history controls.await expect(page.getByTestId('two-pane-nav-composio')).toBeVisible();});-});