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: add missing test files for navigation and rewards features
Steven Enamakelc74a8f17277b
diff --git a/app/src/components/layout/shell/CollapsedNavRail.test.tsx b/app/src/components/layout/shell/CollapsedNavRail.test.tsxindex a0f18cd14b..a3d23885c5 100644--- a/app/src/components/layout/shell/CollapsedNavRail.test.tsx+++ b/app/src/components/layout/shell/CollapsedNavRail.test.tsx@@ -36,8 +36,6 @@ describe('CollapsedNavRail', () => {expect(screen.queryByRole('button', { name: 'nav.wallet' })).not.toBeInTheDocument();// Human is reached from the chat composer's idle button, not a nav row.expect(screen.queryByRole('button', { name: 'nav.human' })).not.toBeInTheDocument();- // Rewards is cloud-gated; this store has no resolved cloud session.- expect(screen.queryByRole('button', { name: 'nav.rewards' })).not.toBeInTheDocument();});it('renders rail icons as sidebar menu primitives', () => {diff --git a/app/src/components/layout/shell/SidebarNav.test.tsx b/app/src/components/layout/shell/SidebarNav.test.tsxindex ad9d88feda..cd0272ef18 100644--- a/app/src/components/layout/shell/SidebarNav.test.tsx+++ b/app/src/components/layout/shell/SidebarNav.test.tsx@@ -105,6 +105,3 @@ describe('SidebarNav active matching', () => {});- expect(tabButton('Rewards')).toHaveAttribute('aria-current', 'page');- });-});diff --git a/app/src/config/__tests__/navConfig.test.ts b/app/src/config/__tests__/navConfig.test.tsindex e0bf475764..c191550aef 100644--- a/app/src/config/__tests__/navConfig.test.ts+++ b/app/src/config/__tests__/navConfig.test.ts@@ -17,7 +17,6 @@ describe('NAV_TABS', () => {'/brain','/flows','/connections',- '/rewards',]);});@@ -27,7 +26,6 @@ describe('NAV_TABS', () => {'nav.brain','nav.flows','nav.connections',- 'nav.rewards',]);});@@ -37,12 +35,11 @@ describe('NAV_TABS', () => {'tab-brain','tab-flows','tab-connections',- 'tab-rewards',]);});- it('gates only rewards on a cloud session', () => {- expect(NAV_TABS.filter(t => t.cloudOnly).map(t => t.id)).toEqual(['rewards']);+ it('gates nothing on a cloud session now that Rewards is gone', () => {+ expect(NAV_TABS.filter(t => t.cloudOnly).map(t => t.id)).toEqual([]);});it('no longer contains a human tab (reached from the composer idle button)', () => {diff --git a/app/test/playwright/specs/navigation-smoothness.spec.ts b/app/test/playwright/specs/navigation-smoothness.spec.tsindex c0acde00ba..9a21aa15ef 100644--- a/app/test/playwright/specs/navigation-smoothness.spec.ts+++ b/app/test/playwright/specs/navigation-smoothness.spec.ts@@ -14,7 +14,6 @@ const routes: RouteCheck[] = [{ hash: '/home', markers: ['Your assistant is ready', 'Reasoning'] },{ hash: '/channels', markers: ['Channels', 'Connections', 'Telegram', 'Discord'] },{ hash: '/notifications', markers: ['Notifications', 'Alerts', 'No alerts yet'] },- { hash: '/rewards', markers: ['Rewards', 'Referral', 'Credits', 'Invite'] },{ hash: '/settings', markers: ['Settings', 'Account', 'Billing', 'Advanced'] },{ hash: '/settings/notifications-hub', markers: ['Notifications'] },// Home folded into the unified chat surface — /home redirects to /chat.diff --git a/app/test/playwright/specs/navigation.spec.ts b/app/test/playwright/specs/navigation.spec.tsindex a91fc08f62..2a2ebfa962 100644--- a/app/test/playwright/specs/navigation.spec.ts+++ b/app/test/playwright/specs/navigation.spec.ts@@ -23,7 +23,6 @@ const ROUTES: RouteEntry[] = [{ route: '/skills', expectedHash: '/connections' }, // back-compat redirect{ route: '/activity', expectedHash: '/settings/notifications' }, // back-compat redirect{ route: '/intelligence', expectedHash: '/settings/notifications' }, // back-compat redirect- { route: '/rewards' },// Desktop Settings is a modal overlay (the backgroundLocation pattern): the// /settings index redirects to the first panel and the modal renders on top// of the /chat fallback backdrop.diff --git a/app/test/playwright/specs/rewards-invites-reload-persistence.spec.ts b/app/test/playwright/specs/rewards-invites-reload-persistence.spec.tsdeleted file mode 100644index 748b905820..0000000000--- a/app/test/playwright/specs/rewards-invites-reload-persistence.spec.ts+++ /dev/null@@ -1,138 +0,0 @@-import { expect, type Page, test } from '@playwright/test';--import {- bootAuthenticatedPage,- dismissWalkthroughIfPresent,- waitForAppReady,-} from '../helpers/core-rpc';--/**- * Rewards and invites survive a real browser reload.- *- * `rewards-progression-persistence.spec.ts` already covers a "simulated restart"- * — but it does that with `page.goto('/#/home')` and back, which is a **remount- * inside the same JS context**. Redux, every in-memory cache and the whole- * module graph survive it. A user pressing Cmd-R does something categorically- * different: the context is destroyed and the page rebuilds from persisted- * storage plus whatever it re-fetches.- *- * That gap is exactly where "works until you refresh" bugs live, and nothing in- * the suite crosses it for these two surfaces. `top-level-functional-flows.spec.ts`- * covers the invite copy/redeem interactions but never reloads either.- *- * These specs therefore assert the same user-visible facts on both sides of a- * `page.reload()`, and deliberately do not re-test the interactions the existing- * specs already own.- */--// Two full boots plus a hard reload per test. The default 60s budget is enough-// on an idle machine but not when several e2e sessions share it — the first-// green run had a test at 51.0s, and the next run tipped all three over the-// wall with `Test timeout of 60000ms exceeded` rather than any assertion-// failing. Raised here rather than in the shared playwright.config.ts.-test.describe.configure({ timeout: 150_000 });--const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;--async function mockAdmin(path: string, body: unknown): Promise<void> {- // Errors propagate on purpose. Swallowing them lets a failed reset leave the- // shared mock stale, and the persistence result this file reports would then- // be about the previous test's fixture rather than this one's.- const response = await fetch(`${MOCK_ADMIN_BASE}${path}`, {- method: 'POST',- headers: { 'Content-Type': 'application/json' },- body: JSON.stringify(body),- });- if (!response.ok) {- throw new Error(`mock admin ${path} failed with HTTP ${response.status}`);- }-}--const resetMock = () => mockAdmin('/__admin/reset', {});-const setBehavior = (behavior: Record<string, unknown>) =>- mockAdmin('/__admin/behavior', { behavior });-/** The rewards spec's admin shape is flat key/value rather than a `behavior` object. */-const setBehaviorKV = (key: string, value: string) =>- mockAdmin('/__admin/behavior', { key, value });--async function settle(page: Page): Promise<void> {- await waitForAppReady(page);- await dismissWalkthroughIfPresent(page);-}--test.describe('Rewards — progression survives a hard reload', () => {- test('the same unlocked summary and usage metrics render after Cmd-R', async ({ page }) => {- await resetMock();- await setBehaviorKV('rewardsScenario', 'high_usage');- await setBehaviorKV('rewardsLastSyncedAt', '2026-04-28T09:00:00.000Z');-- await bootAuthenticatedPage(page, 'pw-rewards-reload', '/rewards?view=main');- await settle(page);-- // 60s, not the default: this is the first test in the file, so it pays the- // app's cold boot AND the first rewards fetch. Observed passing at 51s on an- // idle machine and missing first paint entirely under fleet load.- await expect(page.getByText('Your Progress')).toBeVisible({ timeout: 60_000 });- await expect(page.getByText('Activity streak')).toBeVisible();- await expect(page.getByText('14 days')).toBeVisible();- await expect(page.getByText('12,500,000')).toBeVisible();-- // The real thing: destroy the JS context, not just the route.- await page.reload();- await settle(page);-- await expect(page.getByText('Your Progress')).toBeVisible({ timeout: 20_000 });- await expect(page.getByText('Activity streak')).toBeVisible();- await expect(page.getByText('14 days')).toBeVisible();- await expect(page.getByText('12,500,000')).toBeVisible();- });-- test('a reload lands back on the rewards route rather than the default surface', async ({- page,- }) => {- // A deep link that does not survive a refresh is a broken bookmark: the- // user reloads to check something and is silently moved elsewhere.- await resetMock();- await setBehaviorKV('rewardsScenario', 'high_usage');- // Both keys, matching rewards-progression-persistence.spec.ts: seeding the- // scenario without a sync timestamp leaves the page without a progress- // summary to render, and the failure looks like a routing bug.- await setBehaviorKV('rewardsLastSyncedAt', '2026-04-28T09:00:00.000Z');-- await bootAuthenticatedPage(page, 'pw-rewards-reload-route', '/rewards?view=main');- await settle(page);- await expect(page.getByText('Your Progress')).toBeVisible({ timeout: 20_000 });-- await page.reload();- await settle(page);-- await expect- .poll(async () => page.evaluate(() => window.location.hash), { timeout: 20_000 })- .toMatch(/^#\/rewards/);- await expect(page.getByText('Your Progress')).toBeVisible();- });-});--test.describe('Invites — the code survives a hard reload', () => {- test('the rendered invite code is still there after Cmd-R', async ({ page }) => {- const inviteCode = `PW${Date.now().toString().slice(-6)}`;- await resetMock();- await setBehavior({- inviteCodes: JSON.stringify([- { _id: 'invite-pw-reload', code: inviteCode, currentUses: 0, maxUses: 1, usageHistory: [] },- ]),- });-- await bootAuthenticatedPage(page, 'pw-invites-reload', '/invites');- await settle(page);- await expect(page.getByText(inviteCode)).toBeVisible({ timeout: 20_000 });-- await page.reload();- await settle(page);-- await expect- .poll(async () => page.evaluate(() => window.location.hash), { timeout: 20_000 })- .toMatch(/^#\/invites/);- await expect(page.getByText(inviteCode)).toBeVisible({ timeout: 20_000 });- });-});diff --git a/app/test/playwright/specs/rewards-progression-persistence.spec.ts b/app/test/playwright/specs/rewards-progression-persistence.spec.tsdeleted file mode 100644index 924b833591..0000000000--- a/app/test/playwright/specs/rewards-progression-persistence.spec.ts+++ /dev/null@@ -1,90 +0,0 @@-import { expect, test } from '@playwright/test';--import {- bootAuthenticatedPage,- dismissWalkthroughIfPresent,- waitForAppReady,-} from '../helpers/core-rpc';--const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;--async function setMockBehavior(key: string, value: string): Promise<void> {- await fetch(`${MOCK_ADMIN_BASE}/__admin/behavior`, {- method: 'POST',- headers: { 'Content-Type': 'application/json' },- body: JSON.stringify({ key, value }),- });-}--async function resetMock(): Promise<void> {- await fetch(`${MOCK_ADMIN_BASE}/__admin/reset`, {- method: 'POST',- headers: { 'Content-Type': 'application/json' },- body: JSON.stringify({}),- });-}--async function gotoRewards(page: import('@playwright/test').Page, userId: string): Promise<void> {- await bootAuthenticatedPage(page, userId, '/rewards?view=main');- await waitForAppReady(page);- await dismissWalkthroughIfPresent(page);- await expect(page.getByText('Your Progress')).toBeVisible();-}--async function rewardsRequestCount(): Promise<number> {- const res = await fetch(`${MOCK_ADMIN_BASE}/__admin/requests`);- const json = (await res.json()) as { data?: Array<{ method: string; url: string }> };- const log = json.data ?? [];- return log.filter(r => r.method === 'GET' && /^\/rewards\/me/.test(r.url)).length;-}--test.describe('Rewards Progression Persistence', () => {- test('message-driven progress is reflected in the unlocked summary', async ({ page }) => {- await resetMock();- await setMockBehavior('rewardsScenario', 'high_usage');- await gotoRewards(page, 'pw-rewards-progress-message');-- await expect(page.getByText('3 of 3 achievements unlocked')).toBeVisible();- await expect(page.getByText('7-Day Streak')).toBeVisible();- await expect(page.getByText('Discord Member')).toBeVisible();- await expect(page.getByText('Pro Supporter')).toBeVisible();- });-- test('usage metrics render current streak and cumulative tokens', async ({ page }) => {- await resetMock();- await setMockBehavior('rewardsScenario', 'high_usage');- await gotoRewards(page, 'pw-rewards-progress-metrics');-- await expect(page.getByText('Activity streak')).toBeVisible();- await expect(page.getByText('14 days')).toBeVisible();- await expect(page.getByText('Cumulative tokens')).toBeVisible();- await expect(page.getByText('12,500,000')).toBeVisible();- });-- test('state persists across a simulated restart / remount', async ({ page }) => {- await resetMock();- await setMockBehavior('rewardsScenario', 'high_usage');- await setMockBehavior('rewardsLastSyncedAt', '2026-04-28T09:00:00.000Z');- await gotoRewards(page, 'pw-rewards-progress-persist');-- await expect(page.getByText('Activity streak')).toBeVisible();- await expect(page.getByText('14 days')).toBeVisible();- await expect(page.getByText('12,500,000')).toBeVisible();-- await setMockBehavior('rewardsScenario', 'post_restart');- await setMockBehavior('rewardsLastSyncedAt', '2026-04-28T10:30:00.000Z');-- await page.goto('/#/home');- await waitForAppReady(page);- await page.goto('/#/rewards?view=main');- await waitForAppReady(page);- await dismissWalkthroughIfPresent(page);- await expect(page.getByText('Your Progress')).toBeVisible();-- await expect(page.getByText('3 of 3 achievements unlocked')).toBeVisible();- await expect(page.getByText('Activity streak')).toBeVisible();- await expect(page.getByText('14 days')).toBeVisible();- await expect(page.getByText('12,500,000')).toBeVisible();- await expect.poll(() => rewardsRequestCount()).toBeGreaterThanOrEqual(2);- });-});diff --git a/app/test/playwright/specs/rewards-unlock-flow.spec.ts b/app/test/playwright/specs/rewards-unlock-flow.spec.tsdeleted file mode 100644index 6a65c5c809..0000000000--- a/app/test/playwright/specs/rewards-unlock-flow.spec.ts+++ /dev/null@@ -1,57 +0,0 @@-import { expect, test } from '@playwright/test';--import {- bootAuthenticatedPage,- dismissWalkthroughIfPresent,- waitForAppReady,-} from '../helpers/core-rpc';--const MOCK_ADMIN_BASE = `http://127.0.0.1:${process.env.E2E_MOCK_PORT || '18473'}`;--async function setRewardsScenario(value: string): Promise<void> {- await fetch(`${MOCK_ADMIN_BASE}/__admin/behavior`, {- method: 'POST',- headers: { 'Content-Type': 'application/json' },- body: JSON.stringify({ key: 'rewardsScenario', value }),- });-}--async function resetMock(): Promise<void> {- await fetch(`${MOCK_ADMIN_BASE}/__admin/reset`, {- method: 'POST',- headers: { 'Content-Type': 'application/json' },- body: JSON.stringify({}),- });-}--async function gotoRewards(page: import('@playwright/test').Page, scenario: string) {- await resetMock();- await setRewardsScenario(scenario);- await bootAuthenticatedPage(page, `pw-rewards-${scenario}`, '/rewards?view=main');- await waitForAppReady(page);- await dismissWalkthroughIfPresent(page);- await expect(page.getByText('Your Progress')).toBeVisible();-}--test.describe('Rewards Unlock Flow', () => {- test('activity-based unlock surfaces the streak achievement', async ({ page }) => {- await gotoRewards(page, 'activity_unlocked');- await expect(page.getByText('1 of 3 achievements unlocked')).toBeVisible();- await expect(page.getByText('7-Day Streak')).toBeVisible();- await expect(page.getByText('Unlocked', { exact: true })).toBeVisible();- });-- test('integration-based unlock reflects Discord membership', async ({ page }) => {- await gotoRewards(page, 'integration_unlocked');- await expect(page.getByText('1 of 3 achievements unlocked')).toBeVisible();- await expect(page.getByText('Joined the server')).toBeVisible();- await expect(page.getByText('Discord Member')).toBeVisible();- });-- test('plan-based unlock surfaces the PRO achievement', async ({ page }) => {- await gotoRewards(page, 'plan_unlocked');- await expect(page.getByText('1 of 3 achievements unlocked')).toBeVisible();- await expect(page.getByText('Pro Supporter')).toBeVisible();- await expect(page.getByText('Discord not connected')).toBeVisible();- });-});