Files
archived-orca/tests/e2e/desktop/computer-use/notepad-document.ts
Neil a16afc4e67 refactor(e2e): group journeys by feature and repair browser recovery (#43628)
* refactor(e2e): group journeys and fixtures by feature ownership

* refactor(e2e): consolidate remaining Playwright owner imports

* test(ci): stop copying retired route modules into fixtures

* fix(browser): preserve one-shot follow intent across equal snapshots

* refactor(settings): colocate commit message defaults with source control

* test(browser): await page registration and focus the concrete page

* fix(browser): keep viewport recovery progressing during incompatible frames

* fix(browser): wait for stale helper exit before replacement commands
2026-11-17 11:44:44 -08:00

36 lines
1.0 KiB
TypeScript

import { expect } from 'vitest'
import type { ComputerSnapshotResult } from '../../../../src/shared/computer/computer-use-runtime-types'
import { findRoleIndex } from './computer-driver'
import { parseJsonOutput, runOrcaCli } from './computer-cli-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'
])
}