mirror of
https://github.com/stablyai/orca.git
synced 2026-09-23 16:02:24 +00:00
* test: add golden e2e tests for agent TUI launch and shell recovery
Add test fixtures and E2E tests to verify agent TUI functionality:
- Stub agent implementation supports cross-platform execution (Unix/Windows)
- Test verifies multiline composer with Shift+Enter support in agent TUI
- Test verifies clean shell resumes after agent exit without state leakage
* test: add golden e2e tests for agent TUI launch and shell recovery
Add agent TUI launch and shell-recovery tests to the golden (release-blocking)
E2E suite, covering agent initialization and shell availability after agent
exit. Improve escape sequence handling in the stub agent to prevent stray key
reports from contaminating test output. Add terminal input readiness checks to
ensure commands execute reliably before verification.
* test: coerce golden stub stdin chunks for type-aware lint
Node types the stdin data event as string | Buffer even after
setEncoding('utf8'), so restrict-plus-operands failed CI.
* test: fix golden stub agent Windows batch files and add Ctrl+C support
- Store batch files with CRLF to avoid Windows 512-byte parser boundary bug
- Handle Ctrl+C (0x03) in raw mode as alternative to Ctrl+D (0x04)
- Update release notes documenting golden test skip behavior on older tags
* Remove Windows batch file gitattributes workaround
The -text whitespace=cr-at-eol rule preventing CRLF conversion for
.cmd files is no longer needed. Allow batch files to use normalized
line endings.
65 lines
2.8 KiB
TypeScript
65 lines
2.8 KiB
TypeScript
import { expect, test } from './helpers/orca-app'
|
|
import {
|
|
configureGoldenStubAgent,
|
|
getGoldenStubAgentLaunchEnv,
|
|
GOLDEN_STUB_EXIT_MARKER,
|
|
launchGoldenStubAgentFromNewTab
|
|
} from './helpers/golden-stub-agent'
|
|
import { ensureTerminalVisible, waitForActiveWorktree, waitForSessionReady } from './helpers/store'
|
|
import { waitForRestoredTerminalInputReady } from './helpers/restored-terminal-input-readiness'
|
|
import {
|
|
focusActiveTerminalInput,
|
|
waitForActivePanePtyId,
|
|
waitForTerminalOutput
|
|
} from './helpers/terminal'
|
|
|
|
test.use({ launchEnv: getGoldenStubAgentLaunchEnv() })
|
|
|
|
// Why: xterm renders the typed command itself, so `echo after-agent` would
|
|
// satisfy waitForTerminalOutput even if the shell never ran it. Splitting the
|
|
// marker keeps it out of the input, so a match proves real shell execution.
|
|
function buildSplitMarkerEcho(prefix: string, suffix: string): { command: string; marker: string } {
|
|
const command =
|
|
process.platform === 'win32'
|
|
? `Write-Output ('${prefix}' + '${suffix}')`
|
|
: `echo "${prefix}""${suffix}"`
|
|
return { command, marker: `${prefix}${suffix}` }
|
|
}
|
|
|
|
test('opens a clean live shell after an agent exits', async ({ orcaPage }) => {
|
|
await waitForSessionReady(orcaPage)
|
|
await waitForActiveWorktree(orcaPage)
|
|
await ensureTerminalVisible(orcaPage)
|
|
await configureGoldenStubAgent(orcaPage)
|
|
await launchGoldenStubAgentFromNewTab(orcaPage)
|
|
|
|
await orcaPage.keyboard.type('exit')
|
|
await orcaPage.keyboard.press('Enter')
|
|
await waitForTerminalOutput(orcaPage, GOLDEN_STUB_EXIT_MARKER, 15_000)
|
|
|
|
const tabsBeforeShell = await orcaPage.locator('[data-testid="sortable-tab"]').count()
|
|
await orcaPage.getByRole('button', { name: 'New tab' }).click({ force: true })
|
|
await orcaPage
|
|
.getByRole('menuitem', { name: /New Terminal/i })
|
|
.first()
|
|
.click({ force: true })
|
|
await expect(orcaPage.locator('[data-testid="sortable-tab"]')).toHaveCount(tabsBeforeShell + 1)
|
|
const shellPtyId = await waitForActivePanePtyId(orcaPage)
|
|
// Why: a bound ptyId only means the pane exists; the renderer transport can
|
|
// still drop keystrokes until it connects, which would strand the markers.
|
|
expect(await waitForRestoredTerminalInputReady(orcaPage, shellPtyId)).toBe(true)
|
|
|
|
const afterAgent = buildSplitMarkerEcho('after-', 'agent')
|
|
await focusActiveTerminalInput(orcaPage)
|
|
await orcaPage.keyboard.type(afterAgent.command)
|
|
await orcaPage.keyboard.press('Enter')
|
|
await waitForTerminalOutput(orcaPage, afterAgent.marker, 15_000)
|
|
|
|
const afterShiftEnter = buildSplitMarkerEcho('after-shift-', 'enter')
|
|
await orcaPage.keyboard.press('Shift+Enter')
|
|
await orcaPage.keyboard.type(afterShiftEnter.command)
|
|
await orcaPage.keyboard.press('Enter')
|
|
await waitForTerminalOutput(orcaPage, afterShiftEnter.marker, 15_000)
|
|
await expect(orcaPage.locator('[data-testid="sortable-tab"]')).toHaveCount(tabsBeforeShell + 1)
|
|
})
|