Files
orca/tests/e2e/helpers/notepad-document.ts
OrcaWinandOrcaWin 2f9b122201 test: remove native smoke and duplicate input checks (#42007)
* 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>
2026-11-13 04:23:13 -08:00

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'
])
}