mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
* fix(computer): report unasserted accessibility actions * fix(computer): fail closed on missing action metadata * Fix merged tab search test fixture
57 lines
1.9 KiB
TypeScript
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')
|
|
})
|
|
})
|