Files
orca/tests/e2e/helpers/paired-client-host-session.ts
Jinwoo Hong ae0f3675a1 fix(remote): focus host-delegated split panes (#16886)
* fix(remote): focus host-delegated split panes

Return the authoritative leaf identity from terminal.split, record viewer-local focus intent behind the captured pairing revision, and replay the mirrored layout before focusing the exact pane. Preserve old-host fallback and prevent delayed split responses from stealing focus after the viewer moves away.

Add deterministic runtime, renderer, concurrency, compatibility, and headed paired-Electron coverage for Cmd+D, header splits, and immediate PTY input routing.

Fixes #16510

* fix(remote): preserve split focus across tab groups

Resolve the initiating source tab and leaf from the remote PTY, while keeping the viewer's current focus as a separate anti-steal baseline. This lets context-menu/header splits from non-focused group tabs focus their result without allowing delayed responses to override a later navigation.

* test(remote): drive split focus with key events

* test(remote): use the platform split shortcut

* fix(remote): fence concurrent split focus intent

* fix(remote): harden split focus ordering

* fix(remote): preserve split focus after runtime refactor

* fix(remote): fence stale split focus gestures

* test(remote): keep split focus regression within line budget
2026-08-30 03:07:20 -04:00

42 lines
1.1 KiB
TypeScript

import type { Page } from '@stablyai/playwright-test'
import { expect } from './orca-app'
export async function callPairedRuntime<TResult>(
page: Page,
selector: string,
method: string,
params: unknown
): Promise<TResult> {
return page.evaluate(
async ({ method, params, selector }) => {
const response = await window.api.runtimeEnvironments.call({ selector, method, params })
if (!response.ok) {
throw new Error(`${response.error.code}: ${response.error.message}`)
}
return response.result
},
{ method, params, selector }
) as Promise<TResult>
}
export async function waitForPairedClientWorktree(
page: Page,
expectedId?: string
): Promise<string> {
const read = (): Promise<string | null> =>
page.evaluate(
(id) =>
window.__store
?.getState()
.allWorktrees()
.find((worktree) => !id || worktree.id === id)?.id ?? null,
expectedId
)
await expect.poll(read, { timeout: 30_000 }).not.toBeNull()
const worktreeId = await read()
if (!worktreeId) {
throw new Error('Paired client did not receive the host workspace')
}
return worktreeId
}