import { Application , Terminal , SettingsEditor } from '../../../../automation' ; export function setup ( ) { describe ( 'Terminal Input' , ( ) => { let terminal ; let settingsEditor ; before ( async function ( ) { const app = this . app as Application ; terminal = app . workbench . terminal ; settingsEditor = app . workbench . settingsEditor ; } ) ; describe ( 'Auto replies' , function ( ) { if ( process . platform === 'win32' ) { this . retries ( 3 ) ; } async function writeTextForAutoReply ( text ) { await terminal . runCommandInTerminal ( `"\r${ text }` , true ) ; } it . skip ( 'should automatically reply to default "Terminate batch job (Y/N)"' , async ( ) => { await terminal . createTerminal ( ) ; await writeTextForAutoReply ( 'Terminate batch job (Y/N)?' ) ; await terminal . waitForTerminalText ( buffer => buffer . some ( line => line . match ( /\?.*Y/ ) ) ) ; } ) ; it ( 'should automatically reply to a custom entry' , async ( ) => { await settingsEditor . addUserSetting ( 'terminal.integrated.autoReplies' , '{ "foo": "bar" }' ) ; await terminal . createTerminal ( ) ; await writeTextForAutoReply ( 'foo' ) ; await terminal . waitForTerminalText ( buffer => buffer . some ( line => line . match ( /foo.*bar/ ) ) ) ; } ) ; } ) ; } ) ; }