Files
orca/src/cli/computer-format.test.ts
T
Brennan Benson 2a760e310b fix(computer): report unasserted accessibility actions (#15028)
* fix(computer): report unasserted accessibility actions

* fix(computer): fail closed on missing action metadata

* Fix merged tab search test fixture
2026-08-18 11:29:26 -07:00

57 lines
1.9 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import type { ComputerActionResult } from '../shared/runtime-types'
import { formatComputerAction } from './computer-format'
describe('formatComputerAction', () => {
it('does not treat legacy action results without metadata as completed', () => {
const result: ComputerActionResult = {
snapshot: {
id: 'snap-1',
app: { name: 'Finder', bundleId: 'com.apple.finder', pid: 100 },
window: { title: 'Finder', id: 42, width: 800, height: 600 },
coordinateSpace: 'window',
treeText: 'tree',
elementCount: 5,
focusedElementId: null
},
screenshot: null,
screenshotStatus: { state: 'skipped', reason: 'no_screenshot_flag' }
}
const output = formatComputerAction('click', result)
expect(output).toContain('Click attempted, unverified (verification metadata unavailable)')
expect(output).toContain('Inspect with the command above')
expect(output).not.toContain('Click completed')
})
it('does not treat accessibility actions without verification as completed', () => {
const result: ComputerActionResult = {
snapshot: {
id: 'snap-1',
app: { name: 'Finder', bundleId: 'com.apple.finder', pid: 100 },
window: { title: 'Finder', id: 42, width: 800, height: 600 },
coordinateSpace: 'window',
treeText: 'tree',
elementCount: 5,
focusedElementId: null
},
screenshot: null,
screenshotStatus: { state: 'skipped', reason: 'no_screenshot_flag' },
action: {
path: 'accessibility',
actionName: 'click',
targetWindowId: 42
}
}
const output = formatComputerAction('click', result)
expect(output).toContain(
'Click attempted via accessibility, unverified (accessibility action unasserted)'
)
expect(output).toContain('Inspect with the command above')
expect(output).not.toContain('Click completed')
})
})