@@ -315,7 +315,40 @@ createRoot(document.getElementById('settings')).render(
315315 await expect (
316316 window . getByRole ( 'switch' , { name : 'Full file access' , exact : true } )
317317 ) . not . toBeChecked ( )
318- await window . getByRole ( 'switch' , { name : 'Full file access' , exact : true } ) . click ( )
318+ const permission = await requestPermission ( { operation : 'read' , toolCallId : 'fullAccess' } )
319+ const confirmationShown = app . waitForEvent ( 'window' )
320+ await permission . prompt
321+ . getByRole ( 'button' , { name : 'Allow all files…' , exact : true } )
322+ . click ( { noWaitAfter : true } )
323+ const confirmation = await confirmationShown
324+ await expect ( confirmation . getByRole ( 'button' , { name : 'Cancel' , exact : true } ) ) . toBeFocused ( )
325+ const returnedPrompt = app . waitForEvent ( 'window' )
326+ await confirmation
327+ . getByRole ( 'button' , { name : 'Cancel' , exact : true } )
328+ . click ( { noWaitAfter : true } )
329+ const folderPrompt = await returnedPrompt
330+ expect (
331+ await window . evaluate ( async ( ) =>
332+ (
333+ globalThis as typeof globalThis & { simDesktop : SimDesktopApi }
334+ ) . simDesktop . settings . getPreferences ( )
335+ )
336+ ) . toMatchObject ( { fullFileAccess : false } )
337+ const acceptedConfirmation = app . waitForEvent ( 'window' )
338+ await folderPrompt
339+ . getByRole ( 'button' , { name : 'Allow all files…' , exact : true } )
340+ . click ( { noWaitAfter : true } )
341+ const allowAll = await acceptedConfirmation
342+ await allowAll . screenshot ( {
343+ path : test . info ( ) . outputPath ( 'full-file-access-confirmation.png' ) ,
344+ } )
345+ await allowAll
346+ . getByRole ( 'button' , { name : 'Allow all files' , exact : true } )
347+ . click ( { noWaitAfter : true } )
348+ expect ( await permission . result ) . toMatchObject ( {
349+ ok : true ,
350+ data : { text : 'full access contents' } ,
351+ } )
319352 await expect (
320353 window . getByRole ( 'switch' , { name : 'Full file access' , exact : true } )
321354 ) . toBeChecked ( )
@@ -383,11 +416,11 @@ createRoot(document.getElementById('settings')).render(
383416 await expect (
384417 window . getByRole ( 'switch' , { name : 'Full file access' , exact : true } )
385418 ) . not . toBeChecked ( )
386- const permission = await requestPermission ( { operation : 'read' , toolCallId : 'fullAccess' } )
387- await permission . prompt
419+ const revoked = await requestPermission ( { operation : 'read' , toolCallId : 'fullAccess' } )
420+ await revoked . prompt
388421 . getByRole ( 'button' , { name : "Don't allow" , exact : true } )
389422 . click ( { noWaitAfter : true } )
390- expect ( await permission . result ) . toMatchObject ( { ok : false } )
423+ expect ( await revoked . result ) . toMatchObject ( { ok : false } )
391424 } )
392425 await test . step ( 'a folder grant works in another chat but does not permit symlink escapes' , async ( ) => {
393426 expect ( await invoke ( { operation : 'read' , toolCallId : 'otherChat' } ) ) . toMatchObject ( {
0 commit comments