mirror of
https://github.com/stablyai/orca.git
synced 2026-10-24 00:04:01 +00:00
test: poll terminal readiness in expectSingleOwningPty
Retry the terminal list assertion with polling to account for timing delays in PTY state reporting from the runtime.
This commit is contained in:
@@ -83,15 +83,24 @@ async function expectSingleOwningPty(
|
||||
terminal: string,
|
||||
ptyId: string
|
||||
): Promise<void> {
|
||||
const listed = await callStartupExecRuntime<RuntimeTerminalListResult>(page, 'terminal.list', {
|
||||
worktree: `id:${worktreeId}`,
|
||||
requireFreshPtyLiveness: true
|
||||
})
|
||||
expect(
|
||||
listed.terminals
|
||||
.filter((candidate) => candidate.tabId === tabId)
|
||||
.map((candidate) => ({ handle: candidate.handle, ptyId: candidate.ptyId }))
|
||||
).toEqual([{ handle: terminal, ptyId }])
|
||||
await expect
|
||||
.poll(
|
||||
async () => {
|
||||
const listed = await callStartupExecRuntime<RuntimeTerminalListResult>(
|
||||
page,
|
||||
'terminal.list',
|
||||
{
|
||||
worktree: `id:${worktreeId}`,
|
||||
requireFreshPtyLiveness: true
|
||||
}
|
||||
)
|
||||
return listed.terminals
|
||||
.filter((candidate) => candidate.tabId === tabId)
|
||||
.map((candidate) => ({ handle: candidate.handle, ptyId: candidate.ptyId }))
|
||||
},
|
||||
{ timeout: 30_000 }
|
||||
)
|
||||
.toEqual([{ handle: terminal, ptyId }])
|
||||
}
|
||||
|
||||
export async function callStartupExecRuntime<TResult>(
|
||||
|
||||
Reference in New Issue
Block a user