Skip to content

Commit fd0fa73

Browse files
committed
test(desktop): computer-use snapshots survive actions that sent nothing
1 parent 4ae9182 commit fd0fa73

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎apps/desktop/src/main/computer-use/service.test.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,28 @@ describe('native computer use authority and lifecycle', () => {
296296
await expect(click('s1', 'chat', 'repeat')).rejects.toThrow('stale')
297297
})
298298

299+
it('keeps a snapshot usable after an action that sent nothing to the app', async () => {
300+
const { state, native, click } = setup()
301+
await state()
302+
native.request.mockRejectedValueOnce(
303+
new ComputerUseError({
304+
code: 'window_occluded',
305+
message: 'Covered.',
306+
dispatchState: 'not_started',
307+
})
308+
)
309+
await expect(click('s1', 'chat', 'refused')).rejects.toThrow('Covered.')
310+
await expect(click('s1', 'chat', 'retry')).resolves.toMatchObject({ dispatched: true })
311+
})
312+
313+
it('consumes a snapshot after an action whose dispatch is unknown', async () => {
314+
const { state, native, click } = setup()
315+
await state()
316+
native.request.mockRejectedValueOnce(new Error('Computer Use helper exited.'))
317+
await expect(click('s1', 'chat', 'lost')).rejects.toThrow('exited')
318+
await expect(click('s1', 'chat', 'repeat')).rejects.toThrow('stale')
319+
})
320+
299321
it.each(['app', 'window'])('rejects a follow-up snapshot from a different %s', async (target) => {
300322
const { state, service, native, click } = setup()
301323
await state()

0 commit comments

Comments
 (0)