mirror of
https://github.com/stablyai/orca.git
synced 2026-09-24 08:02:33 +00:00
#13314 landed terminal-macos-system-key-remap.spec.ts but its final commit, "chore: drop non-mergeable IME e2e scratch files", deleted the three modules it imports. The spec survived; terminal-ime-pane-arena, terminal-ime-cdp-composition and terminal-ime-platform-policy did not. Playwright resolves every spec before running any of them, so the unresolved import is fatal for the whole run, not just that file: `playwright test --list` on main reports "Total: 0 tests in 0 files". All ten scheduled E2E shards have been failing at collection since, and the macOS system-key-remap coverage the PR was for has never run once. No typecheck project includes tests/, which is why this stayed invisible outside the E2E lane. Restored from the commit before the drop. pane-arena and platform-policy come back verbatim; cdp-composition keeps only the four entry points this spec uses, since the rest served specs that were not merged. Its doc comment is retargeted accordingly — the composition-session drivers are the part that went. Collection is back to 528 tests in 222 files and all six remap tests pass.
51 lines
1.8 KiB
TypeScript
51 lines
1.8 KiB
TypeScript
import type { CDPSession, Page, TestInfo } from '@stablyai/playwright-test'
|
|
import { ensureTerminalVisible, waitForActiveWorktree, waitForSessionReady } from './helpers/store'
|
|
import {
|
|
focusActiveTerminalInput,
|
|
sendToTerminal,
|
|
waitForActivePanePtyId,
|
|
waitForActiveTerminalManager
|
|
} from './helpers/terminal'
|
|
import {
|
|
attachTerminalImeBoundaryEvidence,
|
|
disposeTerminalImeBoundaryProbe,
|
|
installTerminalImeBoundaryProbe
|
|
} from './terminal-ime-boundary-probe'
|
|
|
|
/** A focused terminal pane with a CDP session and the boundary probe already attached. */
|
|
export type TerminalImePaneArena = {
|
|
page: Page
|
|
session: CDPSession
|
|
ptyId: string
|
|
}
|
|
|
|
export async function openTerminalImePaneArena(page: Page): Promise<TerminalImePaneArena> {
|
|
await waitForSessionReady(page)
|
|
await waitForActiveWorktree(page)
|
|
await ensureTerminalVisible(page)
|
|
await waitForActiveTerminalManager(page, 30_000)
|
|
const ptyId = await waitForActivePanePtyId(page)
|
|
const session = await page.context().newCDPSession(page)
|
|
await focusActiveTerminalInput(page)
|
|
await installTerminalImeBoundaryProbe(page)
|
|
return { page, session, ptyId }
|
|
}
|
|
|
|
/**
|
|
* `interrupt` sends Ctrl+C only when the test did not reach its end, so a spec that failed
|
|
* mid-composition cannot leave a byte reader holding the pane for the next test in the worker.
|
|
*/
|
|
export async function closeTerminalImePaneArena(
|
|
arena: TerminalImePaneArena,
|
|
testInfo: TestInfo,
|
|
evidenceName: string,
|
|
interrupt: boolean
|
|
): Promise<void> {
|
|
await attachTerminalImeBoundaryEvidence(arena.page, testInfo, evidenceName).catch(() => undefined)
|
|
await disposeTerminalImeBoundaryProbe(arena.page).catch(() => undefined)
|
|
await arena.session.detach().catch(() => undefined)
|
|
if (interrupt) {
|
|
await sendToTerminal(arena.page, arena.ptyId, '\x03').catch(() => undefined)
|
|
}
|
|
}
|