import { Application , Terminal , TerminalCommandId , TerminalCommandIdWithValue } from '../../../../automation' ; export function setup ( ) { describe ( 'Terminal Persistence' , ( ) => { let terminal ; before ( function ( ) { const app = this . app as Application ; terminal = app . workbench . terminal ; } ) ; describe ( 'detach/attach' , ( ) => { it . skip ( 'should support basic reconnection' , async ( ) => { await terminal . createTerminal ( ) ; await terminal . assertTerminalGroups ( [ [ { name : '.*' } ] ] ) ; await terminal . assertTerminalGroups ( [ [ { name : '.*' } ] ] ) ; const name = ( await terminal . getTerminalGroups ( ) ) [ 0 ] [ 0 ] . name ! ; await terminal . runCommand ( TerminalCommandId . DetachSession ) ; await terminal . assertTerminalViewHidden ( ) ; await terminal . runCommandWithValue ( TerminalCommandIdWithValue . AttachToSession , name ) ; await terminal . assertTerminalGroups ( [ [ { name } ] ] ) ; } ) ; it . skip ( 'should persist buffer content' , async ( ) => { await terminal . createTerminal ( ) ; await terminal . assertTerminalGroups ( [ [ { name : '.*' } ] ] ) ; await terminal . assertTerminalGroups ( [ [ { name : '.*' } ] ] ) ; const name = ( await terminal . getTerminalGroups ( ) ) [ 0 ] [ 0 ] . name ! ; await terminal . runCommandInTerminal ( 'echo terminal_test_content' ) ; await terminal . waitForTerminalText ( buffer => buffer . some ( e => e . includes ( 'terminal_test_content' ) ) ) ; await terminal . runCommand ( TerminalCommandId . DetachSession ) ; await terminal . assertTerminalViewHidden ( ) ; await terminal . runCommandWithValue ( TerminalCommandIdWithValue . AttachToSession , name ) ; await terminal . assertTerminalGroups ( [ [ { name } ] ] ) ; await terminal . waitForTerminalText ( buffer => buffer . some ( e => e . includes ( 'terminal_test_content' ) ) ) ; } ) ; it . skip ( 'should persist terminal icon' , async ( ) => { await terminal . createTerminal ( ) ; await terminal . assertTerminalGroups ( [ [ { name : '.*' } ] ] ) ; const name = ( await terminal . getTerminalGroups ( ) ) [ 0 ] [ 0 ] . name ! ; await terminal . runCommandWithValue ( TerminalCommandIdWithValue . ChangeIcon , 'symbol-method' ) ; await terminal . assertSingleTab ( { icon : 'symbol-method' } ) ; await terminal . runCommand ( TerminalCommandId . DetachSession ) ; await terminal . assertTerminalViewHidden ( ) ; await terminal . runCommandWithValue ( TerminalCommandIdWithValue . AttachToSession , name ) ; await terminal . assertTerminalGroups ( [ [ { name } ] ] ) ; await terminal . assertSingleTab ( { icon : 'symbol-method' } ) ; } ) ; } ) ; } ) ; }