mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 10:27:33 +00:00
* test: remove repeated focused Linux text insertion * test: remove repeated foreground TextEdit replacement * test: remove Notepad smoke and duplicate paste coverage * test: drop repeated numeric row and scroll-work counters --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
35 lines
960 B
TypeScript
35 lines
960 B
TypeScript
import { expect } from 'vitest'
|
|
import type { ComputerSnapshotResult } from '../../../src/shared/runtime-types'
|
|
import { findRoleIndex, parseJsonOutput, runOrcaCli } from './computer-driver'
|
|
|
|
export const editableRolePattern = /^\s*(\d+)\s+(document|edit|text|pane)(?:\s|$)/im
|
|
export async function focusNotepadDocument(app: string): Promise<void> {
|
|
const snapshot = parseJsonOutput<{ result: ComputerSnapshotResult }>(
|
|
(
|
|
await runOrcaCli([
|
|
'computer',
|
|
'get-app-state',
|
|
'--app',
|
|
app,
|
|
'--restore-window',
|
|
'--no-screenshot',
|
|
'--json'
|
|
])
|
|
).stdout
|
|
)
|
|
const documentIndex = findRoleIndex(snapshot.result.snapshot.treeText, editableRolePattern)
|
|
expect(documentIndex).toBeGreaterThanOrEqual(0)
|
|
|
|
await runOrcaCli([
|
|
'computer',
|
|
'click',
|
|
'--app',
|
|
app,
|
|
'--element-index',
|
|
String(documentIndex),
|
|
'--restore-window',
|
|
'--no-screenshot',
|
|
'--json'
|
|
])
|
|
}
|