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): strengthen four assertions weaker than the tests that carried them
M3gA-Mindffdfc91dbbe0
diff --git a/app/test/playwright/specs/app-shell-keyboard-navigation.spec.ts b/app/test/playwright/specs/app-shell-keyboard-navigation.spec.tsindex 722f933e7b..7243e606d7 100644--- a/app/test/playwright/specs/app-shell-keyboard-navigation.spec.ts+++ b/app/test/playwright/specs/app-shell-keyboard-navigation.spec.ts@@ -152,6 +152,13 @@ test.describe('App shell — keyboard traversal', () => {await navRow(page, 'connections').focus();await expect.poll(() => focused(page)).toBe('nav:tab-connections');+ // Same trap as the expanded case: `focus()` succeeds on a `tabindex="-1"`+ // element, so a collapsed row that Tab can never reach would pass a+ // focus-only check. Raised in review (#5887, CodeRabbit).+ expect(+ await navRow(page, 'connections').evaluate(el => (el as HTMLElement).tabIndex),+ 'collapsed rail row is focusable by script but not in the tab order'+ ).toBeGreaterThanOrEqual(0);await page.keyboard.press('Enter');await expect.poll(() => hash(page)).toMatch(/^#\/connections/);diff --git a/app/test/playwright/specs/app-shell-sidebar.spec.ts b/app/test/playwright/specs/app-shell-sidebar.spec.tsindex 257f15757b..627f9d14bd 100644--- a/app/test/playwright/specs/app-shell-sidebar.spec.ts+++ b/app/test/playwright/specs/app-shell-sidebar.spec.ts@@ -85,20 +85,24 @@ test.describe('App shell — sidebar navigation', () => {await expect.poll(() => activeRowId(page)).toBe('chat');});- test('the Rewards row appears only when the cloud nav gate allows it', async ({ page }) => {- // Recorded rather than asserted either way: NAV_TABS marks rewards- // `cloudOnly` and `useCloudNavGate()` decides. Whichever this session is,- // the row's presence must agree with whether /rewards is reachable from- // the sidebar at all — an absent row with a reachable route is a dead end- // for keyboard and screen-reader users.- const visible = await row(page, 'rewards').count();- if (visible > 0) {- await row(page, 'rewards').click();- await expect.poll(() => hash(page)).toMatch(/^#\/rewards/);- await expect.poll(() => activeRowId(page)).toBe('rewards');- } else {- expect(visible).toBe(0);- }+ test('the Rewards row is present for a cloud session and routes', async ({ page }) => {+ // Asserted, not recorded. The first version accepted `count === 0` as a+ // pass, which meant a regressed gate, a gate that never becomes ready, or a+ // deleted row all counted as success — precisely the failures the test+ // names (#5887, Codex).+ //+ // This fixture IS a cloud session, so the gate must open. `useCloudNavGate`+ // requires `isReady && sessionToken && !isLocalSessionToken(token)`+ // (`useCloudNavGate.ts:26-28`), and `isLocalSessionToken` is true only for a+ // token whose third dot-part is literally `local`+ // (`utils/localSession.ts:32-36`). `bootAuthenticatedPage` installs+ // `buildBypassJwt`, which ends `.sig` (`helpers/core-rpc.ts:17-22`) — so the+ // token is non-local and Rewards must be offered.+ await expect(row(page, 'rewards')).toHaveCount(1);++ await row(page, 'rewards').click();+ await expect.poll(() => hash(page)).toMatch(/^#\/rewards/);+ await expect.poll(() => activeRowId(page)).toBe('rewards');});});@@ -118,9 +122,19 @@ test.describe('App shell — collapse and the icon-only rail (#5676)', () => {const expandedWidth = await shell.evaluate(el => el.getBoundingClientRect().width);expect(expandedWidth).toBeGreaterThan(120);+ // The row labels are readable while expanded — `SidebarMenuLabel` renders+ // them as `[data-slot="sidebar-menu-label"]` spans.+ const labels = page.locator('[data-slot="sidebar-menu-label"]');+ expect(await labels.count()).toBeGreaterThan(0);+await page.getByRole('button', { name: 'Hide sidebar' }).click();await expect(shell).toHaveAttribute('data-state', 'collapsed');+ // The test is called "collapsing hides the labels" and did not check any+ // label — a regression leaving them visible passed (#5887, CodeRabbit).+ // Collapsed swaps `SidebarNav` for `CollapsedNavRail`, which renders icons+ // with `aria-label` and no label spans, so the count goes to zero.+ await expect(labels).toHaveCount(0);const collapsedWidth = await shell.evaluate(el => el.getBoundingClientRect().width);// The rail is still there — collapsed is icon-only, not gone. A regression// that unmounts the column instead of narrowing it passes any assertiondiff --git a/app/test/playwright/specs/command-palette-keyboard.spec.ts b/app/test/playwright/specs/command-palette-keyboard.spec.tsindex 926b0d8ced..b879b58003 100644--- a/app/test/playwright/specs/command-palette-keyboard.spec.ts+++ b/app/test/playwright/specs/command-palette-keyboard.spec.ts@@ -31,6 +31,26 @@ test.describe.configure({ timeout: 180_000 });const PALETTE_INPUT = 'input[cmdk-input]';const ITEM = '[cmdk-item]';+/**+ * Where each seed navigation action lands, from `lib/commands/globalActions.ts`+ * (`nav('/…')` handlers) followed through `AppRoutes.tsx`'s redirects.+ *+ * Needed because asserting "the hash is non-empty" cannot tell one action from+ * another — raised in review (#5887) by both CodeRabbit and Codex, and Codex+ * pinned down why it was worse than merely weak: the fixture boots on `#/chat`,+ * and the first two actions are `nav.home` (-> `/home` -> `/chat`) and+ * `nav.chat` (-> `/chat`), so the old assertion was already true BEFORE Enter+ * and stayed true whichever action ran, or if none did.+ */+const DESTINATIONS: Record<string, RegExp> = {+ 'nav.home': /^#\/chat/, // /home redirects to /chat+ 'nav.chat': /^#\/chat/,+ 'nav.intelligence': /^#\/settings\/intelligence/,+ 'nav.skills': /^#\/connections/,+ 'nav.activity': /^#\/settings\/notifications/, // /activity redirects+ 'nav.settings': /^#\/settings/,+};+const shortcut = () => (process.platform === 'darwin' ? 'Meta+K' : 'Control+K');async function openPalette(page: Page) {@@ -87,22 +107,39 @@ test.describe('Command palette — keyboard-only selection', () => {test('Enter runs the arrow-selected action, not the first one', async ({ page }) => {// This is the assertion that distinguishes a working arrow key from a// decorative one: if ArrowDown moved the highlight visually but Enter still- // fired item 0, the existing spec would never notice.+ // fired item 0, the test must fail.+ //+ // Start somewhere neither candidate lands, so "the route changed" carries+ // information at all.+ await page.goto('/#/brain');await openPalette(page);const ids = await visibleIds(page);+ const first = ids[0];const target = ids[1];expect(target).toBeTruthy();+ const firstDest = DESTINATIONS[first];+ const targetDest = DESTINATIONS[target];+ expect(targetDest, `no known destination for '${target}' — extend DESTINATIONS`).toBeTruthy();++ // If the top two actions happen to land in the same place, this fixture+ // cannot tell them apart and a pass would mean nothing. Fail loudly and+ // say so, rather than reporting a green that discriminates nothing.+ expect(+ firstDest?.source,+ `items 0 ('${first}') and 1 ('${target}') share a destination; ` ++ 'this test cannot detect the regression it names — pick a different fixture'+ ).not.toBe(targetDest.source);+await page.keyboard.press('ArrowDown');await expect.poll(() => selectedId(page)).toBe(target);await page.keyboard.press('Enter');await expect(page.locator(PALETTE_INPUT)).toHaveCount(0);- // The palette closed because an action ran. Which action is asserted by the- // route it produced — the seed actions are all navigations.- await expect.poll(() => hash(page)).not.toBe('');+ // The exact destination of the SELECTED action — not merely "some route".+ await expect.poll(() => hash(page)).toMatch(targetDest);});test('typing filters per keystroke and the highlight follows the surviving item', async ({